Completed
Branch BUG-10042-attendee-mover-confl... (7256e1)
by
unknown
75:46 queued 57:06
created
core/helpers/EEH_Line_Item.helper.php 1 patch
Spacing   +354 added lines, -354 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,20 +123,20 @@  discard block
 block discarded – undo
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
-		echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() \n";
128
-		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total() ) {
129
-			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
+		echo "\n\n ".__LINE__.") ".__METHOD__."() \n";
128
+		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total()) {
129
+			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()));
130 130
 		}
131 131
 		// either increment the qty for an existing ticket
132
-		$line_item = self::increment_ticket_qty_if_already_in_cart( $total_line_item, $ticket, $qty );
132
+		$line_item = self::increment_ticket_qty_if_already_in_cart($total_line_item, $ticket, $qty);
133 133
 		// or add a new one
134
-		if ( ! $line_item instanceof EE_Line_Item ) {
135
-			$line_item = self::create_ticket_line_item( $total_line_item, $ticket, $qty );
134
+		if ( ! $line_item instanceof EE_Line_Item) {
135
+			$line_item = self::create_ticket_line_item($total_line_item, $ticket, $qty);
136 136
 		}
137
-		echo "\n {$line_item->name()} line_item->total(): " . $line_item->total() . "\n";
137
+		echo "\n {$line_item->name()} line_item->total(): ".$line_item->total()."\n";
138 138
 		$total_line_item->recalculate_total_including_taxes();
139
-		echo "\n {$line_item->name()} line_item->total(): " . $line_item->total() . "\n";
139
+		echo "\n {$line_item->name()} line_item->total(): ".$line_item->total()."\n";
140 140
 		return $line_item;
141 141
 	}
142 142
 
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
 	 * @return \EE_Line_Item
151 151
 	 * @throws \EE_Error
152 152
 	 */
153
-	public static function increment_ticket_qty_if_already_in_cart( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
153
+	public static function increment_ticket_qty_if_already_in_cart(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
154 154
 		$line_item = null;
155
-		if ( $total_line_item instanceof EE_Line_Item && $total_line_item->is_total() ) {
156
-			$ticket_line_items = EEH_Line_Item::get_ticket_line_items( $total_line_item );
157
-			foreach ( (array)$ticket_line_items as $ticket_line_item ) {
155
+		if ($total_line_item instanceof EE_Line_Item && $total_line_item->is_total()) {
156
+			$ticket_line_items = EEH_Line_Item::get_ticket_line_items($total_line_item);
157
+			foreach ((array) $ticket_line_items as $ticket_line_item) {
158 158
 				if (
159 159
 					$ticket_line_item instanceof EE_Line_Item
160 160
 					&& (int) $ticket_line_item->OBJ_ID() === (int) $ticket->ID()
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 				}
165 165
 			}
166 166
 		}
167
-		if ( $line_item instanceof EE_Line_Item ) {
168
-			echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() \n";
169
-			EEH_Line_Item::increment_quantity( $line_item, $qty );
167
+		if ($line_item instanceof EE_Line_Item) {
168
+			echo "\n\n ".__LINE__.") ".__METHOD__."() \n";
169
+			EEH_Line_Item::increment_quantity($line_item, $qty);
170 170
 			return $line_item;
171 171
 		}
172 172
 		return null;
@@ -183,16 +183,16 @@  discard block
 block discarded – undo
183 183
 	 * @return void
184 184
 	 * @throws \EE_Error
185 185
 	 */
186
-	public static function increment_quantity( EE_Line_Item $line_item, $qty = 1 ) {
187
-		if( ! $line_item->is_percent() ) {
186
+	public static function increment_quantity(EE_Line_Item $line_item, $qty = 1) {
187
+		if ( ! $line_item->is_percent()) {
188 188
 			$qty += $line_item->quantity();
189
-			$line_item->set_quantity( $qty );
190
-			$line_item->set_total( $line_item->unit_price() * $qty );
189
+			$line_item->set_quantity($qty);
190
+			$line_item->set_total($line_item->unit_price() * $qty);
191 191
 			$line_item->save();
192 192
 		}
193
-		foreach( $line_item->children() as $child ) {
194
-			if( $child->is_sub_line_item() ) {
195
-				EEH_Line_Item::update_quantity( $child, $qty );
193
+		foreach ($line_item->children() as $child) {
194
+			if ($child->is_sub_line_item()) {
195
+				EEH_Line_Item::update_quantity($child, $qty);
196 196
 			}
197 197
 		}
198 198
 	}
@@ -208,17 +208,17 @@  discard block
 block discarded – undo
208 208
 	 * @return void
209 209
 	 * @throws \EE_Error
210 210
 	 */
211
-	public static function decrement_quantity( EE_Line_Item $line_item, $qty = 1 ) {
212
-		if( ! $line_item->is_percent() ) {
211
+	public static function decrement_quantity(EE_Line_Item $line_item, $qty = 1) {
212
+		if ( ! $line_item->is_percent()) {
213 213
 			$qty = $line_item->quantity() - $qty;
214
-			$qty = max( $qty, 0 );
215
-			$line_item->set_quantity( $qty );
216
-			$line_item->set_total( $line_item->unit_price() * $qty );
214
+			$qty = max($qty, 0);
215
+			$line_item->set_quantity($qty);
216
+			$line_item->set_total($line_item->unit_price() * $qty);
217 217
 			$line_item->save();
218 218
 		}
219
-		foreach( $line_item->children() as $child ) {
220
-			if( $child->is_sub_line_item() ) {
221
-				EEH_Line_Item::update_quantity( $child, $qty );
219
+		foreach ($line_item->children() as $child) {
220
+			if ($child->is_sub_line_item()) {
221
+				EEH_Line_Item::update_quantity($child, $qty);
222 222
 			}
223 223
 		}
224 224
 	}
@@ -233,15 +233,15 @@  discard block
 block discarded – undo
233 233
 	 * @param int          $new_quantity
234 234
 	 * @throws \EE_Error
235 235
 	 */
236
-	public static function update_quantity( EE_Line_Item $line_item, $new_quantity ) {
237
-		if( ! $line_item->is_percent() ) {
238
-			$line_item->set_quantity( $new_quantity );
239
-			$line_item->set_total( $line_item->unit_price() * $new_quantity );
236
+	public static function update_quantity(EE_Line_Item $line_item, $new_quantity) {
237
+		if ( ! $line_item->is_percent()) {
238
+			$line_item->set_quantity($new_quantity);
239
+			$line_item->set_total($line_item->unit_price() * $new_quantity);
240 240
 			$line_item->save();
241 241
 		}
242
-		foreach( $line_item->children() as $child ) {
243
-			if( $child->is_sub_line_item() ) {
244
-				EEH_Line_Item::update_quantity( $child, $new_quantity );
242
+		foreach ($line_item->children() as $child) {
243
+			if ($child->is_sub_line_item()) {
244
+				EEH_Line_Item::update_quantity($child, $new_quantity);
245 245
 			}
246 246
 		}
247 247
 	}
@@ -256,47 +256,47 @@  discard block
 block discarded – undo
256 256
 	 * @return \EE_Line_Item
257 257
 	 * @throws \EE_Error
258 258
 	 */
259
-	public static function create_ticket_line_item( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
260
-		echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() \n";
259
+	public static function create_ticket_line_item(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
260
+		echo "\n\n ".__LINE__.") ".__METHOD__."() \n";
261 261
 		$datetimes = $ticket->datetimes();
262
-		$first_datetime = reset( $datetimes );
263
-		if( $first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event ) {
262
+		$first_datetime = reset($datetimes);
263
+		if ($first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event) {
264 264
 			$first_datetime_name = $first_datetime->event()->name();
265 265
 		} else {
266
-			$first_datetime_name = __( 'Event', 'event_espresso' );
266
+			$first_datetime_name = __('Event', 'event_espresso');
267 267
 		}
268
-		$event = sprintf( _x( '(For %1$s)', '(For Event Name)', 'event_espresso' ), $first_datetime_name );
268
+		$event = sprintf(_x('(For %1$s)', '(For Event Name)', 'event_espresso'), $first_datetime_name);
269 269
 		// get event subtotal line
270
-		$events_sub_total = self::get_event_line_item_for_ticket( $total_line_item, $ticket );
271
-		echo "\n events_sub_total->name(): " . $events_sub_total->name() . "\n";
272
-		echo "\n ticket->name(): " . $ticket->name() . "\n";
273
-		echo "\n ticket->price(): " . $ticket->price() . "\n";
270
+		$events_sub_total = self::get_event_line_item_for_ticket($total_line_item, $ticket);
271
+		echo "\n events_sub_total->name(): ".$events_sub_total->name()."\n";
272
+		echo "\n ticket->name(): ".$ticket->name()."\n";
273
+		echo "\n ticket->price(): ".$ticket->price()."\n";
274 274
 		// add $ticket to cart
275
-		$line_item = EE_Line_Item::new_instance( array(
275
+		$line_item = EE_Line_Item::new_instance(array(
276 276
 			'LIN_name'       	=> $ticket->name(),
277
-			'LIN_desc'       		=> $ticket->description() !== '' ? $ticket->description() . ' ' . $event : $event,
277
+			'LIN_desc'       		=> $ticket->description() !== '' ? $ticket->description().' '.$event : $event,
278 278
 			'LIN_unit_price' 	=> $ticket->price(),
279 279
 			'LIN_quantity'   	=> $qty,
280 280
 			'LIN_is_taxable' 	=> $ticket->taxable(),
281
-			'LIN_order'      	=> count( $events_sub_total->children() ),
281
+			'LIN_order'      	=> count($events_sub_total->children()),
282 282
 			'LIN_total'      		=> $ticket->price() * $qty,
283 283
 			'LIN_type'       		=> EEM_Line_Item::type_line_item,
284 284
 			'OBJ_ID'         		=> $ticket->ID(),
285 285
 			'OBJ_type'       	=> 'Ticket'
286
-		) );
286
+		));
287 287
 		$line_item = apply_filters(
288 288
 			'FHEE__EEH_Line_Item__create_ticket_line_item__line_item',
289 289
 			$line_item
290 290
 		);
291
-		$events_sub_total->add_child_line_item( $line_item );
291
+		$events_sub_total->add_child_line_item($line_item);
292 292
 		//now add the sub-line items
293 293
 		$running_total_for_ticket = 0;
294
-		foreach ( $ticket->prices( array( 'order_by' => array( 'PRC_order' => 'ASC' ) ) ) as $price ) {
294
+		foreach ($ticket->prices(array('order_by' => array('PRC_order' => 'ASC'))) as $price) {
295 295
 			$sign = $price->is_discount() ? -1 : 1;
296 296
 			$price_total = $price->is_percent()
297 297
 				? $running_total_for_ticket * $price->amount() / 100
298 298
 				: $price->amount() * $qty;
299
-			$sub_line_item = EE_Line_Item::new_instance( array(
299
+			$sub_line_item = EE_Line_Item::new_instance(array(
300 300
 				'LIN_name'       	=> $price->name(),
301 301
 				'LIN_desc'       		=> $price->desc(),
302 302
 				'LIN_quantity'   	=> $price->is_percent() ? null : $qty,
@@ -306,18 +306,18 @@  discard block
 block discarded – undo
306 306
 				'LIN_type'       		=> EEM_Line_Item::type_sub_line_item,
307 307
 				'OBJ_ID'         		=> $price->ID(),
308 308
 				'OBJ_type'       	=> 'Price'
309
-			) );
309
+			));
310 310
 			$sub_line_item = apply_filters(
311 311
 				'FHEE__EEH_Line_Item__create_ticket_line_item__sub_line_item',
312 312
 				$sub_line_item
313 313
 			);
314
-			if ( $price->is_percent() ) {
315
-				$sub_line_item->set_percent( $sign * $price->amount() );
314
+			if ($price->is_percent()) {
315
+				$sub_line_item->set_percent($sign * $price->amount());
316 316
 			} else {
317
-				$sub_line_item->set_unit_price( $sign * $price->amount() );
317
+				$sub_line_item->set_unit_price($sign * $price->amount());
318 318
 			}
319 319
 			$running_total_for_ticket += $price_total;
320
-			$line_item->add_child_line_item( $sub_line_item );
320
+			$line_item->add_child_line_item($sub_line_item);
321 321
 		}
322 322
 		return $line_item;
323 323
 	}
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	 * @return boolean
338 338
 	 * @throws \EE_Error
339 339
 	 */
340
-	public static function add_item( EE_Line_Item $total_line_item, EE_Line_Item $item ){
341
-		$pre_tax_subtotal = self::get_pre_tax_subtotal( $total_line_item );
342
-		if ( $pre_tax_subtotal instanceof EE_Line_Item ){
340
+	public static function add_item(EE_Line_Item $total_line_item, EE_Line_Item $item) {
341
+		$pre_tax_subtotal = self::get_pre_tax_subtotal($total_line_item);
342
+		if ($pre_tax_subtotal instanceof EE_Line_Item) {
343 343
 			$success = $pre_tax_subtotal->add_child_line_item($item);
344
-		}else{
344
+		} else {
345 345
 			return FALSE;
346 346
 		}
347 347
 		$total_line_item->recalculate_total_including_taxes();
@@ -360,34 +360,34 @@  discard block
 block discarded – undo
360 360
 	 * @return bool success
361 361
 	 * @throws \EE_Error
362 362
 	 */
363
-	public static function cancel_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) {
363
+	public static function cancel_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1) {
364 364
 		// validate incoming line_item
365
-		if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) {
365
+		if ($ticket_line_item->OBJ_type() !== 'Ticket') {
366 366
 			throw new EE_Error(
367 367
 				sprintf(
368
-					__( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ),
368
+					__('The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso'),
369 369
 					$ticket_line_item->type()
370 370
 				)
371 371
 			);
372 372
 		}
373
-		if ( $ticket_line_item->quantity() < $qty ) {
373
+		if ($ticket_line_item->quantity() < $qty) {
374 374
 			throw new EE_Error(
375 375
 				sprintf(
376
-					__( 'Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.', 'event_espresso' ),
376
+					__('Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.', 'event_espresso'),
377 377
 					$qty,
378 378
 					$ticket_line_item->quantity()
379 379
 				)
380 380
 			);
381 381
 		}
382 382
 		// decrement ticket quantity; don't rely on auto-fixing when recalculating totals to do this
383
-		$ticket_line_item->set_quantity( $ticket_line_item->quantity() - $qty );
384
-		foreach( $ticket_line_item->children() as $child_line_item ) {
385
-			if(
383
+		$ticket_line_item->set_quantity($ticket_line_item->quantity() - $qty);
384
+		foreach ($ticket_line_item->children() as $child_line_item) {
385
+			if (
386 386
 				$child_line_item->is_sub_line_item()
387 387
 				&& ! $child_line_item->is_percent()
388 388
 				&& ! $child_line_item->is_cancellation()
389 389
 			) {
390
-				$child_line_item->set_quantity( $child_line_item->quantity() - $qty );
390
+				$child_line_item->set_quantity($child_line_item->quantity() - $qty);
391 391
 			}
392 392
 		}
393 393
 		// get cancellation sub line item
@@ -395,37 +395,37 @@  discard block
 block discarded – undo
395 395
 			$ticket_line_item,
396 396
 			EEM_Line_Item::type_cancellation
397 397
 		);
398
-		$cancellation_line_item = reset( $cancellation_line_item );
398
+		$cancellation_line_item = reset($cancellation_line_item);
399 399
 		// verify that this ticket was indeed previously cancelled
400
-		if ( $cancellation_line_item instanceof EE_Line_Item ) {
400
+		if ($cancellation_line_item instanceof EE_Line_Item) {
401 401
 			// increment cancelled quantity
402
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() + $qty );
402
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() + $qty);
403 403
 		} else {
404 404
 			// create cancellation sub line item
405
-			$cancellation_line_item = EE_Line_Item::new_instance( array(
406
-				'LIN_name'       => __( 'Cancellation', 'event_espresso' ),
405
+			$cancellation_line_item = EE_Line_Item::new_instance(array(
406
+				'LIN_name'       => __('Cancellation', 'event_espresso'),
407 407
 				'LIN_desc'       => sprintf(
408
-					_x( 'Cancelled %1$s : %2$s', 'Cancelled Ticket Name : 2015-01-01 11:11', 'event_espresso' ),
408
+					_x('Cancelled %1$s : %2$s', 'Cancelled Ticket Name : 2015-01-01 11:11', 'event_espresso'),
409 409
 					$ticket_line_item->name(),
410
-					current_time( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) )
410
+					current_time(get_option('date_format').' '.get_option('time_format'))
411 411
 				),
412 412
 				'LIN_unit_price' => 0, // $ticket_line_item->unit_price()
413 413
 				'LIN_quantity'   => $qty,
414 414
 				'LIN_is_taxable' => $ticket_line_item->is_taxable(),
415
-				'LIN_order'      => count( $ticket_line_item->children() ),
415
+				'LIN_order'      => count($ticket_line_item->children()),
416 416
 				'LIN_total'      => 0, // $ticket_line_item->unit_price()
417 417
 				'LIN_type'       => EEM_Line_Item::type_cancellation,
418
-			) );
419
-			$ticket_line_item->add_child_line_item( $cancellation_line_item );
418
+			));
419
+			$ticket_line_item->add_child_line_item($cancellation_line_item);
420 420
 		}
421
-		if ( $ticket_line_item->save_this_and_descendants() > 0 ) {
421
+		if ($ticket_line_item->save_this_and_descendants() > 0) {
422 422
 			// decrement parent line item quantity
423 423
 			$event_line_item = $ticket_line_item->parent();
424
-			if ( $event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event' ) {
425
-				$event_line_item->set_quantity( $event_line_item->quantity() - $qty );
424
+			if ($event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event') {
425
+				$event_line_item->set_quantity($event_line_item->quantity() - $qty);
426 426
 				$event_line_item->save();
427 427
 			}
428
-			EEH_Line_Item::get_grand_total_and_recalculate_everything( $ticket_line_item );
428
+			EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
429 429
 			return true;
430 430
 		}
431 431
 		return false;
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
 	 * @return bool success
444 444
 	 * @throws \EE_Error
445 445
 	 */
446
-	public static function reinstate_canceled_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) {
446
+	public static function reinstate_canceled_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1) {
447 447
 		// validate incoming line_item
448
-		if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) {
448
+		if ($ticket_line_item->OBJ_type() !== 'Ticket') {
449 449
 			throw new EE_Error(
450 450
 				sprintf(
451
-					__( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ),
451
+					__('The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso'),
452 452
 					$ticket_line_item->type()
453 453
 				)
454 454
 			);
@@ -458,42 +458,42 @@  discard block
 block discarded – undo
458 458
 			$ticket_line_item,
459 459
 			EEM_Line_Item::type_cancellation
460 460
 		);
461
-		$cancellation_line_item = reset( $cancellation_line_item );
461
+		$cancellation_line_item = reset($cancellation_line_item);
462 462
 		// verify that this ticket was indeed previously cancelled
463
-		if ( ! $cancellation_line_item instanceof EE_Line_Item ) {
463
+		if ( ! $cancellation_line_item instanceof EE_Line_Item) {
464 464
 			return false;
465 465
 		}
466
-		if ( $cancellation_line_item->quantity() > $qty ) {
466
+		if ($cancellation_line_item->quantity() > $qty) {
467 467
 			// decrement cancelled quantity
468
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() - $qty );
469
-		} else if ( $cancellation_line_item->quantity() == $qty ) {
468
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
469
+		} else if ($cancellation_line_item->quantity() == $qty) {
470 470
 			// decrement cancelled quantity in case anyone still has the object kicking around
471
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() - $qty );
471
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
472 472
 			// delete because quantity will end up as 0
473 473
 			$cancellation_line_item->delete();
474 474
 			// and attempt to destroy the object,
475 475
 			// even though PHP won't actually destroy it until it needs the memory
476
-			unset( $cancellation_line_item );
476
+			unset($cancellation_line_item);
477 477
 		} else {
478 478
 			// what ?!?! negative quantity ?!?!
479 479
 			throw new EE_Error(
480 480
 				sprintf(
481
-					__( 'Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.',
482
-						'event_espresso' ),
481
+					__('Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.',
482
+						'event_espresso'),
483 483
 					$qty,
484 484
 					$cancellation_line_item->quantity()
485 485
 				)
486 486
 			);
487 487
 		}
488 488
 		// increment ticket quantity
489
-		$ticket_line_item->set_quantity( $ticket_line_item->quantity() + $qty );
490
-		if ( $ticket_line_item->save_this_and_descendants() > 0 ) {
489
+		$ticket_line_item->set_quantity($ticket_line_item->quantity() + $qty);
490
+		if ($ticket_line_item->save_this_and_descendants() > 0) {
491 491
 			// increment parent line item quantity
492 492
 			$event_line_item = $ticket_line_item->parent();
493
-			if ( $event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event' ) {
494
-				$event_line_item->set_quantity( $event_line_item->quantity() + $qty );
493
+			if ($event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event') {
494
+				$event_line_item->set_quantity($event_line_item->quantity() + $qty);
495 495
 			}
496
-			EEH_Line_Item::get_grand_total_and_recalculate_everything( $ticket_line_item );
496
+			EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
497 497
 			return true;
498 498
 		}
499 499
 		return false;
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	 * @param EE_Line_Item $line_item
509 509
 	 * @return \EE_Line_Item
510 510
 	 */
511
-	public static function get_grand_total_and_recalculate_everything( EE_Line_Item $line_item ){
512
-		$grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item( $line_item );
511
+	public static function get_grand_total_and_recalculate_everything(EE_Line_Item $line_item) {
512
+		$grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item);
513 513
 		return $grand_total_line_item->recalculate_total_including_taxes();
514 514
 	}
515 515
 
@@ -522,11 +522,11 @@  discard block
 block discarded – undo
522 522
 	 * @return \EE_Line_Item
523 523
 	 * @throws \EE_Error
524 524
 	 */
525
-	public static function get_pre_tax_subtotal( EE_Line_Item $total_line_item ){
526
-		$pre_tax_subtotal = $total_line_item->get_child_line_item( 'pre-tax-subtotal' );
525
+	public static function get_pre_tax_subtotal(EE_Line_Item $total_line_item) {
526
+		$pre_tax_subtotal = $total_line_item->get_child_line_item('pre-tax-subtotal');
527 527
 		return $pre_tax_subtotal instanceof EE_Line_Item
528 528
 			? $pre_tax_subtotal
529
-			: self::create_pre_tax_subtotal( $total_line_item );
529
+			: self::create_pre_tax_subtotal($total_line_item);
530 530
 	}
531 531
 
532 532
 
@@ -538,9 +538,9 @@  discard block
 block discarded – undo
538 538
 	 * @return \EE_Line_Item
539 539
 	 * @throws \EE_Error
540 540
 	 */
541
-	public static function get_taxes_subtotal( EE_Line_Item $total_line_item ){
542
-		$taxes = $total_line_item->get_child_line_item( 'taxes' );
543
-		return $taxes ? $taxes : self::create_taxes_subtotal( $total_line_item );
541
+	public static function get_taxes_subtotal(EE_Line_Item $total_line_item) {
542
+		$taxes = $total_line_item->get_child_line_item('taxes');
543
+		return $taxes ? $taxes : self::create_taxes_subtotal($total_line_item);
544 544
 	}
545 545
 
546 546
 
@@ -553,12 +553,12 @@  discard block
 block discarded – undo
553 553
 	 * @return void
554 554
 	 * @throws \EE_Error
555 555
 	 */
556
-	public static function set_TXN_ID( EE_Line_Item $line_item, $transaction = NULL ){
557
-		if( $transaction ){
556
+	public static function set_TXN_ID(EE_Line_Item $line_item, $transaction = NULL) {
557
+		if ($transaction) {
558 558
 			/** @type EEM_Transaction $EEM_Transaction */
559
-			$EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' );
560
-			$TXN_ID = $EEM_Transaction->ensure_is_ID( $transaction );
561
-			$line_item->set_TXN_ID( $TXN_ID );
559
+			$EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
560
+			$TXN_ID = $EEM_Transaction->ensure_is_ID($transaction);
561
+			$line_item->set_TXN_ID($TXN_ID);
562 562
 		}
563 563
 	}
564 564
 
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 	 * @return \EE_Line_Item of type total
574 574
 	 * @throws \EE_Error
575 575
 	 */
576
-	public static function create_total_line_item( $transaction = NULL ){
577
-		$total_line_item = EE_Line_Item::new_instance( array(
576
+	public static function create_total_line_item($transaction = NULL) {
577
+		$total_line_item = EE_Line_Item::new_instance(array(
578 578
 			'LIN_code'	=> 'total',
579 579
 			'LIN_name'	=> __('Grand Total', 'event_espresso'),
580 580
 			'LIN_type'	=> EEM_Line_Item::type_total,
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 			'FHEE__EEH_Line_Item__create_total_line_item__total_line_item',
585 585
 			$total_line_item
586 586
 		);
587
-		self::set_TXN_ID( $total_line_item, $transaction );
588
-		self::create_pre_tax_subtotal( $total_line_item, $transaction );
589
-		self::create_taxes_subtotal( $total_line_item, $transaction );
587
+		self::set_TXN_ID($total_line_item, $transaction);
588
+		self::create_pre_tax_subtotal($total_line_item, $transaction);
589
+		self::create_taxes_subtotal($total_line_item, $transaction);
590 590
 		return $total_line_item;
591 591
 	}
592 592
 
@@ -600,19 +600,19 @@  discard block
 block discarded – undo
600 600
 	 * @return EE_Line_Item
601 601
 	 * @throws \EE_Error
602 602
 	 */
603
-	protected static function create_pre_tax_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
604
-		$pre_tax_line_item = EE_Line_Item::new_instance( array(
603
+	protected static function create_pre_tax_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
604
+		$pre_tax_line_item = EE_Line_Item::new_instance(array(
605 605
 			'LIN_code' 	=> 'pre-tax-subtotal',
606
-			'LIN_name' 	=> __( 'Pre-Tax Subtotal', 'event_espresso' ),
606
+			'LIN_name' 	=> __('Pre-Tax Subtotal', 'event_espresso'),
607 607
 			'LIN_type' 	=> EEM_Line_Item::type_sub_total
608
-		) );
608
+		));
609 609
 		$pre_tax_line_item = apply_filters(
610 610
 			'FHEE__EEH_Line_Item__create_pre_tax_subtotal__pre_tax_line_item',
611 611
 			$pre_tax_line_item
612 612
 		);
613
-		self::set_TXN_ID( $pre_tax_line_item, $transaction );
614
-		$total_line_item->add_child_line_item( $pre_tax_line_item );
615
-		self::create_event_subtotal( $pre_tax_line_item, $transaction );
613
+		self::set_TXN_ID($pre_tax_line_item, $transaction);
614
+		$total_line_item->add_child_line_item($pre_tax_line_item);
615
+		self::create_event_subtotal($pre_tax_line_item, $transaction);
616 616
 		return $pre_tax_line_item;
617 617
 	}
618 618
 
@@ -627,21 +627,21 @@  discard block
 block discarded – undo
627 627
 	 * @return EE_Line_Item
628 628
 	 * @throws \EE_Error
629 629
 	 */
630
-	protected static function create_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
630
+	protected static function create_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
631 631
 		$tax_line_item = EE_Line_Item::new_instance(array(
632 632
 			'LIN_code'	=> 'taxes',
633 633
 			'LIN_name' 	=> __('Taxes', 'event_espresso'),
634 634
 			'LIN_type'	=> EEM_Line_Item::type_tax_sub_total,
635
-			'LIN_order' => 1000,//this should always come last
635
+			'LIN_order' => 1000, //this should always come last
636 636
 		));
637 637
 		$tax_line_item = apply_filters(
638 638
 			'FHEE__EEH_Line_Item__create_taxes_subtotal__tax_line_item',
639 639
 			$tax_line_item
640 640
 		);
641
-		self::set_TXN_ID( $tax_line_item, $transaction );
642
-		$total_line_item->add_child_line_item( $tax_line_item );
641
+		self::set_TXN_ID($tax_line_item, $transaction);
642
+		$total_line_item->add_child_line_item($tax_line_item);
643 643
 		//and lastly, add the actual taxes
644
-		self::apply_taxes( $total_line_item );
644
+		self::apply_taxes($total_line_item);
645 645
 		return $tax_line_item;
646 646
 	}
647 647
 
@@ -656,11 +656,11 @@  discard block
 block discarded – undo
656 656
 	 * @return EE_Line_Item
657 657
 	 * @throws \EE_Error
658 658
 	 */
659
-	public static function create_event_subtotal( EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL ){
659
+	public static function create_event_subtotal(EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL) {
660 660
 		$event_line_item = EE_Line_Item::new_instance(array(
661
-			'LIN_code'	=> self::get_event_code( $event ),
662
-			'LIN_name' 	=> self::get_event_name( $event ),
663
-			'LIN_desc' 	=> self::get_event_desc( $event ),
661
+			'LIN_code'	=> self::get_event_code($event),
662
+			'LIN_name' 	=> self::get_event_name($event),
663
+			'LIN_desc' 	=> self::get_event_desc($event),
664 664
 			'LIN_type'	=> EEM_Line_Item::type_sub_total,
665 665
 			'OBJ_type' 	=> 'Event',
666 666
 			'OBJ_ID' 		=>  $event instanceof EE_Event ? $event->ID() : 0
@@ -669,8 +669,8 @@  discard block
 block discarded – undo
669 669
 			'FHEE__EEH_Line_Item__create_event_subtotal__event_line_item',
670 670
 			$event_line_item
671 671
 		);
672
-		self::set_TXN_ID( $event_line_item, $transaction );
673
-		$pre_tax_line_item->add_child_line_item( $event_line_item );
672
+		self::set_TXN_ID($event_line_item, $transaction);
673
+		$pre_tax_line_item->add_child_line_item($event_line_item);
674 674
 		return $event_line_item;
675 675
 	}
676 676
 
@@ -683,8 +683,8 @@  discard block
 block discarded – undo
683 683
 	 * @return string
684 684
 	 * @throws \EE_Error
685 685
 	 */
686
-	public static function get_event_code( $event ) {
687
-		return 'event-' . ( $event instanceof EE_Event ? $event->ID() : '0' );
686
+	public static function get_event_code($event) {
687
+		return 'event-'.($event instanceof EE_Event ? $event->ID() : '0');
688 688
 	}
689 689
 
690 690
 	/**
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
 	 * @param EE_Event $event
693 693
 	 * @return string
694 694
 	 */
695
-	public static function get_event_name( $event ) {
696
-		return $event instanceof EE_Event ? $event->name() : __( 'Event', 'event_espresso' );
695
+	public static function get_event_name($event) {
696
+		return $event instanceof EE_Event ? $event->name() : __('Event', 'event_espresso');
697 697
 	}
698 698
 
699 699
 	/**
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 	 * @param EE_Event $event
702 702
 	 * @return string
703 703
 	 */
704
-	public static function get_event_desc( $event ) {
704
+	public static function get_event_desc($event) {
705 705
 		return $event instanceof EE_Event ? $event->short_description() : '';
706 706
 	}
707 707
 
@@ -715,27 +715,27 @@  discard block
 block discarded – undo
715 715
 	  * @throws \EE_Error
716 716
 	  * @return EE_Line_Item
717 717
 	  */
718
-	public static function get_event_line_item_for_ticket( EE_Line_Item $grand_total, EE_Ticket $ticket ) {
718
+	public static function get_event_line_item_for_ticket(EE_Line_Item $grand_total, EE_Ticket $ticket) {
719 719
 		$first_datetime = $ticket->first_datetime();
720
-		if ( ! $first_datetime instanceof EE_Datetime ) {
720
+		if ( ! $first_datetime instanceof EE_Datetime) {
721 721
 			throw new EE_Error(
722
-				sprintf( __( 'The supplied ticket (ID %d) has no datetimes', 'event_espresso' ), $ticket->ID() )
722
+				sprintf(__('The supplied ticket (ID %d) has no datetimes', 'event_espresso'), $ticket->ID())
723 723
 			);
724 724
 		}
725 725
 		$event = $first_datetime->event();
726
-		if ( ! $event instanceof EE_Event ) {
726
+		if ( ! $event instanceof EE_Event) {
727 727
 			throw new EE_Error(
728 728
 				sprintf(
729
-					__( 'The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso' ),
729
+					__('The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso'),
730 730
 					$ticket->ID()
731 731
 				)
732 732
 			);
733 733
 		}
734
-		$events_sub_total = EEH_Line_Item::get_event_line_item( $grand_total, $event );
735
-		if ( ! $events_sub_total instanceof EE_Line_Item ) {
734
+		$events_sub_total = EEH_Line_Item::get_event_line_item($grand_total, $event);
735
+		if ( ! $events_sub_total instanceof EE_Line_Item) {
736 736
 			throw new EE_Error(
737 737
 				sprintf(
738
-					__( 'There is no events sub-total for ticket %s on total line item %d', 'event_espresso' ),
738
+					__('There is no events sub-total for ticket %s on total line item %d', 'event_espresso'),
739 739
 					$ticket->ID(),
740 740
 					$grand_total->ID()
741 741
 				)
@@ -754,31 +754,31 @@  discard block
 block discarded – undo
754 754
 	 * @return EE_Line_Item for the event subtotal which is a child of $grand_total
755 755
 	 * @throws \EE_Error
756 756
 	 */
757
-	public static function get_event_line_item( EE_Line_Item $grand_total, $event ) {
757
+	public static function get_event_line_item(EE_Line_Item $grand_total, $event) {
758 758
 		/** @type EE_Event $event */
759
-		$event = EEM_Event::instance()->ensure_is_obj( $event, true );
759
+		$event = EEM_Event::instance()->ensure_is_obj($event, true);
760 760
 		$event_line_item = NULL;
761 761
 		$found = false;
762
-		foreach ( EEH_Line_Item::get_event_subtotals( $grand_total ) as $event_line_item ) {
762
+		foreach (EEH_Line_Item::get_event_subtotals($grand_total) as $event_line_item) {
763 763
 			// default event subtotal, we should only ever find this the first time this method is called
764
-			if ( ! $event_line_item->OBJ_ID() ) {
764
+			if ( ! $event_line_item->OBJ_ID()) {
765 765
 				// let's use this! but first... set the event details
766
-				EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
766
+				EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
767 767
 				$found = true;
768 768
 				break;
769
-			} else if ( $event_line_item->OBJ_ID() === $event->ID() ) {
769
+			} else if ($event_line_item->OBJ_ID() === $event->ID()) {
770 770
 				// found existing line item for this event in the cart, so break out of loop and use this one
771 771
 				$found = true;
772 772
 				break;
773 773
 			}
774 774
 		}
775
-		if ( ! $found ) {
775
+		if ( ! $found) {
776 776
 			//there is no event sub-total yet, so add it
777
-			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal( $grand_total );
777
+			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal($grand_total);
778 778
 			// create a new "event" subtotal below that
779
-			$event_line_item = EEH_Line_Item::create_event_subtotal( $pre_tax_subtotal, null, $event );
779
+			$event_line_item = EEH_Line_Item::create_event_subtotal($pre_tax_subtotal, null, $event);
780 780
 			// and set the event details
781
-			EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
781
+			EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
782 782
 		}
783 783
 		return $event_line_item;
784 784
 	}
@@ -799,13 +799,13 @@  discard block
 block discarded – undo
799 799
 		EE_Event $event,
800 800
 		$transaction = null
801 801
 	) {
802
-		if ( $event instanceof EE_Event ) {
803
-			$event_line_item->set_code( self::get_event_code( $event ) );
804
-			$event_line_item->set_name( self::get_event_name( $event ) );
805
-			$event_line_item->set_desc( self::get_event_desc( $event ) );
806
-			$event_line_item->set_OBJ_ID( $event->ID() );
802
+		if ($event instanceof EE_Event) {
803
+			$event_line_item->set_code(self::get_event_code($event));
804
+			$event_line_item->set_name(self::get_event_name($event));
805
+			$event_line_item->set_desc(self::get_event_desc($event));
806
+			$event_line_item->set_OBJ_ID($event->ID());
807 807
 		}
808
-		self::set_TXN_ID( $event_line_item, $transaction );
808
+		self::set_TXN_ID($event_line_item, $transaction);
809 809
 	}
810 810
 
811 811
 
@@ -818,19 +818,19 @@  discard block
 block discarded – undo
818 818
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
819 819
 	 * @throws \EE_Error
820 820
 	 */
821
-	public static function apply_taxes( EE_Line_Item $total_line_item ){
821
+	public static function apply_taxes(EE_Line_Item $total_line_item) {
822 822
 		/** @type EEM_Price $EEM_Price */
823
-		$EEM_Price = EE_Registry::instance()->load_model( 'Price' );
823
+		$EEM_Price = EE_Registry::instance()->load_model('Price');
824 824
 		// get array of taxes via Price Model
825 825
 		$ordered_taxes = $EEM_Price->get_all_prices_that_are_taxes();
826
-		ksort( $ordered_taxes );
827
-		$taxes_line_item = self::get_taxes_subtotal( $total_line_item );
826
+		ksort($ordered_taxes);
827
+		$taxes_line_item = self::get_taxes_subtotal($total_line_item);
828 828
 		//just to be safe, remove its old tax line items
829 829
 		$taxes_line_item->delete_children_line_items();
830 830
 		//loop thru taxes
831
-		foreach ( $ordered_taxes as $order => $taxes ) {
832
-			foreach ( $taxes as $tax ) {
833
-				if ( $tax instanceof EE_Price ) {
831
+		foreach ($ordered_taxes as $order => $taxes) {
832
+			foreach ($taxes as $tax) {
833
+				if ($tax instanceof EE_Price) {
834 834
 					$tax_line_item = EE_Line_Item::new_instance(
835 835
 						array(
836 836
 							'LIN_name'       => $tax->name(),
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 						'FHEE__EEH_Line_Item__apply_taxes__tax_line_item',
849 849
 						$tax_line_item
850 850
 					);
851
-					$taxes_line_item->add_child_line_item( $tax_line_item );
851
+					$taxes_line_item->add_child_line_item($tax_line_item);
852 852
 				}
853 853
 			}
854 854
 		}
@@ -865,10 +865,10 @@  discard block
 block discarded – undo
865 865
 	 * @return float
866 866
 	 * @throws \EE_Error
867 867
 	 */
868
-	public static function ensure_taxes_applied( $total_line_item ){
869
-		$taxes_subtotal = self::get_taxes_subtotal( $total_line_item );
870
-		if( ! $taxes_subtotal->children()){
871
-			self::apply_taxes( $total_line_item );
868
+	public static function ensure_taxes_applied($total_line_item) {
869
+		$taxes_subtotal = self::get_taxes_subtotal($total_line_item);
870
+		if ( ! $taxes_subtotal->children()) {
871
+			self::apply_taxes($total_line_item);
872 872
 		}
873 873
 		return $taxes_subtotal->total();
874 874
 	}
@@ -882,16 +882,16 @@  discard block
 block discarded – undo
882 882
 	 * @return bool
883 883
 	 * @throws \EE_Error
884 884
 	 */
885
-	public static function delete_all_child_items( EE_Line_Item $parent_line_item ) {
885
+	public static function delete_all_child_items(EE_Line_Item $parent_line_item) {
886 886
 		$deleted = 0;
887
-		foreach ( $parent_line_item->children() as $child_line_item ) {
888
-			if ( $child_line_item instanceof EE_Line_Item ) {
889
-				$deleted += EEH_Line_Item::delete_all_child_items( $child_line_item );
890
-				if ( $child_line_item->ID() ) {
887
+		foreach ($parent_line_item->children() as $child_line_item) {
888
+			if ($child_line_item instanceof EE_Line_Item) {
889
+				$deleted += EEH_Line_Item::delete_all_child_items($child_line_item);
890
+				if ($child_line_item->ID()) {
891 891
 					$child_line_item->delete();
892
-					unset( $child_line_item );
892
+					unset($child_line_item);
893 893
 				} else {
894
-					$parent_line_item->delete_child_line_item( $child_line_item->code() );
894
+					$parent_line_item->delete_child_line_item($child_line_item->code());
895 895
 				}
896 896
 				$deleted++;
897 897
 			}
@@ -913,9 +913,9 @@  discard block
 block discarded – undo
913 913
 	 * @param array|bool|string $line_item_codes
914 914
 	 * @return int number of items successfully removed
915 915
 	 */
916
-	public static function delete_items( EE_Line_Item $total_line_item, $line_item_codes = FALSE ) {
916
+	public static function delete_items(EE_Line_Item $total_line_item, $line_item_codes = FALSE) {
917 917
 
918
-		if( $total_line_item->type() !== EEM_Line_Item::type_total ){
918
+		if ($total_line_item->type() !== EEM_Line_Item::type_total) {
919 919
 			EE_Error::doing_it_wrong(
920 920
 				'EEH_Line_Item::delete_items',
921 921
 				__(
@@ -925,20 +925,20 @@  discard block
 block discarded – undo
925 925
 				'4.6.18'
926 926
 			);
927 927
 		}
928
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
928
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
929 929
 
930 930
 		// check if only a single line_item_id was passed
931
-		if ( ! empty( $line_item_codes ) && ! is_array( $line_item_codes )) {
931
+		if ( ! empty($line_item_codes) && ! is_array($line_item_codes)) {
932 932
 			// place single line_item_id in an array to appear as multiple line_item_ids
933
-			$line_item_codes = array ( $line_item_codes );
933
+			$line_item_codes = array($line_item_codes);
934 934
 		}
935 935
 		$removals = 0;
936 936
 		// cycle thru line_item_ids
937
-		foreach ( $line_item_codes as $line_item_id ) {
937
+		foreach ($line_item_codes as $line_item_id) {
938 938
 			$removals += $total_line_item->delete_child_line_item($line_item_id);
939 939
 		}
940 940
 
941
-		if ( $removals > 0 ) {
941
+		if ($removals > 0) {
942 942
 			$total_line_item->recalculate_taxes_and_tax_total();
943 943
 			return $removals;
944 944
 		} else {
@@ -971,33 +971,33 @@  discard block
 block discarded – undo
971 971
 		$code = null,
972 972
 		$add_to_existing_line_item = false
973 973
 	) {
974
-		$tax_subtotal = self::get_taxes_subtotal( $total_line_item );
974
+		$tax_subtotal = self::get_taxes_subtotal($total_line_item);
975 975
             $taxable_total = $total_line_item->taxable_total();
976 976
 
977
-            if( $add_to_existing_line_item ) {
978
-                $new_tax = $tax_subtotal->get_child_line_item( $code );
977
+            if ($add_to_existing_line_item) {
978
+                $new_tax = $tax_subtotal->get_child_line_item($code);
979 979
 	            EEM_Line_Item::instance()->delete(
980
-		            array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) )
980
+		            array(array('LIN_code' => array('!=', $code), 'LIN_parent' => $tax_subtotal->ID()))
981 981
 	            );
982 982
             } else {
983 983
                 $new_tax = null;
984 984
                 $tax_subtotal->delete_children_line_items();
985 985
             }
986
-            if( $new_tax ) {
987
-                $new_tax->set_total( $new_tax->total() + $amount );
988
-                $new_tax->set_percent( $taxable_total ? $new_tax->total() / $taxable_total * 100 : 0 );
986
+            if ($new_tax) {
987
+                $new_tax->set_total($new_tax->total() + $amount);
988
+                $new_tax->set_percent($taxable_total ? $new_tax->total() / $taxable_total * 100 : 0);
989 989
             } else {
990 990
                 //no existing tax item. Create it
991
-				$new_tax = EE_Line_Item::new_instance( array(
991
+				$new_tax = EE_Line_Item::new_instance(array(
992 992
 					'TXN_ID'      => $total_line_item->TXN_ID(),
993
-					'LIN_name'    => $name ? $name : __( 'Tax', 'event_espresso' ),
993
+					'LIN_name'    => $name ? $name : __('Tax', 'event_espresso'),
994 994
 					'LIN_desc'    => $description ? $description : '',
995
-					'LIN_percent' => $taxable_total ? ( $amount / $taxable_total * 100 ) : 0,
995
+					'LIN_percent' => $taxable_total ? ($amount / $taxable_total * 100) : 0,
996 996
 					'LIN_total'   => $amount,
997 997
 					'LIN_parent'  => $tax_subtotal->ID(),
998 998
 					'LIN_type'    => EEM_Line_Item::type_tax,
999 999
 					'LIN_code'    => $code
1000
-				) );
1000
+				));
1001 1001
 			}
1002 1002
 
1003 1003
             $new_tax = apply_filters(
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 				$total_line_item
1007 1007
             );
1008 1008
             $new_tax->save();
1009
-            $tax_subtotal->set_total( $new_tax->total() );
1009
+            $tax_subtotal->set_total($new_tax->total());
1010 1010
             $tax_subtotal->save();
1011 1011
             $total_line_item->recalculate_total_including_taxes();
1012 1012
             return $new_tax;
@@ -1028,14 +1028,14 @@  discard block
 block discarded – undo
1028 1028
 		$code_substring_for_whitelist = null
1029 1029
 	) {
1030 1030
 		$whitelisted = false;
1031
-		if( $code_substring_for_whitelist !== null ) {
1032
-			$whitelisted = strpos( $line_item->code(), $code_substring_for_whitelist ) !== false ? true : false;
1031
+		if ($code_substring_for_whitelist !== null) {
1032
+			$whitelisted = strpos($line_item->code(), $code_substring_for_whitelist) !== false ? true : false;
1033 1033
 		}
1034
-		if( ! $whitelisted && $line_item->is_line_item() ) {
1035
-			$line_item->set_is_taxable( $taxable );
1034
+		if ( ! $whitelisted && $line_item->is_line_item()) {
1035
+			$line_item->set_is_taxable($taxable);
1036 1036
 		}
1037
-		foreach( $line_item->children() as $child_line_item ) {
1038
-			EEH_Line_Item::set_line_items_taxable( $child_line_item, $taxable, $code_substring_for_whitelist );
1037
+		foreach ($line_item->children() as $child_line_item) {
1038
+			EEH_Line_Item::set_line_items_taxable($child_line_item, $taxable, $code_substring_for_whitelist);
1039 1039
 		}
1040 1040
 	}
1041 1041
 
@@ -1048,8 +1048,8 @@  discard block
 block discarded – undo
1048 1048
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1049 1049
 	 * @return EE_Line_Item[]
1050 1050
 	 */
1051
-	public static function get_event_subtotals( EE_Line_Item $parent_line_item ) {
1052
-		return self::get_subtotals_of_object_type( $parent_line_item, 'Event' );
1051
+	public static function get_event_subtotals(EE_Line_Item $parent_line_item) {
1052
+		return self::get_subtotals_of_object_type($parent_line_item, 'Event');
1053 1053
 	}
1054 1054
 
1055 1055
 
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
 	 * @param string $obj_type
1063 1063
 	 * @return EE_Line_Item[]
1064 1064
 	 */
1065
-	public static function get_subtotals_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
1065
+	public static function get_subtotals_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
1066 1066
 		return self::_get_descendants_by_type_and_object_type(
1067 1067
 			$parent_line_item,
1068 1068
 			EEM_Line_Item::type_sub_total,
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1080 1080
 	 * @return EE_Line_Item[]
1081 1081
 	 */
1082
-	public static function get_ticket_line_items( EE_Line_Item $parent_line_item ) {
1083
-		return self::get_line_items_of_object_type( $parent_line_item, 'Ticket' );
1082
+	public static function get_ticket_line_items(EE_Line_Item $parent_line_item) {
1083
+		return self::get_line_items_of_object_type($parent_line_item, 'Ticket');
1084 1084
 	}
1085 1085
 
1086 1086
 
@@ -1093,8 +1093,8 @@  discard block
 block discarded – undo
1093 1093
 	 * @param string $obj_type
1094 1094
 	 * @return EE_Line_Item[]
1095 1095
 	 */
1096
-	public static function get_line_items_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
1097
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, EEM_Line_Item::type_line_item, $obj_type );
1096
+	public static function get_line_items_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
1097
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, EEM_Line_Item::type_line_item, $obj_type);
1098 1098
 	}
1099 1099
 
1100 1100
 
@@ -1105,8 +1105,8 @@  discard block
 block discarded – undo
1105 1105
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1106 1106
 	 * @return EE_Line_Item[]
1107 1107
 	 */
1108
-	public static function get_tax_descendants( EE_Line_Item $parent_line_item ) {
1109
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_tax );
1108
+	public static function get_tax_descendants(EE_Line_Item $parent_line_item) {
1109
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_tax);
1110 1110
 	}
1111 1111
 
1112 1112
 
@@ -1117,8 +1117,8 @@  discard block
 block discarded – undo
1117 1117
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1118 1118
 	 * @return EE_Line_Item[]
1119 1119
 	 */
1120
-	public static function get_line_item_descendants( EE_Line_Item $parent_line_item ) {
1121
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_line_item );
1120
+	public static function get_line_item_descendants(EE_Line_Item $parent_line_item) {
1121
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_line_item);
1122 1122
 	}
1123 1123
 
1124 1124
 
@@ -1131,8 +1131,8 @@  discard block
 block discarded – undo
1131 1131
 	 * @param string $line_item_type one of the EEM_Line_Item constants
1132 1132
 	 * @return EE_Line_Item[]
1133 1133
 	 */
1134
-	public static function get_descendants_of_type( EE_Line_Item $parent_line_item, $line_item_type ) {
1135
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, $line_item_type, NULL );
1134
+	public static function get_descendants_of_type(EE_Line_Item $parent_line_item, $line_item_type) {
1135
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, $line_item_type, NULL);
1136 1136
 	}
1137 1137
 
1138 1138
 
@@ -1151,8 +1151,8 @@  discard block
 block discarded – undo
1151 1151
 		$obj_type = null
1152 1152
 	) {
1153 1153
 		$objects = array();
1154
-		foreach ( $parent_line_item->children() as $child_line_item ) {
1155
-			if ( $child_line_item instanceof EE_Line_Item ) {
1154
+		foreach ($parent_line_item->children() as $child_line_item) {
1155
+			if ($child_line_item instanceof EE_Line_Item) {
1156 1156
 				if (
1157 1157
 					$child_line_item->type() === $line_item_type
1158 1158
 				    && (
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 		$OBJ_type = '',
1193 1193
 		$OBJ_IDs = array()
1194 1194
 	) {
1195
-		return self::_get_descendants_by_object_type_and_object_ID( $parent_line_item, $OBJ_type, $OBJ_IDs );
1195
+		return self::_get_descendants_by_object_type_and_object_ID($parent_line_item, $OBJ_type, $OBJ_IDs);
1196 1196
 	}
1197 1197
 
1198 1198
 
@@ -1211,12 +1211,12 @@  discard block
 block discarded – undo
1211 1211
 		$OBJ_IDs
1212 1212
 	) {
1213 1213
 		$objects = array();
1214
-		foreach ( $parent_line_item->children() as $child_line_item ) {
1215
-			if ( $child_line_item instanceof EE_Line_Item ) {
1214
+		foreach ($parent_line_item->children() as $child_line_item) {
1215
+			if ($child_line_item instanceof EE_Line_Item) {
1216 1216
 				if (
1217
-					is_array( $OBJ_IDs )
1217
+					is_array($OBJ_IDs)
1218 1218
 					&& $child_line_item->OBJ_type() === $OBJ_type
1219
-					&& in_array( $child_line_item->OBJ_ID(), $OBJ_IDs )
1219
+					&& in_array($child_line_item->OBJ_ID(), $OBJ_IDs)
1220 1220
 				) {
1221 1221
 					$objects[] = $child_line_item;
1222 1222
 				} else {
@@ -1246,8 +1246,8 @@  discard block
 block discarded – undo
1246 1246
 	 * @param string $type like one of the EEM_Line_Item::type_*
1247 1247
 	 * @return EE_Line_Item
1248 1248
 	 */
1249
-	public static function get_nearest_descendant_of_type( EE_Line_Item $parent_line_item, $type ) {
1250
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_type' , $type );
1249
+	public static function get_nearest_descendant_of_type(EE_Line_Item $parent_line_item, $type) {
1250
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_type', $type);
1251 1251
 	}
1252 1252
 
1253 1253
 
@@ -1261,8 +1261,8 @@  discard block
 block discarded – undo
1261 1261
 	 * @param string $code any value used for LIN_code
1262 1262
 	 * @return EE_Line_Item
1263 1263
 	 */
1264
-	public static function get_nearest_descendant_having_code( EE_Line_Item $parent_line_item, $code ) {
1265
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_code' , $code );
1264
+	public static function get_nearest_descendant_having_code(EE_Line_Item $parent_line_item, $code) {
1265
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_code', $code);
1266 1266
 	}
1267 1267
 
1268 1268
 
@@ -1276,15 +1276,15 @@  discard block
 block discarded – undo
1276 1276
 	 * @param string $value any value stored in $search_field
1277 1277
 	 * @return EE_Line_Item
1278 1278
 	 */
1279
-	protected static function _get_nearest_descendant( EE_Line_Item $parent_line_item, $search_field, $value ) {
1280
-		foreach( $parent_line_item->children() as $child ){
1281
-			if ( $child->get( $search_field ) == $value ){
1279
+	protected static function _get_nearest_descendant(EE_Line_Item $parent_line_item, $search_field, $value) {
1280
+		foreach ($parent_line_item->children() as $child) {
1281
+			if ($child->get($search_field) == $value) {
1282 1282
 				return $child;
1283 1283
 			}
1284 1284
 		}
1285
-		foreach( $parent_line_item->children() as $child ){
1286
-			$descendant_found = self::_get_nearest_descendant( $child, $search_field, $value );
1287
-			if ( $descendant_found ){
1285
+		foreach ($parent_line_item->children() as $child) {
1286
+			$descendant_found = self::_get_nearest_descendant($child, $search_field, $value);
1287
+			if ($descendant_found) {
1288 1288
 				return $descendant_found;
1289 1289
 			}
1290 1290
 		}
@@ -1301,24 +1301,24 @@  discard block
 block discarded – undo
1301 1301
 	 * @return \EE_Line_Item
1302 1302
 	 * @throws \EE_Error
1303 1303
 	 */
1304
-	public static function find_transaction_grand_total_for_line_item( EE_Line_Item $line_item ){
1305
-		if ( $line_item->TXN_ID() ) {
1306
-			$total_line_item = $line_item->transaction()->total_line_item( false );
1307
-			if ( $total_line_item instanceof EE_Line_Item ) {
1304
+	public static function find_transaction_grand_total_for_line_item(EE_Line_Item $line_item) {
1305
+		if ($line_item->TXN_ID()) {
1306
+			$total_line_item = $line_item->transaction()->total_line_item(false);
1307
+			if ($total_line_item instanceof EE_Line_Item) {
1308 1308
 				return $total_line_item;
1309 1309
 			}
1310 1310
 		} else {
1311 1311
 			$line_item_parent = $line_item->parent();
1312
-			if ( $line_item_parent instanceof EE_Line_Item ) {
1313
-				if ( $line_item_parent->is_total() ) {
1312
+			if ($line_item_parent instanceof EE_Line_Item) {
1313
+				if ($line_item_parent->is_total()) {
1314 1314
 					return $line_item_parent;
1315 1315
 				}
1316
-				return EEH_Line_Item::find_transaction_grand_total_for_line_item( $line_item_parent );
1316
+				return EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item_parent);
1317 1317
 			}
1318 1318
 		}
1319 1319
 		throw new EE_Error(
1320 1320
 			sprintf(
1321
-				__( 'A valid grand total for line item %1$d was not found.', 'event_espresso' ),
1321
+				__('A valid grand total for line item %1$d was not found.', 'event_espresso'),
1322 1322
 				$line_item->ID()
1323 1323
 			)
1324 1324
 		);
@@ -1335,31 +1335,31 @@  discard block
 block discarded – undo
1335 1335
 	 * @return void
1336 1336
 	 * @throws \EE_Error
1337 1337
 	 */
1338
-	public static function visualize( EE_Line_Item $line_item, $indentation = 0 ){
1338
+	public static function visualize(EE_Line_Item $line_item, $indentation = 0) {
1339 1339
 		echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1340
-		if ( ! $indentation ) {
1341
-			echo defined( 'EE_TESTS_DIR' ) ? "\n" : '<br />';
1340
+		if ( ! $indentation) {
1341
+			echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1342 1342
 		}
1343
-		for( $i = 0; $i < $indentation; $i++ ){
1343
+		for ($i = 0; $i < $indentation; $i++) {
1344 1344
 			echo ". ";
1345 1345
 		}
1346 1346
 		$breakdown = '';
1347
-		if ( $line_item->is_line_item()){
1348
-			if ( $line_item->is_percent() ) {
1347
+		if ($line_item->is_line_item()) {
1348
+			if ($line_item->is_percent()) {
1349 1349
 				$breakdown = "{$line_item->percent()}%";
1350 1350
 			} else {
1351
-				$breakdown = '$' . "{$line_item->unit_price()} x {$line_item->quantity()}";
1351
+				$breakdown = '$'."{$line_item->unit_price()} x {$line_item->quantity()}";
1352 1352
 			}
1353 1353
 		}
1354
-		echo $line_item->name() . " [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : " . '$' . "{$line_item->total()}";
1355
-		if ( $breakdown ) {
1354
+		echo $line_item->name()." [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : ".'$'."{$line_item->total()}";
1355
+		if ($breakdown) {
1356 1356
 			echo " ( {$breakdown} )";
1357 1357
 		}
1358
-		if( $line_item->is_taxable() ){
1358
+		if ($line_item->is_taxable()) {
1359 1359
 			echo "  * taxable";
1360 1360
 		}
1361
-		if( $line_item->children() ){
1362
-			foreach($line_item->children() as $child){
1361
+		if ($line_item->children()) {
1362
+			foreach ($line_item->children() as $child) {
1363 1363
 				self::visualize($child, $indentation + 1);
1364 1364
 			}
1365 1365
 		}
@@ -1400,97 +1400,97 @@  discard block
 block discarded – undo
1400 1400
 	 *                                          is theirs, which can be done with
1401 1401
 	 *                                          `EEM_Line_Item::instance()->get_line_item_for_registration( $registration );`
1402 1402
 	 */
1403
-	public static function calculate_reg_final_prices_per_line_item( EE_Line_Item $line_item, $billable_ticket_quantities = array() ) {
1403
+	public static function calculate_reg_final_prices_per_line_item(EE_Line_Item $line_item, $billable_ticket_quantities = array()) {
1404 1404
 		//init running grand total if not already
1405
-		if ( ! isset( $running_totals[ 'total' ] ) ) {
1406
-			$running_totals[ 'total' ] = 0;
1405
+		if ( ! isset($running_totals['total'])) {
1406
+			$running_totals['total'] = 0;
1407 1407
 		}
1408
-		if( ! isset( $running_totals[ 'taxable' ] ) ) {
1409
-			$running_totals[ 'taxable' ] = array( 'total' => 0 );
1408
+		if ( ! isset($running_totals['taxable'])) {
1409
+			$running_totals['taxable'] = array('total' => 0);
1410 1410
 		}
1411
-		foreach ( $line_item->children() as $child_line_item ) {
1412
-			switch ( $child_line_item->type() ) {
1411
+		foreach ($line_item->children() as $child_line_item) {
1412
+			switch ($child_line_item->type()) {
1413 1413
 
1414 1414
 				case EEM_Line_Item::type_sub_total :
1415
-					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $child_line_item, $billable_ticket_quantities );
1415
+					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item($child_line_item, $billable_ticket_quantities);
1416 1416
 					//combine arrays but preserve numeric keys
1417
-					$running_totals = array_replace_recursive( $running_totals_from_subtotal, $running_totals );
1418
-					$running_totals[ 'total' ] += $running_totals_from_subtotal[ 'total' ];
1419
-					$running_totals[ 'taxable'][ 'total' ] += $running_totals_from_subtotal[ 'taxable' ][ 'total' ];
1417
+					$running_totals = array_replace_recursive($running_totals_from_subtotal, $running_totals);
1418
+					$running_totals['total'] += $running_totals_from_subtotal['total'];
1419
+					$running_totals['taxable']['total'] += $running_totals_from_subtotal['taxable']['total'];
1420 1420
 					break;
1421 1421
 
1422 1422
 				case EEM_Line_Item::type_tax_sub_total :
1423 1423
 
1424 1424
 					//find how much the taxes percentage is
1425
-					if ( $child_line_item->percent() !== 0 ) {
1425
+					if ($child_line_item->percent() !== 0) {
1426 1426
 						$tax_percent_decimal = $child_line_item->percent() / 100;
1427 1427
 					} else {
1428 1428
 						$tax_percent_decimal = EE_Taxes::get_total_taxes_percentage() / 100;
1429 1429
 					}
1430 1430
 					//and apply to all the taxable totals, and add to the pretax totals
1431
-					foreach ( $running_totals as $line_item_id => $this_running_total ) {
1431
+					foreach ($running_totals as $line_item_id => $this_running_total) {
1432 1432
 						//"total" and "taxable" array key is an exception
1433
-						if ( $line_item_id === 'taxable' ) {
1433
+						if ($line_item_id === 'taxable') {
1434 1434
 							continue;
1435 1435
 						}
1436
-						$taxable_total = $running_totals[ 'taxable' ][ $line_item_id ];
1437
-						$running_totals[ $line_item_id ] += ( $taxable_total * $tax_percent_decimal );
1436
+						$taxable_total = $running_totals['taxable'][$line_item_id];
1437
+						$running_totals[$line_item_id] += ($taxable_total * $tax_percent_decimal);
1438 1438
 					}
1439 1439
 					break;
1440 1440
 
1441 1441
 				case EEM_Line_Item::type_line_item :
1442 1442
 
1443 1443
 					// ticket line items or ????
1444
-					if ( $child_line_item->OBJ_type() === 'Ticket' ) {
1444
+					if ($child_line_item->OBJ_type() === 'Ticket') {
1445 1445
 						// kk it's a ticket
1446
-						if ( isset( $running_totals[ $child_line_item->ID() ] ) ) {
1446
+						if (isset($running_totals[$child_line_item->ID()])) {
1447 1447
 							//huh? that shouldn't happen.
1448
-							$running_totals[ 'total' ] += $child_line_item->total();
1448
+							$running_totals['total'] += $child_line_item->total();
1449 1449
 						} else {
1450 1450
 							//its not in our running totals yet. great.
1451
-							if ( $child_line_item->is_taxable() ) {
1451
+							if ($child_line_item->is_taxable()) {
1452 1452
 								$taxable_amount = $child_line_item->unit_price();
1453 1453
 							} else {
1454 1454
 								$taxable_amount = 0;
1455 1455
 							}
1456 1456
 							// are we only calculating totals for some tickets?
1457
-							if ( isset( $billable_ticket_quantities[ $child_line_item->OBJ_ID() ] ) ) {
1458
-								$quantity = $billable_ticket_quantities[ $child_line_item->OBJ_ID() ];
1459
-								$running_totals[ $child_line_item->ID() ] = $quantity
1457
+							if (isset($billable_ticket_quantities[$child_line_item->OBJ_ID()])) {
1458
+								$quantity = $billable_ticket_quantities[$child_line_item->OBJ_ID()];
1459
+								$running_totals[$child_line_item->ID()] = $quantity
1460 1460
 									? $child_line_item->unit_price()
1461 1461
 									: 0;
1462
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $quantity
1462
+								$running_totals['taxable'][$child_line_item->ID()] = $quantity
1463 1463
 									? $taxable_amount
1464 1464
 									: 0;
1465 1465
 							} else {
1466 1466
 								$quantity = $child_line_item->quantity();
1467
-								$running_totals[ $child_line_item->ID() ] = $child_line_item->unit_price();
1468
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $taxable_amount;
1467
+								$running_totals[$child_line_item->ID()] = $child_line_item->unit_price();
1468
+								$running_totals['taxable'][$child_line_item->ID()] = $taxable_amount;
1469 1469
 							}
1470
-							$running_totals[ 'taxable' ][ 'total' ] += $taxable_amount * $quantity;
1471
-							$running_totals[ 'total' ] += $child_line_item->unit_price() * $quantity;
1470
+							$running_totals['taxable']['total'] += $taxable_amount * $quantity;
1471
+							$running_totals['total'] += $child_line_item->unit_price() * $quantity;
1472 1472
 						}
1473 1473
 					} else {
1474 1474
 						// it's some other type of item added to the cart
1475 1475
 						// it should affect the running totals
1476 1476
 						// basically we want to convert it into a PERCENT modifier. Because
1477 1477
 						// more clearly affect all registration's final price equally
1478
-						$line_items_percent_of_running_total = $running_totals[ 'total' ] > 0
1479
-							? ( $child_line_item->total() / $running_totals[ 'total' ] ) + 1
1478
+						$line_items_percent_of_running_total = $running_totals['total'] > 0
1479
+							? ($child_line_item->total() / $running_totals['total']) + 1
1480 1480
 							: 1;
1481
-						foreach ( $running_totals as $line_item_id => $this_running_total ) {
1481
+						foreach ($running_totals as $line_item_id => $this_running_total) {
1482 1482
 							//the "taxable" array key is an exception
1483
-							if ( $line_item_id === 'taxable' ) {
1483
+							if ($line_item_id === 'taxable') {
1484 1484
 								continue;
1485 1485
 							}
1486 1486
 							// update the running totals
1487 1487
 							// yes this actually even works for the running grand total!
1488
-							$running_totals[ $line_item_id ] =
1488
+							$running_totals[$line_item_id] =
1489 1489
 								$line_items_percent_of_running_total * $this_running_total;
1490 1490
 
1491
-							if ( $child_line_item->is_taxable() ) {
1492
-								$running_totals[ 'taxable' ][ $line_item_id ] =
1493
-									$line_items_percent_of_running_total * $running_totals[ 'taxable' ][ $line_item_id ];
1491
+							if ($child_line_item->is_taxable()) {
1492
+								$running_totals['taxable'][$line_item_id] =
1493
+									$line_items_percent_of_running_total * $running_totals['taxable'][$line_item_id];
1494 1494
 							}
1495 1495
 						}
1496 1496
 					}
@@ -1508,16 +1508,16 @@  discard block
 block discarded – undo
1508 1508
 	 * @return float | null
1509 1509
 	 * @throws \OutOfRangeException
1510 1510
 	 */
1511
-	public static function calculate_final_price_for_ticket_line_item( \EE_Line_Item $total_line_item, \EE_Line_Item $ticket_line_item ) {
1511
+	public static function calculate_final_price_for_ticket_line_item(\EE_Line_Item $total_line_item, \EE_Line_Item $ticket_line_item) {
1512 1512
 		static $final_prices_per_ticket_line_item = array();
1513
-		if ( empty( $final_prices_per_ticket_line_item ) ) {
1513
+		if (empty($final_prices_per_ticket_line_item)) {
1514 1514
 			$final_prices_per_ticket_line_item = \EEH_Line_Item::calculate_reg_final_prices_per_line_item(
1515 1515
 				$total_line_item
1516 1516
 			);
1517 1517
 		}
1518 1518
 		//ok now find this new registration's final price
1519
-		if ( isset( $final_prices_per_ticket_line_item[ $ticket_line_item->ID() ] ) ) {
1520
-			return $final_prices_per_ticket_line_item[ $ticket_line_item->ID() ];
1519
+		if (isset($final_prices_per_ticket_line_item[$ticket_line_item->ID()])) {
1520
+			return $final_prices_per_ticket_line_item[$ticket_line_item->ID()];
1521 1521
 		}
1522 1522
 		$message = sprintf(
1523 1523
 			__(
@@ -1526,10 +1526,10 @@  discard block
 block discarded – undo
1526 1526
 			),
1527 1527
 			$ticket_line_item->ID()
1528 1528
 		);
1529
-		if ( WP_DEBUG ) {
1530
-			throw new \OutOfRangeException( $message );
1529
+		if (WP_DEBUG) {
1530
+			throw new \OutOfRangeException($message);
1531 1531
 		} else {
1532
-			EE_Log::instance()->log( __CLASS__, __FUNCTION__, $message );
1532
+			EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message);
1533 1533
 		}
1534 1534
 		return null;
1535 1535
 	}
@@ -1545,15 +1545,15 @@  discard block
 block discarded – undo
1545 1545
 	 * @return \EE_Line_Item
1546 1546
 	 * @throws \EE_Error
1547 1547
 	 */
1548
-	public static function billable_line_item_tree( EE_Line_Item $line_item, $registrations ) {
1549
-		$copy_li = EEH_Line_Item::billable_line_item( $line_item, $registrations );
1550
-		foreach ( $line_item->children() as $child_li ) {
1551
-			$copy_li->add_child_line_item( EEH_Line_Item::billable_line_item_tree( $child_li, $registrations ) );
1548
+	public static function billable_line_item_tree(EE_Line_Item $line_item, $registrations) {
1549
+		$copy_li = EEH_Line_Item::billable_line_item($line_item, $registrations);
1550
+		foreach ($line_item->children() as $child_li) {
1551
+			$copy_li->add_child_line_item(EEH_Line_Item::billable_line_item_tree($child_li, $registrations));
1552 1552
 		}
1553 1553
 		//if this is the grand total line item, make sure the totals all add up
1554 1554
 		//(we could have duplicated this logic AS we copied the line items, but
1555 1555
 		//it seems DRYer this way)
1556
-		if ( $copy_li->type() === EEM_Line_Item::type_total ) {
1556
+		if ($copy_li->type() === EEM_Line_Item::type_total) {
1557 1557
 			$copy_li->recalculate_total_including_taxes();
1558 1558
 		}
1559 1559
 		return $copy_li;
@@ -1570,24 +1570,24 @@  discard block
 block discarded – undo
1570 1570
 	 * @throws \EE_Error
1571 1571
 	 * @param EE_Registration[] $registrations
1572 1572
 	 */
1573
-	public static function billable_line_item( EE_Line_Item $line_item, $registrations ) {
1573
+	public static function billable_line_item(EE_Line_Item $line_item, $registrations) {
1574 1574
 		$new_li_fields = $line_item->model_field_array();
1575
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1575
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1576 1576
 			$line_item->OBJ_type() === 'Ticket'
1577 1577
 		) {
1578 1578
 			$count = 0;
1579
-			foreach ( $registrations as $registration ) {
1580
-				if ( $line_item->OBJ_ID() === $registration->ticket_ID() &&
1581
-					in_array( $registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment() )
1579
+			foreach ($registrations as $registration) {
1580
+				if ($line_item->OBJ_ID() === $registration->ticket_ID() &&
1581
+					in_array($registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment())
1582 1582
 				) {
1583 1583
 					$count++;
1584 1584
 				}
1585 1585
 			}
1586
-			$new_li_fields[ 'LIN_quantity' ] = $count;
1586
+			$new_li_fields['LIN_quantity'] = $count;
1587 1587
 		}
1588 1588
 		//don't set the total. We'll leave that up to the code that calculates it
1589
-		unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ], $new_li_fields[ 'LIN_total' ] );
1590
-		return EE_Line_Item::new_instance( $new_li_fields );
1589
+		unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent'], $new_li_fields['LIN_total']);
1590
+		return EE_Line_Item::new_instance($new_li_fields);
1591 1591
 	}
1592 1592
 
1593 1593
 
@@ -1600,19 +1600,19 @@  discard block
 block discarded – undo
1600 1600
 	 * @return \EE_Line_Item|null
1601 1601
 	 * @throws \EE_Error
1602 1602
 	 */
1603
-	public static function non_empty_line_items( EE_Line_Item $line_item ) {
1604
-		$copied_li = EEH_Line_Item::non_empty_line_item( $line_item );
1605
-		if ( $copied_li === null ) {
1603
+	public static function non_empty_line_items(EE_Line_Item $line_item) {
1604
+		$copied_li = EEH_Line_Item::non_empty_line_item($line_item);
1605
+		if ($copied_li === null) {
1606 1606
 			return null;
1607 1607
 		}
1608 1608
 		//if this is an event subtotal, we want to only include it if it
1609 1609
 		//has a non-zero total and at least one ticket line item child
1610 1610
 		$ticket_children = 0;
1611
-		foreach ( $line_item->children() as $child_li ) {
1612
-			$child_li_copy = EEH_Line_Item::non_empty_line_items( $child_li );
1613
-			if ( $child_li_copy !== null ) {
1614
-				$copied_li->add_child_line_item( $child_li_copy );
1615
-				if ( $child_li_copy->type() === EEM_Line_Item::type_line_item &&
1611
+		foreach ($line_item->children() as $child_li) {
1612
+			$child_li_copy = EEH_Line_Item::non_empty_line_items($child_li);
1613
+			if ($child_li_copy !== null) {
1614
+				$copied_li->add_child_line_item($child_li_copy);
1615
+				if ($child_li_copy->type() === EEM_Line_Item::type_line_item &&
1616 1616
 					$child_li_copy->OBJ_type() === 'Ticket'
1617 1617
 				) {
1618 1618
 					$ticket_children++;
@@ -1642,8 +1642,8 @@  discard block
 block discarded – undo
1642 1642
 	 * @return EE_Line_Item
1643 1643
 	 * @throws \EE_Error
1644 1644
 	 */
1645
-	public static function non_empty_line_item( EE_Line_Item $line_item ) {
1646
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1645
+	public static function non_empty_line_item(EE_Line_Item $line_item) {
1646
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1647 1647
 			$line_item->OBJ_type() === 'Ticket' &&
1648 1648
 			$line_item->quantity() === 0
1649 1649
 		) {
@@ -1651,8 +1651,8 @@  discard block
 block discarded – undo
1651 1651
 		}
1652 1652
 		$new_li_fields = $line_item->model_field_array();
1653 1653
 		//don't set the total. We'll leave that up to the code that calculates it
1654
-		unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ] );
1655
-		return EE_Line_Item::new_instance( $new_li_fields );
1654
+		unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent']);
1655
+		return EE_Line_Item::new_instance($new_li_fields);
1656 1656
 	}
1657 1657
 
1658 1658
 
@@ -1664,9 +1664,9 @@  discard block
 block discarded – undo
1664 1664
 	 * @return \EE_Line_Item
1665 1665
 	 * @throws \EE_Error
1666 1666
 	 */
1667
-	public static function get_items_subtotal( EE_Line_Item $total_line_item ){
1668
-		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' );
1669
-		return self::get_pre_tax_subtotal( $total_line_item );
1667
+	public static function get_items_subtotal(EE_Line_Item $total_line_item) {
1668
+		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');
1669
+		return self::get_pre_tax_subtotal($total_line_item);
1670 1670
 	}
1671 1671
 
1672 1672
 
@@ -1677,9 +1677,9 @@  discard block
 block discarded – undo
1677 1677
 	 * @return \EE_Line_Item
1678 1678
 	 * @throws \EE_Error
1679 1679
 	 */
1680
-	public static function create_default_total_line_item( $transaction = NULL) {
1681
-		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' );
1682
-		return self::create_total_line_item( $transaction );
1680
+	public static function create_default_total_line_item($transaction = NULL) {
1681
+		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');
1682
+		return self::create_total_line_item($transaction);
1683 1683
 	}
1684 1684
 
1685 1685
 
@@ -1691,9 +1691,9 @@  discard block
 block discarded – undo
1691 1691
 	 * @return \EE_Line_Item
1692 1692
 	 * @throws \EE_Error
1693 1693
 	 */
1694
-	public static function create_default_tickets_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1695
-		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' );
1696
-		return self::create_pre_tax_subtotal( $total_line_item, $transaction );
1694
+	public static function create_default_tickets_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1695
+		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');
1696
+		return self::create_pre_tax_subtotal($total_line_item, $transaction);
1697 1697
 	}
1698 1698
 
1699 1699
 
@@ -1705,9 +1705,9 @@  discard block
 block discarded – undo
1705 1705
 	 * @return \EE_Line_Item
1706 1706
 	 * @throws \EE_Error
1707 1707
 	 */
1708
-	public static function create_default_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1709
-		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' );
1710
-		return self::create_taxes_subtotal( $total_line_item, $transaction );
1708
+	public static function create_default_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1709
+		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');
1710
+		return self::create_taxes_subtotal($total_line_item, $transaction);
1711 1711
 	}
1712 1712
 
1713 1713
 
@@ -1719,9 +1719,9 @@  discard block
 block discarded – undo
1719 1719
 	 * @return \EE_Line_Item
1720 1720
 	 * @throws \EE_Error
1721 1721
 	 */
1722
-	public static function create_default_event_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1723
-		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' );
1724
-		return self::create_event_subtotal( $total_line_item, $transaction );
1722
+	public static function create_default_event_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1723
+		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');
1724
+		return self::create_event_subtotal($total_line_item, $transaction);
1725 1725
 	}
1726 1726
 
1727 1727
 
Please login to merge, or discard this patch.
core/db_classes/EE_Registration.class.php 1 patch
Spacing   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\EntityNotFoundException;
2 2
 
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 /**
7 7
  * EE_Registration class
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	 *                             		    date_format and the second value is the time format
44 44
 	 * @return EE_Registration
45 45
 	 */
46
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
47
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
48
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
46
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
47
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
48
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
49 49
 	}
50 50
 
51 51
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 *                          		the website will be used.
57 57
 	 * @return EE_Registration
58 58
 	 */
59
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
60
-		return new self( $props_n_values, TRUE, $timezone );
59
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
60
+		return new self($props_n_values, TRUE, $timezone);
61 61
 	}
62 62
 
63 63
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @access        public
69 69
 	 * @param        int $EVT_ID Event ID
70 70
 	 */
71
-	public function set_event( $EVT_ID = 0 ) {
72
-		$this->set( 'EVT_ID', $EVT_ID );
71
+	public function set_event($EVT_ID = 0) {
72
+		$this->set('EVT_ID', $EVT_ID);
73 73
 	}
74 74
 
75 75
 
@@ -80,18 +80,18 @@  discard block
 block discarded – undo
80 80
 	 * @param mixed  $field_value
81 81
 	 * @param bool   $use_default
82 82
 	 */
83
-	public function set( $field_name, $field_value, $use_default = FALSE ) {
84
-		switch( $field_name ) {
83
+	public function set($field_name, $field_value, $use_default = FALSE) {
84
+		switch ($field_name) {
85 85
 			case 'REG_code' :
86
-				if ( ! empty( $field_value ) && $this->reg_code() == '' ) {
87
-					$this->set_reg_code( $field_value, $use_default );
86
+				if ( ! empty($field_value) && $this->reg_code() == '') {
87
+					$this->set_reg_code($field_value, $use_default);
88 88
 				}
89 89
 				break;
90 90
 			case 'STS_ID' :
91
-				$this->set_status( $field_value, $use_default );
91
+				$this->set_status($field_value, $use_default);
92 92
 				break;
93 93
 			default :
94
-				parent::set( $field_name, $field_value, $use_default );
94
+				parent::set($field_name, $field_value, $use_default);
95 95
 		}
96 96
 	}
97 97
 
@@ -109,42 +109,42 @@  discard block
 block discarded – undo
109 109
 	 * @return bool
110 110
 	 * @throws \EE_Error
111 111
 	 */
112
-	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
112
+	public function set_status($new_STS_ID = NULL, $use_default = FALSE) {
113 113
 		// get current REG_Status
114 114
 		$old_STS_ID = $this->status_ID();
115 115
 		// if status has changed
116 116
 		if (
117 117
 			$this->ID() // ensure registration is in the db
118 118
 			&& $old_STS_ID != $new_STS_ID // and that status has actually changed
119
-			&& ! empty( $old_STS_ID ) // and that old status is actually set
120
-			&& ! empty( $new_STS_ID ) // as well as the new status
119
+			&& ! empty($old_STS_ID) // and that old status is actually set
120
+			&& ! empty($new_STS_ID) // as well as the new status
121 121
 		) {
122 122
 			// TO approved
123
-			if ( $new_STS_ID === EEM_Registration::status_id_approved ) {
123
+			if ($new_STS_ID === EEM_Registration::status_id_approved) {
124 124
 				// reserve a space by incrementing ticket and datetime sold values
125 125
 				$this->_reserve_registration_space();
126
-				do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID );
126
+				do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID);
127 127
 			// OR FROM  approved
128
-			} else if ( $old_STS_ID === EEM_Registration::status_id_approved ) {
128
+			} else if ($old_STS_ID === EEM_Registration::status_id_approved) {
129 129
 				// release a space by decrementing ticket and datetime sold values
130 130
 				$this->_release_registration_space();
131
-				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
131
+				do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID);
132 132
 			}
133 133
 			// update status
134
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
134
+			parent::set('STS_ID', $new_STS_ID, $use_default);
135 135
 			/** @type EE_Registration_Processor $registration_processor */
136
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
136
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
137 137
 			/** @type EE_Transaction_Processor $transaction_processor */
138
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
138
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
139 139
 			/** @type EE_Transaction_Payments $transaction_payments */
140
-			$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
140
+			$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
141 141
 			// these reg statuses should not be considered in any calculations involving monies owing
142
-			$closed_reg_statuses = ! empty( $closed_reg_statuses )
142
+			$closed_reg_statuses = ! empty($closed_reg_statuses)
143 143
 				? $closed_reg_statuses
144 144
 				: EEM_Registration::closed_reg_statuses();
145 145
 			if (
146
-				in_array( $new_STS_ID, $closed_reg_statuses )
147
-				&& ! in_array( $old_STS_ID, $closed_reg_statuses )
146
+				in_array($new_STS_ID, $closed_reg_statuses)
147
+				&& ! in_array($old_STS_ID, $closed_reg_statuses)
148 148
 			) {
149 149
 				// cancelled or declined registration
150 150
 				$registration_processor->update_registration_after_being_canceled_or_declined(
@@ -157,24 +157,24 @@  discard block
 block discarded – undo
157 157
 					false
158 158
 				);
159 159
 			} else if (
160
-				in_array( $old_STS_ID, $closed_reg_statuses )
161
-				&& ! in_array( $new_STS_ID, $closed_reg_statuses )
160
+				in_array($old_STS_ID, $closed_reg_statuses)
161
+				&& ! in_array($new_STS_ID, $closed_reg_statuses)
162 162
 			) {
163 163
 				// reinstating cancelled or declined registration
164 164
 				$registration_processor->update_canceled_or_declined_registration_after_being_reinstated(
165 165
 					$this,
166 166
 					$closed_reg_statuses
167 167
 				);
168
-				$transaction_processor->update_transaction_after_reinstating_canceled_registration( $this );
168
+				$transaction_processor->update_transaction_after_reinstating_canceled_registration($this);
169 169
 			}
170
-			$transaction_payments->recalculate_transaction_total( $this->transaction(), false );
170
+			$transaction_payments->recalculate_transaction_total($this->transaction(), false);
171 171
 			$this->transaction()->update_status_based_on_total_paid();
172
-			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
172
+			do_action('AHEE__EE_Registration__set_status__after_update', $this);
173 173
 			return TRUE;
174 174
 		} else {
175 175
 			//even though the old value matches the new value, it's still good to
176 176
 			//allow the parent set method to have a say
177
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
177
+			parent::set('STS_ID', $new_STS_ID, $use_default);
178 178
 			return TRUE;
179 179
 		}
180 180
 	}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @access        public
187 187
 	 */
188 188
 	public function status_ID() {
189
-		return $this->get( 'STS_ID' );
189
+		return $this->get('STS_ID');
190 190
 	}
191 191
 
192 192
 
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
 	 * @param boolean $include_archived whether to include archived tickets or not.
212 212
 	 * @return EE_Ticket
213 213
 	 */
214
-	public function ticket( $include_archived = TRUE ) {
214
+	public function ticket($include_archived = TRUE) {
215 215
 		$query_params = array();
216
-		if ( $include_archived ) {
217
-			$query_params[ 'default_where_conditions' ] = 'none';
216
+		if ($include_archived) {
217
+			$query_params['default_where_conditions'] = 'none';
218 218
 		}
219
-		return $this->get_first_related( 'Ticket', $query_params );
219
+		return $this->get_first_related('Ticket', $query_params);
220 220
 	}
221 221
 
222 222
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function wp_user() {
246 246
 		$event = $this->event();
247
-		if ( $event instanceof EE_Event ) {
247
+		if ($event instanceof EE_Event) {
248 248
 			return $event->wp_user();
249 249
 		}
250 250
 		return 0;
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 * @access        public
271 271
 	 * @param        int $ATT_ID Attendee ID
272 272
 	 */
273
-	public function set_attendee_id( $ATT_ID = 0 ) {
274
-		$this->set( 'ATT_ID', $ATT_ID );
273
+	public function set_attendee_id($ATT_ID = 0) {
274
+		$this->set('ATT_ID', $ATT_ID);
275 275
 	}
276 276
 
277 277
 
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 	 * @access        public
283 283
 	 * @param        int $TXN_ID Transaction ID
284 284
 	 */
285
-	public function set_transaction_id( $TXN_ID = 0 ) {
286
-		$this->set( 'TXN_ID', $TXN_ID );
285
+	public function set_transaction_id($TXN_ID = 0) {
286
+		$this->set('TXN_ID', $TXN_ID);
287 287
 	}
288 288
 
289 289
 
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
 	 * @access    public
295 295
 	 * @param    string $REG_session PHP Session ID
296 296
 	 */
297
-	public function set_session( $REG_session = '' ) {
298
-		$this->set( 'REG_session', $REG_session );
297
+	public function set_session($REG_session = '') {
298
+		$this->set('REG_session', $REG_session);
299 299
 	}
300 300
 
301 301
 
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
 	 * @access    public
307 307
 	 * @param    string $REG_url_link Registration URL Link
308 308
 	 */
309
-	public function set_reg_url_link( $REG_url_link = '' ) {
310
-		$this->set( 'REG_url_link', $REG_url_link );
309
+	public function set_reg_url_link($REG_url_link = '') {
310
+		$this->set('REG_url_link', $REG_url_link);
311 311
 	}
312 312
 
313 313
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 	 * @access        public
319 319
 	 * @param        int $REG_count Primary Attendee
320 320
 	 */
321
-	public function set_count( $REG_count = 1 ) {
322
-		$this->set( 'REG_count', $REG_count );
321
+	public function set_count($REG_count = 1) {
322
+		$this->set('REG_count', $REG_count);
323 323
 	}
324 324
 
325 325
 
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 	 * @access        public
331 331
 	 * @param        boolean $REG_group_size Group Registration
332 332
 	 */
333
-	public function set_group_size( $REG_group_size = FALSE ) {
334
-		$this->set( 'REG_group_size', $REG_group_size );
333
+	public function set_group_size($REG_group_size = FALSE) {
334
+		$this->set('REG_group_size', $REG_group_size);
335 335
 	}
336 336
 
337 337
 
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 	 * @access        public
415 415
 	 * @param        mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date
416 416
 	 */
417
-	public function set_reg_date( $REG_date = FALSE ) {
418
-		$this->set( 'REG_date', $REG_date );
417
+	public function set_reg_date($REG_date = FALSE) {
418
+		$this->set('REG_date', $REG_date);
419 419
 	}
420 420
 
421 421
 
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 	 * @access    public
427 427
 	 * @param    float $REG_final_price
428 428
 	 */
429
-	public function set_final_price( $REG_final_price = 0.00 ) {
430
-		$this->set( 'REG_final_price', $REG_final_price );
429
+	public function set_final_price($REG_final_price = 0.00) {
430
+		$this->set('REG_final_price', $REG_final_price);
431 431
 	}
432 432
 
433 433
 
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 	 * @access    public
439 439
 	 * @param    float $REG_paid
440 440
 	 */
441
-	public function set_paid( $REG_paid = 0.00 ) {
442
-		$this->set( 'REG_paid', $REG_paid );
441
+	public function set_paid($REG_paid = 0.00) {
442
+		$this->set('REG_paid', $REG_paid);
443 443
 	}
444 444
 
445 445
 
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 	 * @access        public
451 451
 	 * @param        boolean $REG_att_is_going Attendee Is Going
452 452
 	 */
453
-	public function set_att_is_going( $REG_att_is_going = FALSE ) {
454
-		$this->set( 'REG_att_is_going', $REG_att_is_going );
453
+	public function set_att_is_going($REG_att_is_going = FALSE) {
454
+		$this->set('REG_att_is_going', $REG_att_is_going);
455 455
 	}
456 456
 
457 457
 
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	 * @return EE_Attendee
462 462
 	 */
463 463
 	public function attendee() {
464
-		return $this->get_first_related( 'Attendee' );
464
+		return $this->get_first_related('Attendee');
465 465
 	}
466 466
 
467 467
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 * @access        public
472 472
 	 */
473 473
 	public function event_ID() {
474
-		return $this->get( 'EVT_ID' );
474
+		return $this->get('EVT_ID');
475 475
 	}
476 476
 
477 477
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 	 */
483 483
 	public function event_name() {
484 484
 		$event = $this->event_obj();
485
-		if ( $event ) {
485
+		if ($event) {
486 486
 			return $event->name();
487 487
 		} else {
488 488
 			return NULL;
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 * @return EE_Event
497 497
 	 */
498 498
 	public function event_obj() {
499
-		return $this->get_first_related( 'Event' );
499
+		return $this->get_first_related('Event');
500 500
 	}
501 501
 
502 502
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	 * @access        public
507 507
 	 */
508 508
 	public function attendee_ID() {
509
-		return $this->get( 'ATT_ID' );
509
+		return $this->get('ATT_ID');
510 510
 	}
511 511
 
512 512
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	 * @access        public
517 517
 	 */
518 518
 	public function session_ID() {
519
-		return $this->get( 'REG_session' );
519
+		return $this->get('REG_session');
520 520
 	}
521 521
 
522 522
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
527 527
 	 * @return string
528 528
 	 */
529
-	public function receipt_url( $messenger = 'html' ) {
529
+	public function receipt_url($messenger = 'html') {
530 530
 
531 531
 		/**
532 532
 		 * The below will be deprecated one version after this.  We check first if there is a custom receipt template already in use on old system.  If there is then we just return the standard url for it.
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
 		 * @since 4.5.0
535 535
 		 */
536 536
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php';
537
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
537
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
538 538
 
539
-		if ( $has_custom ) {
540
-			return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) );
539
+		if ($has_custom) {
540
+			return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch'));
541 541
 		}
542
-		return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' );
542
+		return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt');
543 543
 	}
544 544
 
545 545
 
@@ -550,28 +550,28 @@  discard block
 block discarded – undo
550 550
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
551 551
 	 * @return string
552 552
 	 */
553
-	public function invoice_url( $messenger = 'html' ) {
553
+	public function invoice_url($messenger = 'html') {
554 554
 		/**
555 555
 		 * The below will be deprecated one version after this.  We check first if there is a custom invoice template already in use on old system.  If there is then we just return the standard url for it.
556 556
 		 *
557 557
 		 * @since 4.5.0
558 558
 		 */
559 559
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php';
560
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
560
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
561 561
 
562
-		if ( $has_custom ) {
563
-			if ( $messenger == 'html' ) {
564
-				return $this->invoice_url( 'launch' );
562
+		if ($has_custom) {
563
+			if ($messenger == 'html') {
564
+				return $this->invoice_url('launch');
565 565
 			}
566 566
 			$route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice';
567 567
 
568
-			$query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() );
569
-			if ( $messenger == 'html' ) {
568
+			$query_args = array('ee' => $route, 'id' => $this->reg_url_link());
569
+			if ($messenger == 'html') {
570 570
 				$query_args['html'] = TRUE;
571 571
 			}
572
-			return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) );
572
+			return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
573 573
 		}
574
-		return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' );
574
+		return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice');
575 575
 	}
576 576
 
577 577
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 	 * @throws \EE_Error
585 585
 	 */
586 586
 	public function reg_url_link() {
587
-		return (string)$this->get( 'REG_url_link' );
587
+		return (string) $this->get('REG_url_link');
588 588
 	}
589 589
 
590 590
 
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
 	 * @param string $type 'download','launch', or 'html' (default is 'launch')
595 595
 	 * @return void
596 596
 	 */
597
-	public function e_invoice_url( $type = 'launch' ) {
598
-		echo $this->invoice_url( $type );
597
+	public function e_invoice_url($type = 'launch') {
598
+		echo $this->invoice_url($type);
599 599
 	}
600 600
 
601 601
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @return string
616 616
 	 */
617 617
 	public function payment_overview_url() {
618
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
618
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
619 619
 	}
620 620
 
621 621
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 	 * @return string
627 627
 	 */
628 628
 	public function edit_attendee_information_url() {
629
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
629
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
630 630
 	}
631 631
 
632 632
 
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 	 * @return string
637 637
 	 */
638 638
 	public function get_admin_edit_url() {
639
-		return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) );
639
+		return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php'));
640 640
 	}
641 641
 
642 642
 
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 * @access        public
647 647
 	 */
648 648
 	public function is_primary_registrant() {
649
-		return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE;
649
+		return $this->get('REG_count') == 1 ? TRUE : FALSE;
650 650
 	}
651 651
 
652 652
 
@@ -655,12 +655,12 @@  discard block
 block discarded – undo
655 655
 	 * This returns the primary registration object for this registration group (which may be this object).
656 656
 	 * @return EE_Registration
657 657
 	 */
658
-	public function get_primary_registration()  {
659
-		if ( $this->is_primary_registrant() )
658
+	public function get_primary_registration() {
659
+		if ($this->is_primary_registrant())
660 660
 			return $this;
661 661
 
662 662
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
663
-		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
663
+		$primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1)));
664 664
 		return $primary_registrant;
665 665
 	}
666 666
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	* 		@access		public
672 672
 	*/
673 673
 	public function count() {
674
-		return $this->get( 'REG_count' );
674
+		return $this->get('REG_count');
675 675
 	}
676 676
 
677 677
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	 * @access        public
682 682
 	 */
683 683
 	public function group_size() {
684
-		return $this->get( 'REG_group_size' );
684
+		return $this->get('REG_group_size');
685 685
 	}
686 686
 
687 687
 
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	 * @access        public
692 692
 	 */
693 693
 	public function date() {
694
-		return $this->get( 'REG_date' );
694
+		return $this->get('REG_date');
695 695
 	}
696 696
 
697 697
 
@@ -702,8 +702,8 @@  discard block
 block discarded – undo
702 702
 	 * @param string $time_format
703 703
 	 * @return string
704 704
 	 */
705
-	public function pretty_date( $date_format = NULL, $time_format = NULL ) {
706
-		return $this->get_datetime( 'REG_date', $date_format, $time_format );
705
+	public function pretty_date($date_format = NULL, $time_format = NULL) {
706
+		return $this->get_datetime('REG_date', $date_format, $time_format);
707 707
 	}
708 708
 
709 709
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 	 * @return    float
717 717
 	 */
718 718
 	public function final_price() {
719
-		return $this->get( 'REG_final_price' );
719
+		return $this->get('REG_final_price');
720 720
 	}
721 721
 
722 722
 
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	 * @return string
728 728
 	 */
729 729
 	public function pretty_final_price() {
730
-		return $this->get_pretty( 'REG_final_price' );
730
+		return $this->get_pretty('REG_final_price');
731 731
 	}
732 732
 
733 733
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 	 * @return 	float
739 739
 	 */
740 740
 	public function paid() {
741
-		return $this->get( 'REG_paid' );
741
+		return $this->get('REG_paid');
742 742
 	}
743 743
 
744 744
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	 * @return 	float
750 750
 	 */
751 751
 	public function pretty_paid() {
752
-		return $this->get_pretty( 'REG_paid' );
752
+		return $this->get_pretty('REG_paid');
753 753
 	}
754 754
 
755 755
 
@@ -761,11 +761,11 @@  discard block
 block discarded – undo
761 761
 	 * @param array $requires_payment
762 762
 	 * @return bool
763 763
 	 */
764
-	public function owes_monies_and_can_pay( $requires_payment = array()) {
764
+	public function owes_monies_and_can_pay($requires_payment = array()) {
765 765
 		// these reg statuses require payment (if event is not free)
766
-		$requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
766
+		$requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
767 767
 		if (
768
-			in_array( $this->status_ID(), $requires_payment ) &&
768
+			in_array($this->status_ID(), $requires_payment) &&
769 769
 			$this->final_price() != 0 &&
770 770
 			$this->final_price() != $this->paid()
771 771
 		) {
@@ -782,8 +782,8 @@  discard block
 block discarded – undo
782 782
 	 * @param bool $show_icons
783 783
 	 * @return void
784 784
 	 */
785
-	public function e_pretty_status( $show_icons = FALSE ) {
786
-		echo $this->pretty_status( $show_icons );
785
+	public function e_pretty_status($show_icons = FALSE) {
786
+		echo $this->pretty_status($show_icons);
787 787
 	}
788 788
 
789 789
 
@@ -794,10 +794,10 @@  discard block
 block discarded – undo
794 794
 	 * @param bool $show_icons
795 795
 	 * @return string
796 796
 	 */
797
-	public function pretty_status( $show_icons = FALSE ) {
798
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
797
+	public function pretty_status($show_icons = FALSE) {
798
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
799 799
 		$icon = '';
800
-		switch ( $this->status_ID() ) {
800
+		switch ($this->status_ID()) {
801 801
 			case EEM_Registration::status_id_approved:
802 802
 				$icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : '';
803 803
 				break;
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 				$icon = $show_icons ? '<span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>' : '';
821 821
 				break;
822 822
 		}
823
-		return $icon . $status[ $this->status_ID() ];
823
+		return $icon.$status[$this->status_ID()];
824 824
 	}
825 825
 
826 826
 
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 	 * @access        public
831 831
 	 */
832 832
 	public function att_is_going() {
833
-		return $this->get( 'REG_att_is_going' );
833
+		return $this->get('REG_att_is_going');
834 834
 	}
835 835
 
836 836
 
@@ -840,8 +840,8 @@  discard block
 block discarded – undo
840 840
 	 * @param array $query_params like EEM_Base::get_all
841 841
 	 * @return EE_Answer[]
842 842
 	 */
843
-	public function answers( $query_params = NULL ) {
844
-		return $this->get_many_related( 'Answer', $query_params );
843
+	public function answers($query_params = NULL) {
844
+		return $this->get_many_related('Answer', $query_params);
845 845
 	}
846 846
 
847 847
 
@@ -855,9 +855,9 @@  discard block
 block discarded – undo
855 855
 	 * (because the answer might be an array of answer values, so passing pretty_value=true
856 856
 	 * will convert it into some kind of string)
857 857
 	 */
858
-	public function answer_value_to_question( $question, $pretty_value=true ) {
858
+	public function answer_value_to_question($question, $pretty_value = true) {
859 859
 		$question_id = EEM_Question::instance()->ensure_is_ID($question);
860
-		return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value);
860
+		return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value);
861 861
 	}
862 862
 
863 863
 
@@ -870,13 +870,13 @@  discard block
 block discarded – undo
870 870
 	 */
871 871
 	public function question_groups() {
872 872
 		$question_groups = array();
873
-		if ( $this->event() instanceof EE_Event ) {
873
+		if ($this->event() instanceof EE_Event) {
874 874
 			$question_groups = $this->event()->question_groups(
875 875
 				array(
876 876
 					array(
877 877
 						'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false
878 878
 					),
879
-					'order_by' => array( 'QSG_order' => 'ASC' )
879
+					'order_by' => array('QSG_order' => 'ASC')
880 880
 				)
881 881
 			);
882 882
 		}
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 	 */
894 894
 	public function count_question_groups() {
895 895
 		$qg_count = 0;
896
-		if ( $this->event() instanceof EE_Event ) {
896
+		if ($this->event() instanceof EE_Event) {
897 897
 			$qg_count = $this->event()->count_related(
898 898
 				'Question_Group',
899 899
 				array(
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 	 * @return string
915 915
 	 */
916 916
 	public function reg_date() {
917
-		return $this->get_datetime( 'REG_date' );
917
+		return $this->get_datetime('REG_date');
918 918
 	}
919 919
 
920 920
 
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 	 * @return EE_Datetime_Ticket
927 927
 	 */
928 928
 	public function datetime_ticket() {
929
-		return $this->get_first_related( 'Datetime_Ticket' );
929
+		return $this->get_first_related('Datetime_Ticket');
930 930
 	}
931 931
 
932 932
 
@@ -936,15 +936,15 @@  discard block
 block discarded – undo
936 936
 	 * @param EE_Datetime_Ticket $datetime_ticket
937 937
 	 * @return EE_Datetime_Ticket
938 938
 	 */
939
-	public function set_datetime_ticket( $datetime_ticket ) {
940
-		return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' );
939
+	public function set_datetime_ticket($datetime_ticket) {
940
+		return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket');
941 941
 	}
942 942
 	/**
943 943
 	 * Gets deleted
944 944
 	 * @return boolean
945 945
 	 */
946 946
 	public function deleted() {
947
-		return $this->get( 'REG_deleted' );
947
+		return $this->get('REG_deleted');
948 948
 	}
949 949
 
950 950
 	/**
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 	 * @return boolean
954 954
 	 */
955 955
 	public function set_deleted($deleted) {
956
-		$this->set( 'REG_deleted', $deleted );
956
+		$this->set('REG_deleted', $deleted);
957 957
 	}
958 958
 
959 959
 
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 	 * @return EE_Status
964 964
 	 */
965 965
 	public function status_obj() {
966
-		return $this->get_first_related( 'Status' );
966
+		return $this->get_first_related('Status');
967 967
 	}
968 968
 
969 969
 
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 	 * @return int
975 975
 	 */
976 976
 	public function count_checkins() {
977
-		return $this->get_model()->count_related( $this, 'Checkin' );
977
+		return $this->get_model()->count_related($this, 'Checkin');
978 978
 	}
979 979
 
980 980
 
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 	 * @return int
985 985
 	 */
986 986
 	public function count_checkins_not_checkedout() {
987
-		return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) );
987
+		return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1)));
988 988
 	}
989 989
 
990 990
 
@@ -997,20 +997,20 @@  discard block
 block discarded – undo
997 997
 	 *
998 998
 	 * @return bool
999 999
 	 */
1000
-	public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) {
1001
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
1000
+	public function can_checkin($DTT_OR_ID, $check_approved = TRUE) {
1001
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
1002 1002
 
1003 1003
 		//first check registration status
1004
-		if (  ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) {
1004
+		if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) {
1005 1005
 			return false;
1006 1006
 		}
1007 1007
 		//is there a datetime ticket that matches this dtt_ID?
1008
-		if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) {
1008
+		if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) {
1009 1009
 			return false;
1010 1010
 		}
1011 1011
 
1012 1012
 		//final check is against TKT_uses
1013
-		return $this->verify_can_checkin_against_TKT_uses( $DTT_ID );
1013
+		return $this->verify_can_checkin_against_TKT_uses($DTT_ID);
1014 1014
 	}
1015 1015
 
1016 1016
 
@@ -1023,10 +1023,10 @@  discard block
 block discarded – undo
1023 1023
 	 * @param int | EE_Datetime  $DTT_OR_ID  The datetime the registration is being checked against
1024 1024
 	 * @return bool   true means can checkin.  false means cannot checkin.
1025 1025
 	 */
1026
-	public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) {
1027
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
1026
+	public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) {
1027
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
1028 1028
 
1029
-		if ( ! $DTT_ID ) {
1029
+		if ( ! $DTT_ID) {
1030 1030
 			return false;
1031 1031
 		}
1032 1032
 
@@ -1034,23 +1034,23 @@  discard block
 block discarded – undo
1034 1034
 
1035 1035
 		// if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in
1036 1036
 		// or not.
1037
-		if ( ! $max_uses || $max_uses === EE_INF ) {
1037
+		if ( ! $max_uses || $max_uses === EE_INF) {
1038 1038
 			return true;
1039 1039
 		}
1040 1040
 
1041 1041
 		//does this datetime have a checkin record?  If so, then the dtt count has already been verified so we can just
1042 1042
 		//go ahead and toggle.
1043
-		if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) {
1043
+		if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) {
1044 1044
 			return true;
1045 1045
 		}
1046 1046
 
1047 1047
 		//made it here so the last check is whether the number of checkins per unique datetime on this registration
1048 1048
 		//disallows further check-ins.
1049
-		$count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true );
1049
+		$count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true);
1050 1050
 		// checkins have already reached their max number of uses
1051 1051
 		// so registrant can NOT checkin
1052
-		if ( $count_unique_dtt_checkins >= $max_uses ) {
1053
-			EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1052
+		if ($count_unique_dtt_checkins >= $max_uses) {
1053
+			EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1054 1054
 			return false;
1055 1055
 		}
1056 1056
 		return true;
@@ -1071,15 +1071,15 @@  discard block
 block discarded – undo
1071 1071
 	 * @param  bool $verify  If true then can_checkin() is used to verify whether the person can be checked in or not.  Otherwise this forces change in checkin status.
1072 1072
 	 * @return int|BOOL            the chk_in status toggled to OR false if nothing got changed.
1073 1073
 	 */
1074
-	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1075
-		if ( empty( $DTT_ID ) ) {
1074
+	public function toggle_checkin_status($DTT_ID = null, $verify = false) {
1075
+		if (empty($DTT_ID)) {
1076 1076
 			$datetime = $this->get_related_primary_datetime();
1077 1077
 			$DTT_ID = $datetime->ID();
1078 1078
 		// verify the registration can checkin for the given DTT_ID
1079
-		} elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) {
1079
+		} elseif ( ! $this->can_checkin($DTT_ID, $verify)) {
1080 1080
 			EE_Error::add_error(
1081 1081
 					sprintf(
1082
-						__( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1082
+						__('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1083 1083
 						$this->ID(),
1084 1084
 						$DTT_ID
1085 1085
 					),
@@ -1093,8 +1093,8 @@  discard block
 block discarded – undo
1093 1093
 			EE_Registration::checkin_status_out => EE_Registration::checkin_status_in
1094 1094
 		);
1095 1095
 		//start by getting the current status so we know what status we'll be changing to.
1096
-		$cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL );
1097
-		$status_to = $status_paths[ $cur_status ];
1096
+		$cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL);
1097
+		$status_to = $status_paths[$cur_status];
1098 1098
 		// database only records true for checked IN or false for checked OUT
1099 1099
 		// no record ( null ) means checked in NEVER, but we obviously don't save that
1100 1100
 		$new_status = $status_to == EE_Registration::checkin_status_in ? true : false;
@@ -1102,24 +1102,24 @@  discard block
 block discarded – undo
1102 1102
 		// because we are keeping track of Check-ins over time.
1103 1103
 		// Eventually we'll probably want to show a list table
1104 1104
 		// for the individual Check-ins so that they can be managed.
1105
-		$checkin = EE_Checkin::new_instance( array(
1105
+		$checkin = EE_Checkin::new_instance(array(
1106 1106
 				'REG_ID' => $this->ID(),
1107 1107
 				'DTT_ID' => $DTT_ID,
1108 1108
 				'CHK_in' => $new_status
1109
-		) );
1109
+		));
1110 1110
 		// if the record could not be saved then return false
1111
-		if ( $checkin->save() === 0 ) {
1112
-			if ( WP_DEBUG ) {
1111
+		if ($checkin->save() === 0) {
1112
+			if (WP_DEBUG) {
1113 1113
 				global $wpdb;
1114 1114
 				$error = sprintf(
1115
-					__( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ),
1115
+					__('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'),
1116 1116
 					'<br />',
1117 1117
 					$wpdb->last_error
1118 1118
 				);
1119 1119
 			} else {
1120
-				$error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' );
1120
+				$error = __('Registration check in update failed because of an unknown database error', 'event_espresso');
1121 1121
 			}
1122
-			EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
1122
+			EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
1123 1123
 			return false;
1124 1124
 		}
1125 1125
 		return $status_to;
@@ -1143,19 +1143,19 @@  discard block
 block discarded – undo
1143 1143
 	 * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1144 1144
 	 * @return int            Integer representing Check-in status.
1145 1145
 	 */
1146
-	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) {
1147
-		if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) {
1146
+	public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) {
1147
+		if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) {
1148 1148
 			$datetime = $this->get_related_primary_datetime();
1149
-			if ( ! $datetime instanceof EE_Datetime ) {
1149
+			if ( ! $datetime instanceof EE_Datetime) {
1150 1150
 				return 0;
1151 1151
 			}
1152 1152
 			$DTT_ID = $datetime->ID();
1153 1153
 		//verify the registration can checkin for the given DTT_ID
1154 1154
 		}
1155 1155
 		//get checkin object (if exists)
1156
-		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) );
1157
-		if ( $checkin instanceof EE_Checkin ) {
1158
-			if ( $checkin->get( 'CHK_in' ) ) {
1156
+		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC')));
1157
+		if ($checkin instanceof EE_Checkin) {
1158
+			if ($checkin->get('CHK_in')) {
1159 1159
 				return EE_Registration::checkin_status_in; //checked in
1160 1160
 			} else {
1161 1161
 				return EE_Registration::checkin_status_out; //had checked in but is now checked out.
@@ -1173,28 +1173,28 @@  discard block
 block discarded – undo
1173 1173
 	 * @param bool $error  This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name.
1174 1174
 	 * @return string         internationalized message
1175 1175
 	 */
1176
-	public function get_checkin_msg( $DTT_ID, $error = FALSE ) {
1176
+	public function get_checkin_msg($DTT_ID, $error = FALSE) {
1177 1177
 		//let's get the attendee first so we can include the name of the attendee
1178
-		$attendee = $this->get_first_related( 'Attendee' );
1179
-		if ( $attendee instanceof EE_Attendee ) {
1180
-			if ( $error ) {
1181
-				return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() );
1178
+		$attendee = $this->get_first_related('Attendee');
1179
+		if ($attendee instanceof EE_Attendee) {
1180
+			if ($error) {
1181
+				return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name());
1182 1182
 			}
1183
-			$cur_status = $this->check_in_status_for_datetime( $DTT_ID );
1183
+			$cur_status = $this->check_in_status_for_datetime($DTT_ID);
1184 1184
 			//what is the status message going to be?
1185
-			switch ( $cur_status ) {
1185
+			switch ($cur_status) {
1186 1186
 				case EE_Registration::checkin_status_never :
1187
-					return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() );
1187
+					return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name());
1188 1188
 					break;
1189 1189
 				case EE_Registration::checkin_status_in :
1190
-					return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() );
1190
+					return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name());
1191 1191
 					break;
1192 1192
 				case EE_Registration::checkin_status_out :
1193
-					return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() );
1193
+					return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name());
1194 1194
 					break;
1195 1195
 			}
1196 1196
 		}
1197
-		return __( "The check-in status could not be determined.", "event_espresso" );
1197
+		return __("The check-in status could not be determined.", "event_espresso");
1198 1198
 	}
1199 1199
 
1200 1200
 
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 	 * @access        public
1220 1220
 	 */
1221 1221
 	public function reg_code() {
1222
-		return $this->get( 'REG_code' );
1222
+		return $this->get('REG_code');
1223 1223
 	}
1224 1224
 
1225 1225
 
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 	 * @access        public
1230 1230
 	 */
1231 1231
 	public function transaction_ID() {
1232
-		return $this->get( 'TXN_ID' );
1232
+		return $this->get('TXN_ID');
1233 1233
 	}
1234 1234
 
1235 1235
 
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 	 * @return int
1239 1239
 	 */
1240 1240
 	public function ticket_ID() {
1241
-		return $this->get( 'TKT_ID' );
1241
+		return $this->get('TKT_ID');
1242 1242
 	}
1243 1243
 
1244 1244
 
@@ -1250,17 +1250,17 @@  discard block
 block discarded – undo
1250 1250
 	 * @param    string $REG_code Registration Code
1251 1251
 	 * @param	boolean $use_default
1252 1252
 	 */
1253
-	public function set_reg_code( $REG_code, $use_default = FALSE ) {
1254
-		if ( empty( $REG_code )) {
1255
-			EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1253
+	public function set_reg_code($REG_code, $use_default = FALSE) {
1254
+		if (empty($REG_code)) {
1255
+			EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1256 1256
 			return;
1257 1257
 		}
1258
-		if ( ! $this->reg_code() ) {
1259
-			parent::set( 'REG_code', $REG_code, $use_default );
1258
+		if ( ! $this->reg_code()) {
1259
+			parent::set('REG_code', $REG_code, $use_default);
1260 1260
 		} else {
1261 1261
 			EE_Error::doing_it_wrong(
1262
-				__CLASS__ . '::' . __FUNCTION__,
1263
-				__( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ),
1262
+				__CLASS__.'::'.__FUNCTION__,
1263
+				__('Can not change a registration REG_code once it has been set.', 'event_espresso'),
1264 1264
 				'4.6.0'
1265 1265
 			);
1266 1266
 		}
@@ -1280,17 +1280,17 @@  discard block
 block discarded – undo
1280 1280
 	 * @return EE_Registration[]  or empty array if this isn't a group registration.
1281 1281
 	 */
1282 1282
 	public function get_all_other_registrations_in_group() {
1283
-		if ( $this->group_size() < 2 ) {
1283
+		if ($this->group_size() < 2) {
1284 1284
 			return array();
1285 1285
 		}
1286 1286
 
1287 1287
 		$query[0] = array(
1288 1288
 			'TXN_ID' => $this->transaction_ID(),
1289
-			'REG_ID' => array( '!=', $this->ID() ),
1289
+			'REG_ID' => array('!=', $this->ID()),
1290 1290
 			'TKT_ID' => $this->ticket_ID()
1291 1291
 			);
1292 1292
 
1293
-		$registrations = $this->get_model()->get_all( $query );
1293
+		$registrations = $this->get_model()->get_all($query);
1294 1294
 		return $registrations;
1295 1295
 	}
1296 1296
 
@@ -1299,14 +1299,14 @@  discard block
 block discarded – undo
1299 1299
 	 * @return string
1300 1300
 	 */
1301 1301
 	public function get_admin_details_link() {
1302
-		EE_Registry::instance()->load_helper( 'URL' );
1302
+		EE_Registry::instance()->load_helper('URL');
1303 1303
 		return EEH_URL::add_query_args_and_nonce(
1304 1304
 			array(
1305 1305
 				'page' => 'espresso_registrations',
1306 1306
 				'action' => 'view_registration',
1307 1307
 				'_REG_ID' => $this->ID()
1308 1308
 			),
1309
-			admin_url( 'admin.php' )
1309
+			admin_url('admin.php')
1310 1310
 		);
1311 1311
 	}
1312 1312
 
@@ -1331,12 +1331,12 @@  discard block
 block discarded – undo
1331 1331
 	 * @return string
1332 1332
 	 */
1333 1333
 	public function get_admin_overview_link() {
1334
-		EE_Registry::instance()->load_helper( 'URL' );
1334
+		EE_Registry::instance()->load_helper('URL');
1335 1335
 		return EEH_URL::add_query_args_and_nonce(
1336 1336
 			array(
1337 1337
 				'page' => 'espresso_registrations'
1338 1338
 			),
1339
-			admin_url( 'admin.php' )
1339
+			admin_url('admin.php')
1340 1340
 		);
1341 1341
 	}
1342 1342
 
@@ -1347,8 +1347,8 @@  discard block
 block discarded – undo
1347 1347
 	 * @return \EE_Registration[]
1348 1348
 	 * @throws \EE_Error
1349 1349
 	 */
1350
-	public function payments( $query_params = array() ) {
1351
-		return $this->get_many_related( 'Payment', $query_params );
1350
+	public function payments($query_params = array()) {
1351
+		return $this->get_many_related('Payment', $query_params);
1352 1352
 	}
1353 1353
 
1354 1354
 
@@ -1358,8 +1358,8 @@  discard block
 block discarded – undo
1358 1358
 	 * @return \EE_Registration_Payment[]
1359 1359
 	 * @throws \EE_Error
1360 1360
 	 */
1361
-	public function registration_payments( $query_params = array() ) {
1362
-		return $this->get_many_related( 'Registration_Payment', $query_params );
1361
+	public function registration_payments($query_params = array()) {
1362
+		return $this->get_many_related('Registration_Payment', $query_params);
1363 1363
 	}
1364 1364
 
1365 1365
 
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
 	 * @return EE_Payment_Method|null
1373 1373
 	 */
1374 1374
 	public function payment_method() {
1375
-		return EEM_Payment_Method::instance()->get_last_used_for_registration( $this );
1375
+		return EEM_Payment_Method::instance()->get_last_used_for_registration($this);
1376 1376
 	}
1377 1377
 
1378 1378
 
Please login to merge, or discard this patch.
EE_Admin_Table_Registration_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  *
11 11
  */
12 12
 
13
-class EE_Admin_Table_Registration_Line_Item_Display_Strategy extends EE_Admin_Table_Line_Item_Display_Strategy  {
13
+class EE_Admin_Table_Registration_Line_Item_Display_Strategy extends EE_Admin_Table_Line_Item_Display_Strategy {
14 14
 
15 15
 	/**
16 16
 	 * Table header for display.
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 	 * @param array $options
19 19
 	 * @return string
20 20
 	 */
21
-	protected function _table_header( $options ) {
22
-		$html = EEH_HTML::table( '','', $options['table_css_class'] );
21
+	protected function _table_header($options) {
22
+		$html = EEH_HTML::table('', '', $options['table_css_class']);
23 23
 		$html .= EEH_HTML::thead();
24 24
 		$html .= EEH_HTML::tr();
25
-		$html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' );
26
-		$html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' );
27
-		$html .= EEH_HTML::th( __( 'Date(s)', 'event_espresso' ), '', 'jst-left' );
28
-		$html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' );
25
+		$html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left');
26
+		$html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left');
27
+		$html .= EEH_HTML::th(__('Date(s)', 'event_espresso'), '', 'jst-left');
28
+		$html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr');
29 29
 		$html .= EEH_HTML::tbody();
30 30
 		return $html;
31 31
 	}
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 	 * @param array        $options
42 42
 	 * @return mixed
43 43
 	 */
44
-	protected function _item_row( EE_Line_Item $line_item, $options = array() ) {
44
+	protected function _item_row(EE_Line_Item $line_item, $options = array()) {
45 45
 		$line_item_related_object = $line_item->get_object();
46 46
 		$parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item
47 47
 			? $line_item->parent()->get_object()
48 48
 			: null;
49 49
 		// start of row
50 50
 		$row_class = $options['odd'] ? 'item odd' : 'item';
51
-		$html = EEH_HTML::tr( '', '', $row_class );
51
+		$html = EEH_HTML::tr('', '', $row_class);
52 52
 
53 53
 
54 54
 		//Name Column
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		$parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object
59 59
 			? $parent_line_item_related_object->name()
60 60
 			: '';
61
-		$parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item
61
+		$parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item
62 62
 			? $line_item->parent()->name()
63 63
 			: $parent_related_object_name;
64 64
 		$parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links
@@ -68,51 +68,51 @@  discard block
 block discarded – undo
68 68
 
69 69
 		$name_html = $line_item_related_object instanceof EEI_Line_Item_Object
70 70
 			? $line_item_related_object->name() : $line_item->name();
71
-		$name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>'
71
+		$name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>'
72 72
 			: $name_html;
73 73
 		$name_html .= $line_item->is_taxable() ? ' *' : '';
74 74
 		//maybe preface with icon?
75 75
 		$name_html = $line_item_related_object instanceof EEI_Has_Icon
76
-			? $line_item_related_object->get_icon() . $name_html
76
+			? $line_item_related_object->get_icon().$name_html
77 77
 			: $name_html;
78
-		$name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
79
-		$name_html .=  sprintf(
80
-			_x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
78
+		$name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>';
79
+		$name_html .= sprintf(
80
+			_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
81 81
 			'<span class="ee-line-item-related-parent-object">',
82 82
 			$line_item->parent() instanceof EE_Line_Item
83 83
 				? $line_item->parent()->OBJ_type_i18n()
84
-				: __( 'Item:', 'event_espresso' ),
84
+				: __('Item:', 'event_espresso'),
85 85
 			$parent_related_object_link
86
-				? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>'
86
+				? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>'
87 87
 				: $parent_related_object_name,
88 88
 			'</span>'
89 89
 		);
90
-		$html .= EEH_HTML::td( $name_html, '', 'jst-left' );
90
+		$html .= EEH_HTML::td($name_html, '', 'jst-left');
91 91
 		//Type Column
92 92
 		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : '';
93
-		$type_html .= $this->_get_cancellations( $line_item );
93
+		$type_html .= $this->_get_cancellations($line_item);
94 94
 		$type_html .= $line_item->OBJ_type() ? '<br />' : '';
95 95
 		$code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
96
-		$type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : '';
97
-		$html .= EEH_HTML::td( $type_html, '', 'jst-left' );
96
+		$type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : '';
97
+		$html .= EEH_HTML::td($type_html, '', 'jst-left');
98 98
 
99 99
 		//Date column
100 100
 		$datetime_content = '';
101
-		if ( $line_item_related_object instanceof EE_Ticket ) {
101
+		if ($line_item_related_object instanceof EE_Ticket) {
102 102
 			$datetimes = $line_item_related_object->datetimes();
103
-			foreach ( $datetimes as $datetime ) {
104
-				if ( $datetime instanceof EE_Datetime ) {
105
-					$datetime_content .= $datetime->get_dtt_display_name() . '<br>';
103
+			foreach ($datetimes as $datetime) {
104
+				if ($datetime instanceof EE_Datetime) {
105
+					$datetime_content .= $datetime->get_dtt_display_name().'<br>';
106 106
 				}
107 107
 			}
108 108
 		}
109
-		$html .= EEH_HTML::td( $datetime_content, '', 'jst-left' );
109
+		$html .= EEH_HTML::td($datetime_content, '', 'jst-left');
110 110
 
111 111
 		//Amount Column
112
-		if ( $line_item->is_percent() ) {
113
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' );
112
+		if ($line_item->is_percent()) {
113
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght');
114 114
 		} else {
115
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' );
115
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
116 116
 		}
117 117
 
118 118
 
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 	 * @param array        $options
131 131
 	 * @return mixed
132 132
 	 */
133
-	protected function _tax_row( EE_Line_Item $line_item, $options = array() ) {
133
+	protected function _tax_row(EE_Line_Item $line_item, $options = array()) {
134 134
 		// start of row
135
-		$html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' );
135
+		$html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
136 136
 		// name th
137
-		$html .= EEH_HTML::th(  $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '',  'jst-rght', '', ' colspan="3"' );
137
+		$html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="3"');
138 138
 		// total th
139
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
139
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
140 140
 		// end of row
141 141
 		$html .= EEH_HTML::trx();
142 142
 		return $html;
@@ -153,9 +153,9 @@  discard block
 block discarded – undo
153 153
 	 * @param array        $options
154 154
 	 * @return mixed
155 155
 	 */
156
-	protected function _total_row( EE_Line_Item $line_item, $options = array() ) {
156
+	protected function _total_row(EE_Line_Item $line_item, $options = array()) {
157 157
 
158
-		$registration = isset( $options['EE_Registration'] ) ? $options['EE_Registration'] : null;
158
+		$registration = isset($options['EE_Registration']) ? $options['EE_Registration'] : null;
159 159
 		$registration_total = $registration instanceof EE_Registration ? $registration->pretty_final_price() : 0;
160 160
 		//if no valid registration object then we're not going to show the approximate text.
161 161
 		$total_match = $registration instanceof EE_Registration
@@ -163,26 +163,26 @@  discard block
 block discarded – undo
163 163
 			: true;
164 164
 
165 165
 		// start of row
166
-		$html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' );
166
+		$html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
167 167
 		// Total th label
168
-		if ( $total_match ) {
169
-			$total_label = sprintf( __( 'This registration\'s total %s:', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );
168
+		if ($total_match) {
169
+			$total_label = sprintf(__('This registration\'s total %s:', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
170 170
 		} else {
171
-			$total_label = sprintf( __( 'This registration\'s approximate total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );
171
+			$total_label = sprintf(__('This registration\'s approximate total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
172 172
 			$total_label .= '<br>';
173 173
 			$total_label .= '<p class="ee-footnote-text">'
174 174
 			                . sprintf(
175
-				                __( 'The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others.  This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso' ),
175
+				                __('The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others.  This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso'),
176 176
 				                '<strong>',
177 177
 				                $registration_total,
178 178
 				                '</strong>'
179 179
 			                )
180 180
 			                . '</p>';
181 181
 		}
182
-		$html .= EEH_HTML::th( $total_label, '',  'jst-rght',  '',  ' colspan="3"' );
182
+		$html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="3"');
183 183
 		// total th
184 184
 
185
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'jst-rght' );
185
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
186 186
 		// end of row
187 187
 		$html .= EEH_HTML::trx();
188 188
 		return $html;
Please login to merge, or discard this patch.
line_item_display/EE_Admin_Table_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
line_item_filters/EE_Specific_Registrations_Line_Item_Filter.class.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 /**
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 	 * EE_Billable_Line_Item_Filter constructor.
48 48
 	 * @param EE_Registration[] $registrations
49 49
 	 */
50
-	public function __construct( $registrations ) {
50
+	public function __construct($registrations) {
51 51
 		$this->_registrations = $registrations;
52
-		$this->_calculate_registrations_per_line_item_code( $registrations );
52
+		$this->_calculate_registrations_per_line_item_code($registrations);
53 53
 		// these reg statuses should NOT increment the line item quantity
54 54
 		$this->_closed_reg_statuses = EEM_Registration::closed_reg_statuses();
55 55
 	}
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
 	 * @param EE_Registration[] $registrations
61 61
 	 * @return void
62 62
 	 */
63
-	protected function _calculate_registrations_per_line_item_code( $registrations ) {
64
-		foreach( $registrations as $registration ) {
63
+	protected function _calculate_registrations_per_line_item_code($registrations) {
64
+		foreach ($registrations as $registration) {
65 65
 			$line_item_code = EEM_Line_Item::instance()->get_var(
66 66
 				EEM_Line_Item::instance()->line_item_for_registration_query_params(
67 67
 					$registration,
68
-					array( 'limit' => 1 )
68
+					array('limit' => 1)
69 69
 				),
70 70
 				'LIN_code'
71 71
 			);
72
-			if( $line_item_code ) {
73
-				if( ! isset( $this->_line_item_registrations[ $line_item_code ] ) ) {
74
-					$this->_line_item_registrations[ $line_item_code ] = array();
72
+			if ($line_item_code) {
73
+				if ( ! isset($this->_line_item_registrations[$line_item_code])) {
74
+					$this->_line_item_registrations[$line_item_code] = array();
75 75
 				}
76
-				$this->_line_item_registrations[ $line_item_code ][ $registration->ID() ] = $registration;
76
+				$this->_line_item_registrations[$line_item_code][$registration->ID()] = $registration;
77 77
 			}
78 78
 		}
79 79
 	}
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	 * @param EEI_Line_Item      $line_item
87 87
 	 * @return \EEI_Line_Item
88 88
 	 */
89
-	public function process( EEI_Line_Item $line_item ) {
90
-		$this->_adjust_line_item_quantity( $line_item );
91
-		if( ! $line_item->children() ) {
89
+	public function process(EEI_Line_Item $line_item) {
90
+		$this->_adjust_line_item_quantity($line_item);
91
+		if ( ! $line_item->children()) {
92 92
 			return $line_item;
93 93
 		}
94 94
 		//the original running total (taking ALL tickets into account)
@@ -97,66 +97,66 @@  discard block
 block discarded – undo
97 97
 		$running_total_of_children_under_consideration = 0;
98 98
 		// let's also track the quantity of tickets that pertain to the registrations
99 99
 		$total_child_ticket_quantity = 0;
100
-		foreach ( $line_item->children() as $child_line_item ) {
100
+		foreach ($line_item->children() as $child_line_item) {
101 101
 			$original_li_total = $child_line_item->is_percent()
102 102
 				? $running_total_of_children * $child_line_item->percent() / 100
103 103
 				: $child_line_item->unit_price() * $child_line_item->quantity();
104 104
 
105
-			$this->process( $child_line_item );
105
+			$this->process($child_line_item);
106 106
 			/*
107 107
 			 * If this line item is a normal line item that isn't for a ticket
108 108
 			 * we want to modify its total (and unit price if not a percentage line item)
109 109
 			 * so it reflects only that portion of the surcharge/discount shared by these
110 110
 			 * registrations
111 111
 			 */
112
-			if(
112
+			if (
113 113
 				$child_line_item->type() === EEM_Line_Item::type_line_item
114 114
 				&& $child_line_item->OBJ_type() !== 'Ticket'
115 115
 			) {
116
-				if( $running_total_of_children ) {
116
+				if ($running_total_of_children) {
117 117
 					$percent_of_running_total = $original_li_total / $running_total_of_children;
118 118
 				} else {
119 119
 					$percent_of_running_total = 0;
120 120
 				}
121 121
 
122
-				$child_line_item->set_total( $running_total_of_children_under_consideration * $percent_of_running_total );
123
-				if( ! $child_line_item->is_percent() ) {
124
-					$child_line_item->set_unit_price( $child_line_item->total() / $child_line_item->quantity() );
122
+				$child_line_item->set_total($running_total_of_children_under_consideration * $percent_of_running_total);
123
+				if ( ! $child_line_item->is_percent()) {
124
+					$child_line_item->set_unit_price($child_line_item->total() / $child_line_item->quantity());
125 125
 				}
126 126
 			} else if (
127 127
 				$line_item->type() === EEM_Line_Item::type_line_item
128 128
 				&& $line_item->OBJ_type() === 'Ticket'
129 129
 			) {
130 130
 				//make sure this item's quantity matches its parent
131
-				if(
131
+				if (
132 132
 					! $child_line_item->is_percent()
133 133
 					&& ! (
134 134
 						$child_line_item->is_cancelled()
135 135
 						&& ! (
136 136
 							$child_line_item->is_cancelled()
137 137
 							&& $this->_current_registration instanceof EE_Registration
138
-							&& in_array( $this->_current_registration->status_ID(), $this->_closed_reg_statuses )
138
+							&& in_array($this->_current_registration->status_ID(), $this->_closed_reg_statuses)
139 139
 						)
140 140
 					)
141 141
 				) {
142
-					$child_line_item->set_quantity( $line_item->quantity() );
143
-					$child_line_item->set_total( $child_line_item->unit_price() * $child_line_item->quantity() );
142
+					$child_line_item->set_quantity($line_item->quantity());
143
+					$child_line_item->set_total($child_line_item->unit_price() * $child_line_item->quantity());
144 144
 				}
145 145
 			}
146 146
 			$running_total_of_children += $original_li_total;
147 147
 			$running_total_of_children_under_consideration += $child_line_item->total();
148
-			if ( $child_line_item->OBJ_type() == 'Ticket' ) {
148
+			if ($child_line_item->OBJ_type() == 'Ticket') {
149 149
 				$total_child_ticket_quantity += $child_line_item->quantity();
150 150
 			}
151 151
 		}
152
-		$line_item->set_total( $running_total_of_children_under_consideration );
153
-		if( $line_item->quantity() ) {
154
-			$line_item->set_unit_price( $running_total_of_children_under_consideration / $line_item->quantity() );
152
+		$line_item->set_total($running_total_of_children_under_consideration);
153
+		if ($line_item->quantity()) {
154
+			$line_item->set_unit_price($running_total_of_children_under_consideration / $line_item->quantity());
155 155
 		} else {
156
-			$line_item->set_unit_price( 0 );
156
+			$line_item->set_unit_price(0);
157 157
 		}
158
-		if ( $line_item->OBJ_type() == 'Event' ) {
159
-			$line_item->set_quantity( $total_child_ticket_quantity );
158
+		if ($line_item->OBJ_type() == 'Event') {
159
+			$line_item->set_quantity($total_child_ticket_quantity);
160 160
 		}
161 161
 		return $line_item;
162 162
 	}
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
 	 * @param EEI_Line_Item $line_item
170 170
 	 * @return EEI_Line_Item
171 171
 	 */
172
-	protected function _adjust_line_item_quantity( EEI_Line_Item $line_item ) {
172
+	protected function _adjust_line_item_quantity(EEI_Line_Item $line_item) {
173 173
 		// is this a ticket ?
174
-		if ( $line_item->type() === EEM_Line_Item::type_line_item && $line_item->OBJ_type() == 'Ticket' ) {
174
+		if ($line_item->type() === EEM_Line_Item::type_line_item && $line_item->OBJ_type() == 'Ticket') {
175 175
 			$this->_current_registration = null;
176 176
 			$quantity = 0;
177 177
 			// if this ticket is billable at this moment, then we should have a positive quantity
178 178
 			if (
179
-				isset( $this->_line_item_registrations[ $line_item->code() ] )
180
-				&& is_array( $this->_line_item_registrations[ $line_item->code() ] )
179
+				isset($this->_line_item_registrations[$line_item->code()])
180
+				&& is_array($this->_line_item_registrations[$line_item->code()])
181 181
 			) {
182 182
 				// set quantity based on number of open registrations for this ticket
183
-				foreach ( $this->_line_item_registrations[ $line_item->code() ] as $registration ) {
183
+				foreach ($this->_line_item_registrations[$line_item->code()] as $registration) {
184 184
 					if (
185 185
 						$registration instanceof EE_Registration
186 186
 					) {
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 					}
190 190
 				}
191 191
 			}
192
-			$line_item->set_quantity( $quantity );
193
-			$line_item->set_total( $line_item->unit_price() * $line_item->quantity() );
192
+			$line_item->set_quantity($quantity);
193
+			$line_item->set_total($line_item->unit_price() * $line_item->quantity());
194 194
 		}
195 195
 		return $line_item;
196 196
 	}
Please login to merge, or discard this patch.
core/domain/services/registration/CancelRegistrationService.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
admin_pages/registrations/templates/reg_admin_details_header.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
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 . '&nbsp;'; echo __( 'Registration # ', 'event_espresso' ) . $reg_nmbr['value']; echo '&nbsp;' . $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.'&nbsp;'; echo __('Registration # ', 'event_espresso').$reg_nmbr['value']; echo '&nbsp;'.$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
 
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 1 patch
Spacing   +581 added lines, -581 removed lines patch added patch discarded remove patch
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Registrations_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
61
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ));
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61
+		add_action('wp_loaded', array($this, 'wp_loaded'));
62 62
 	}
63 63
 
64 64
 
65 65
 
66 66
 	public function wp_loaded() {
67 67
 		// when adding a new registration...
68
-		if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) {
68
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') {
69 69
 			EE_System::do_not_cache();
70 70
 			if (
71
-				! isset( $this->_req_data[ 'processing_registration' ] )
72
-				|| absint( $this->_req_data[ 'processing_registration' ] ) !== 1
71
+				! isset($this->_req_data['processing_registration'])
72
+				|| absint($this->_req_data['processing_registration']) !== 1
73 73
 			) {
74 74
 				// and it's NOT the attendee information reg step
75 75
 				// force cookie expiration by setting time to last week
76
-				setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' );
76
+				setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/');
77 77
 				// and update the global
78
-				$_COOKIE[ 'ee_registration_added' ] = 0;
78
+				$_COOKIE['ee_registration_added'] = 0;
79 79
 			}
80 80
 		}
81 81
 	}
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 				'trash' => 'post.php'
110 110
 			);
111 111
 
112
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
112
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
113 113
 		//add filters so that the comment urls don't take users to a confusing 404 page
114
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
114
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
115 115
 	}
116 116
 
117 117
 
118
-	public function clear_comment_link( $link, $comment, $args ) {
118
+	public function clear_comment_link($link, $comment, $args) {
119 119
 		//gotta make sure this only happens on this route
120
-		$post_type = get_post_type( $comment->comment_post_ID);
121
-		if ( $post_type == 'espresso_attendees' )
120
+		$post_type = get_post_type($comment->comment_post_ID);
121
+		if ($post_type == 'espresso_attendees')
122 122
 			return '#commentsdiv';
123 123
 		return $link;
124 124
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 	protected function _ajax_hooks() {
128 128
 		//todo: all hooks for registrations ajax goes in here
129
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
129
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
130 130
 	}
131 131
 
132 132
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 				'add-attendee' => __('Add Contact', 'event_espresso'),
142 142
 				'edit' => __('Edit Contact', 'event_espresso'),
143 143
 				'report'=>  __("Event Registrations CSV Report", "event_espresso"),
144
-				'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
145
-				'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
144
+				'report_all' => __('All Registrations CSV Report', 'event_espresso'),
145
+				'contact_list_report' => __('Contact List Report', 'event_espresso'),
146 146
 				'contact_list_export'=>  __("Export Data", "event_espresso"),
147 147
 			),
148 148
 			'publishbox' => array(
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$this->_get_registration_status_array();
172 172
 
173
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
174
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
175
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
173
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
174
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
175
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
176 176
 
177 177
 		$this->_page_routes = array(
178 178
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 				'restore_registrations' => array(
207 207
 					'func' => '_trash_or_restore_registrations',
208
-					'args' => array( 'trash' => FALSE ),
208
+					'args' => array('trash' => FALSE),
209 209
 					'noheader' => TRUE,
210 210
 					'capability' => 'ee_delete_registrations'
211 211
 					),
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 						'filename' => 'registrations_overview_other'
439 439
 					)
440 440
                 ),
441
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
441
+				'help_tour' => array('Registration_Overview_Help_Tour'),
442 442
 				'qtips' => array('Registration_List_Table_Tips'),
443 443
 				'list_table' => 'EE_Registrations_List_Table',
444 444
 				'require_nonce' => FALSE
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 					'order' => 15,
451 451
 					'url' => isset($this->_req_data['_REG_ID'])
452 452
 						? add_query_arg(
453
-							array('_REG_ID' => $this->_req_data['_REG_ID'] ),
453
+							array('_REG_ID' => $this->_req_data['_REG_ID']),
454 454
 							$this->_current_page_view_url
455 455
 						)
456 456
 						: $this->_admin_base_url,
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
 						'filename' => 'registrations_details_registrant_details'
475 475
 					)
476 476
 				),
477
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
478
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
477
+				'help_tour' => array('Registration_Details_Help_Tour'),
478
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
479 479
 				'require_nonce' => FALSE
480 480
 			),
481 481
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 					'order' => 15,
500 500
 					'persistent' => FALSE
501 501
 				),
502
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
502
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
503 503
 				'require_nonce' => FALSE
504 504
 			),
505 505
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 					'label' => __('Edit Contact', 'event_espresso'),
509 509
 					'order' => 15,
510 510
 					'persistent' => FALSE,
511
-					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
511
+					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
512 512
 				),
513 513
 				'metaboxes' => array('attendee_editor_metaboxes'),
514 514
 				'require_nonce' => FALSE
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 						'filename' => 'registrations_contact_list_other'
539 539
 					)
540 540
                 ),
541
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
541
+				'help_tour' => array('Contact_List_Help_Tour'),
542 542
 				'metaboxes' => array(),
543 543
 				'require_nonce' => FALSE
544 544
 			),
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	protected function _add_screen_options() {}
558 558
 	protected function _add_feature_pointers() {}
559 559
 	public function admin_init() {
560
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
560
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
561 561
 	}
562 562
 	public function admin_notices() {}
563 563
 	public function admin_footer_scripts() {}
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	*		@return void
576 576
 	*/
577 577
 	private function _get_registration_status_array() {
578
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
578
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
579 579
 	}
580 580
 
581 581
 
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 	public function load_scripts_styles() {
599 599
 		//style
600 600
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
601
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
601
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
602 602
 		wp_enqueue_style('espresso_reg');
603 603
 
604 604
 		//script
605
-		wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
605
+		wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
606 606
 		wp_enqueue_script('espresso_reg');
607 607
 	}
608 608
 
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 	public function load_scripts_styles_edit_attendee() {
612 612
 		//stuff to only show up on our attendee edit details page.
613 613
 		$attendee_details_translations = array(
614
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
614
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
615 615
 			);
616
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
616
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
617 617
 		wp_enqueue_script('jquery-validate');
618 618
 	}
619 619
 
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
 		//styles
623 623
 		wp_enqueue_style('espresso-ui-theme');
624 624
 		//scripts
625
-		$this->_get_reg_custom_questions_form( $this->_registration->ID() );
626
-		$this->_reg_custom_questions_form->wp_enqueue_scripts( true );
625
+		$this->_get_reg_custom_questions_form($this->_registration->ID());
626
+		$this->_reg_custom_questions_form->wp_enqueue_scripts(true);
627 627
 	}
628 628
 
629 629
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
 	public function load_scripts_styles_contact_list() {
635 635
 		wp_deregister_style('espresso_reg');
636
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
636
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
637 637
 		wp_enqueue_style('espresso_att');
638 638
 	}
639 639
 
@@ -642,9 +642,9 @@  discard block
 block discarded – undo
642 642
 
643 643
 
644 644
 	public function load_scripts_styles_new_registration() {
645
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
645
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
646 646
 		wp_enqueue_script('ee-spco-for-admin');
647
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
647
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
648 648
 		EE_Form_Section_Proper::wp_enqueue_scripts();
649 649
 		EED_Ticket_Selector::load_tckt_slctr_assets();
650 650
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		//for notification related bulk actions we need to make sure only active messengers have an option.
672 672
 		EED_Messages::set_autoloaders();
673 673
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
674
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
674
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
675 675
 		$active_mts = $message_resource_manager->list_of_active_message_types();
676 676
 		//key= bulk_action_slug, value= message type.
677 677
 		$match_array = array(
@@ -684,23 +684,23 @@  discard block
 block discarded – undo
684 684
 
685 685
 		/** setup reg status bulk actions **/
686 686
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
687
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
687
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
688 688
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
689 689
 		}
690 690
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
691
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
691
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
692 692
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
693 693
 		}
694 694
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
695
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
695
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
696 696
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
697 697
 		}
698 698
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
699
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
699
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
700 700
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
701 701
 		}
702 702
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
703
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
703
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
704 704
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
705 705
 		}
706 706
 
@@ -709,29 +709,29 @@  discard block
 block discarded – undo
709 709
 				'slug' => 'all',
710 710
 				'label' => __('View All Registrations', 'event_espresso'),
711 711
 				'count' => 0,
712
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
712
+				'bulk_action' => array_merge($def_reg_status_actions, array(
713 713
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
714
-					) )
714
+					))
715 715
 				),
716 716
 			'month' => array(
717 717
 				'slug' => 'month',
718 718
 				'label' => __('This Month', 'event_espresso'),
719 719
 				'count' => 0,
720
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
720
+				'bulk_action' => array_merge($def_reg_status_actions, array(
721 721
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
722 722
 					))
723 723
 				),
724 724
 			'today' => array(
725 725
 				'slug' => 'today',
726
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
726
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
727 727
 				'count' => 0,
728
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
728
+				'bulk_action' => array_merge($def_reg_status_actions, array(
729 729
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
730 730
 					))
731 731
 				)
732 732
 			);
733 733
 
734
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
734
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
735 735
 			$this->_views['incomplete'] = array(
736 736
 				'slug' => 'incomplete',
737 737
 				'label' => __('Incomplete', 'event_espresso'),
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 				)
768 768
 			);
769 769
 
770
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
770
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
771 771
 			$this->_views['trash'] = array(
772 772
 				'slug' => 'trash',
773 773
 				'label' => __('Trash', 'event_espresso'),
@@ -806,18 +806,18 @@  discard block
 block discarded – undo
806 806
 				'desc' => __('View Transaction Invoice', 'event_espresso')
807 807
 				),
808 808
  			);
809
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
809
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
810 810
 			$fc_items['resend_registration'] = array(
811 811
 				'class' => 'dashicons dashicons-email-alt',
812 812
 				'desc' => __('Resend Registration Details', 'event_espresso')
813 813
 				);
814 814
 		} else {
815
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
815
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
816 816
 		}
817 817
 
818
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
819
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
820
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
818
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
819
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
820
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
821 821
 				$fc_items['view_related_messages'] = array(
822 822
 					'class' => $related_for_icon['css_class'],
823 823
 					'desc' => $related_for_icon['label'],
@@ -827,35 +827,35 @@  discard block
 block discarded – undo
827 827
 
828 828
 		$sc_items = array(
829 829
 			'approved_status' => array(
830
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
831
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
830
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
831
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
832 832
 				),
833 833
 			'pending_status' => array(
834
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
835
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
834
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
835
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
836 836
 				),
837 837
 			'wait_list' => array(
838
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
839
-				'desc'  => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' )
838
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list,
839
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence')
840 840
 			),
841 841
 			'incomplete_status' => array(
842
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
843
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
842
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
843
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
844 844
 			),
845 845
 			'not_approved' => array(
846
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
847
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
846
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
847
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
848 848
 				),
849 849
 			'declined_status' => array(
850
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
851
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
850
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
851
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
852 852
 				),
853 853
 			'cancelled_status' => array(
854
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
855
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
854
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
855
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
856 856
 				)
857 857
 			);
858
-		return array_merge( $fc_items, $sc_items );
858
+		return array_merge($fc_items, $sc_items);
859 859
 	}
860 860
 
861 861
 
@@ -869,45 +869,45 @@  discard block
 block discarded – undo
869 869
 	 */
870 870
 	protected function _registrations_overview_list_table() {
871 871
 		$this->_template_args['admin_page_header'] = '';
872
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : 0;
873
-		if ( $EVT_ID ) {
874
-			if ( EE_Registry::instance()->CAP->current_user_can(
872
+		$EVT_ID = ! empty($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : 0;
873
+		if ($EVT_ID) {
874
+			if (EE_Registry::instance()->CAP->current_user_can(
875 875
 				'ee_edit_registrations',
876 876
 				'espresso_registrations_new_registration',
877 877
 				$EVT_ID
878 878
 				)
879 879
 			) {
880
-				$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
880
+				$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
881 881
 					'new_registration',
882 882
 					'add-registrant',
883
-					array( 'event_id' => $EVT_ID ),
883
+					array('event_id' => $EVT_ID),
884 884
 					'add-new-h2'
885 885
 				);
886 886
 			}
887
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
888
-			if ( $event instanceof EE_Event ) {
887
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
888
+			if ($event instanceof EE_Event) {
889 889
 				$this->_template_args['admin_page_header'] = sprintf(
890
-					__( '%s Viewing registrations for the event: %s%s', 'event_espresso' ),
890
+					__('%s Viewing registrations for the event: %s%s', 'event_espresso'),
891 891
 					'<h3 style="line-height:1.5em;">',
892
-					'<br /><a href="' . EE_Admin_Page::add_query_args_and_nonce(
893
-						array( 'action' => 'edit', 'post' => $event->ID() ),
892
+					'<br /><a href="'.EE_Admin_Page::add_query_args_and_nonce(
893
+						array('action' => 'edit', 'post' => $event->ID()),
894 894
 						EVENTS_ADMIN_URL
895
-					) . '">&nbsp;' . $event->get( 'EVT_name' ) . '&nbsp;</a>&nbsp;',
895
+					).'">&nbsp;'.$event->get('EVT_name').'&nbsp;</a>&nbsp;',
896 896
 					'</h3>'
897 897
 				);
898 898
 			}
899
-			$DTT_ID = ! empty( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : 0;
900
-			$datetime = EEM_Datetime::instance()->get_one_by_ID( $DTT_ID );
901
-			if ( $datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '' ) {
902
-				$this->_template_args['admin_page_header'] = substr( $this->_template_args['admin_page_header'], 0, -5 );
899
+			$DTT_ID = ! empty($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : 0;
900
+			$datetime = EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
901
+			if ($datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '') {
902
+				$this->_template_args['admin_page_header'] = substr($this->_template_args['admin_page_header'], 0, -5);
903 903
 				$this->_template_args['admin_page_header'] .= ' &nbsp;<span class="drk-grey-text">';
904 904
 				$this->_template_args['admin_page_header'] .= '<span class="dashicons dashicons-calendar"></span>';
905 905
 				$this->_template_args['admin_page_header'] .= $datetime->name();
906
-				$this->_template_args['admin_page_header'] .= ' ( ' . $datetime->start_date() . ' )';
906
+				$this->_template_args['admin_page_header'] .= ' ( '.$datetime->start_date().' )';
907 907
 				$this->_template_args['admin_page_header'] .= '</span></h3>';
908 908
 			}
909 909
 		}
910
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
910
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
911 911
 		$this->display_admin_list_table_page_with_no_sidebar();
912 912
 	}
913 913
 
@@ -922,19 +922,19 @@  discard block
 block discarded – undo
922 922
 	 */
923 923
 	private function _set_registration_object() {
924 924
 		//get out if we've already set the object
925
-		if ( is_object( $this->_registration )) {
925
+		if (is_object($this->_registration)) {
926 926
 			return TRUE;
927 927
 		}
928 928
 
929 929
 	    $REG = EEM_Registration::instance();
930 930
 
931
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
931
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
932 932
 
933
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
933
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
934 934
 			return TRUE;
935 935
 		else {
936
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
937
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
936
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
937
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
938 938
 			$this->_registration = NULL;
939 939
 			return FALSE;
940 940
 		}
@@ -952,25 +952,25 @@  discard block
 block discarded – undo
952 952
 	 * @throws \EE_Error
953 953
 	 * @return mixed (int|array)  int = count || array of registration objects
954 954
 	 */
955
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
956
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
957
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
958
-		$DTT_ID = isset( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : null;
959
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
960
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
961
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
962
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE  : FALSE;
955
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
956
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
957
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
958
+		$DTT_ID = isset($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : null;
959
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
960
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
961
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
962
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE;
963 963
 		$start_date = FALSE;
964 964
 		$end_date = FALSE;
965 965
 		$_where = array();
966
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
967
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
966
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
967
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
968 968
 
969 969
 		//set orderby
970 970
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
971 971
 
972 972
 
973
-		switch ( $this->_req_data['orderby'] ) {
973
+		switch ($this->_req_data['orderby']) {
974 974
 			case '_REG_ID':
975 975
 				$orderby = 'REG_ID';
976 976
 				break;
@@ -990,30 +990,30 @@  discard block
 block discarded – undo
990 990
 				$orderby = 'REG_date';
991 991
 		}
992 992
 
993
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
994
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
995
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
993
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
994
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
995
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
996 996
 
997 997
 
998
-		$offset = ($current_page-1)*$per_page;
999
-		$limit = $count  ? NULL : array( $offset, $per_page );
998
+		$offset = ($current_page - 1) * $per_page;
999
+		$limit = $count ? NULL : array($offset, $per_page);
1000 1000
 
1001
-		if($EVT_ID){
1002
-			$_where['EVT_ID']=$EVT_ID;
1001
+		if ($EVT_ID) {
1002
+			$_where['EVT_ID'] = $EVT_ID;
1003 1003
 		}
1004
-		if($CAT_ID){
1004
+		if ($CAT_ID) {
1005 1005
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
1006 1006
 		}
1007 1007
 		//if DTT is included we filter by that datetime.
1008
-		if ( $DTT_ID ) {
1008
+		if ($DTT_ID) {
1009 1009
 			$_where['Ticket.Datetime.DTT_ID'] = $DTT_ID;
1010 1010
 		}
1011
-		if ( $incomplete ) {
1011
+		if ($incomplete) {
1012 1012
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
1013 1013
 		} else if ( ! $trash) {
1014
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
1014
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
1015 1015
 		}
1016
-		if($reg_status){
1016
+		if ($reg_status) {
1017 1017
 			$_where['STS_ID'] = $reg_status;
1018 1018
 		}
1019 1019
 
@@ -1025,103 +1025,103 @@  discard block
 block discarded – undo
1025 1025
 		$time_start = ' 00:00:00';
1026 1026
 		$time_end = ' 23:59:59';
1027 1027
 
1028
-		if($today_a || $today ){
1028
+		if ($today_a || $today) {
1029 1029
 			$curdate = date('Y-m-d', current_time('timestamp'));
1030
-			$_where['REG_date']= array('BETWEEN',
1030
+			$_where['REG_date'] = array('BETWEEN',
1031 1031
 				array(
1032
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
1033
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
1032
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
1033
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
1034 1034
 			));
1035
-		}elseif($this_month_a || $this_month){
1035
+		}elseif ($this_month_a || $this_month) {
1036 1036
 			$this_month_r = date('m', current_time('timestamp'));
1037
-			$days_this_month = date( 't', current_time('timestamp') );
1038
-			$_where['REG_date']= array('BETWEEN',
1037
+			$days_this_month = date('t', current_time('timestamp'));
1038
+			$_where['REG_date'] = array('BETWEEN',
1039 1039
 				array(
1040
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
1041
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' )
1040
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
1041
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s')
1042 1042
 			));
1043
-		}elseif($month_range){
1043
+		}elseif ($month_range) {
1044 1044
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1045
-			$month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : '';
1046
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1047
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
1048
-			$_where['REG_date']= array('BETWEEN',
1049
-				array(  EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month .  ' 23:59:59', 'Y-m-d H:i:s' ) ) );
1050
-		}elseif($start_date && $end_date){
1045
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : '';
1046
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1047
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
1048
+			$_where['REG_date'] = array('BETWEEN',
1049
+				array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s')));
1050
+		}elseif ($start_date && $end_date) {
1051 1051
 			throw new EE_Error("not yet supported");
1052
-		}elseif($start_date){
1052
+		}elseif ($start_date) {
1053 1053
 			throw new EE_Error("not yet supported");
1054
-		}elseif($end_date){
1054
+		}elseif ($end_date) {
1055 1055
 			throw new EE_Error("not yet supported");
1056 1056
 		}
1057 1057
 
1058
-		if ( ! empty( $this->_req_data['s'] ) ) {
1059
-			$sstr = '%' . $this->_req_data['s'] . '%';
1058
+		if ( ! empty($this->_req_data['s'])) {
1059
+			$sstr = '%'.$this->_req_data['s'].'%';
1060 1060
 			$_where['OR'] = array(
1061
-				'Event.EVT_name' => array( 'LIKE', $sstr),
1062
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
1063
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
1064
-				'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),
1065
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
1066
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
1067
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
1068
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
1069
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
1070
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
1071
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
1072
-				'REG_final_price' => array( 'LIKE', $sstr ),
1073
-				'REG_code' => array( 'LIKE', $sstr ),
1074
-				'REG_count' => array( 'LIKE' , $sstr ),
1075
-				'REG_group_size' => array( 'LIKE' , $sstr ),
1076
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
1077
-				'Ticket.TKT_description' => array( 'LIKE', $sstr ),
1078
-				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )
1061
+				'Event.EVT_name' => array('LIKE', $sstr),
1062
+				'Event.EVT_desc' => array('LIKE', $sstr),
1063
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
1064
+				'Attendee.ATT_full_name' => array('LIKE', $sstr),
1065
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
1066
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
1067
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
1068
+				'Attendee.ATT_email' => array('LIKE', $sstr),
1069
+				'Attendee.ATT_address' => array('LIKE', $sstr),
1070
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
1071
+				'Attendee.ATT_city' => array('LIKE', $sstr),
1072
+				'REG_final_price' => array('LIKE', $sstr),
1073
+				'REG_code' => array('LIKE', $sstr),
1074
+				'REG_count' => array('LIKE', $sstr),
1075
+				'REG_group_size' => array('LIKE', $sstr),
1076
+				'Ticket.TKT_name' => array('LIKE', $sstr),
1077
+				'Ticket.TKT_description' => array('LIKE', $sstr),
1078
+				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr)
1079 1079
 			);
1080 1080
 		}
1081 1081
 
1082 1082
 		//capability checks
1083
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
1083
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
1084 1084
 			$_where['AND'] = array(
1085 1085
 				'Event.EVT_wp_user' => get_current_user_id()
1086 1086
 				);
1087 1087
 		}
1088 1088
 
1089
-		if( $count ){
1090
-			if ( $trash ) {
1091
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
1092
-			} else if ( $incomplete ) {
1093
-				return EEM_Registration::instance()->count( array( $_where ));
1089
+		if ($count) {
1090
+			if ($trash) {
1091
+				return EEM_Registration::instance()->count_deleted(array($_where));
1092
+			} else if ($incomplete) {
1093
+				return EEM_Registration::instance()->count(array($_where));
1094 1094
 			} else {
1095
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
1095
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
1096 1096
 			}
1097 1097
 		} else {
1098 1098
 			//make sure we remove default where conditions cause all registrations matching query are returned
1099
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1100
-			if ( $per_page !== -1 ) {
1099
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1100
+			if ($per_page !== -1) {
1101 1101
 				$query_params['limit'] = $limit;
1102 1102
 			}
1103
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1103
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1104 1104
 
1105
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1105
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1106 1106
 				$first_registration = $registrations[0];
1107 1107
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1108 1108
 				$event_name = $first_registration->event_obj()->name();
1109
-				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1109
+				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1110 1110
 				// edit event link
1111
-				if ( $event_name != '' ) {
1112
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1113
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1114
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1111
+				if ($event_name != '') {
1112
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1113
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1114
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1115 1115
 				}
1116 1116
 
1117
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1118
-				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
1117
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1118
+				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
1119 1119
 
1120 1120
 				$this->_template_args['before_admin_page_content'] = '
1121 1121
 			<div id="admin-page-header">
1122
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1123
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1124
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1122
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1123
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1124
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1125 1125
 			</div>
1126 1126
 			';
1127 1127
 
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 
1160 1160
 		$this->_set_registration_object();
1161 1161
 
1162
-		if ( is_object( $this->_registration )) {
1162
+		if (is_object($this->_registration)) {
1163 1163
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1164 1164
 			$this->_session = $transaction->session_data();
1165 1165
 
@@ -1167,10 +1167,10 @@  discard block
 block discarded – undo
1167 1167
 
1168 1168
 
1169 1169
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1170
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1170
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1171 1171
 
1172
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->get_i18n_datetime( 'REG_date' );
1173
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1172
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date');
1173
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1174 1174
 
1175 1175
 			$this->_template_args['grand_total'] = $transaction->total();
1176 1176
 
@@ -1178,20 +1178,20 @@  discard block
 block discarded – undo
1178 1178
 			// link back to overview
1179 1179
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1180 1180
 			$this->_template_args['registration'] = $this->_registration;
1181
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1182
-			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) );
1183
-			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) );
1181
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1182
+			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php'));
1183
+			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php'));
1184 1184
 
1185 1185
 			//next and previous links
1186
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1187
-			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';
1188
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1189
-			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';
1186
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1187
+			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : '';
1188
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1189
+			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : '';
1190 1190
 
1191 1191
 			// grab header
1192
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1192
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1193 1193
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1194
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1194
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1195 1195
 
1196 1196
 		} else {
1197 1197
 
@@ -1210,17 +1210,17 @@  discard block
 block discarded – undo
1210 1210
 
1211 1211
 
1212 1212
 	protected function _registration_details_metaboxes() {
1213
-		do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this );
1213
+		do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1214 1214
 		$this->_set_registration_object();
1215 1215
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1216
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1217
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1218
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1219
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1216
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1217
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1218
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1219
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1220 1220
 		}
1221
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1222
-		if ( $this->_registration->group_size() > 1 ) {
1223
-			add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1221
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1222
+		if ($this->_registration->group_size() > 1) {
1223
+			add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high');
1224 1224
 		}
1225 1225
 	}
1226 1226
 
@@ -1262,25 +1262,25 @@  discard block
 block discarded – undo
1262 1262
 				'html_id'         => 'reg-status-change-form',
1263 1263
 				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1264 1264
 				'subsections'     => array(
1265
-					'return' => new EE_Hidden_Input( array(
1265
+					'return' => new EE_Hidden_Input(array(
1266 1266
 						'name'    => 'return',
1267 1267
 						'default' => 'view_registration'
1268
-					) ),
1269
-					'REG_ID' => new EE_Hidden_Input( array(
1268
+					)),
1269
+					'REG_ID' => new EE_Hidden_Input(array(
1270 1270
 						'name'    => 'REG_ID',
1271 1271
 						'default' => $this->_registration->ID()
1272
-					) ),
1272
+					)),
1273 1273
 					'current_status' => new EE_Form_Section_HTML(
1274 1274
 						EEH_HTML::tr(
1275 1275
 							EEH_HTML::th(
1276 1276
 								EEH_HTML::label(
1277
-									EEH_HTML::strong( __( 'Current Registration Status', 'event_espresso' ) )
1277
+									EEH_HTML::strong(__('Current Registration Status', 'event_espresso'))
1278 1278
 								)
1279
-							) .
1279
+							).
1280 1280
 							EEH_HTML::td(
1281 1281
 								EEH_HTML::strong(
1282 1282
 									$this->_registration->pretty_status(),
1283
-									'', 'status-' . $this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;'
1283
+									'', 'status-'.$this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;'
1284 1284
 								)
1285 1285
 							)
1286 1286
 						)
@@ -1288,22 +1288,22 @@  discard block
 block discarded – undo
1288 1288
 					'reg_status' => new EE_Select_Input(
1289 1289
 						$this->_get_reg_statuses(),
1290 1290
 						array(
1291
-							'html_label_text' => __( 'Change Registration Status to', 'event_espresso' ),
1291
+							'html_label_text' => __('Change Registration Status to', 'event_espresso'),
1292 1292
 							'default'         => $this->_registration->status_ID(),
1293 1293
 						)
1294 1294
 					),
1295 1295
 					'send_notifications' => new EE_Yes_No_Input(
1296 1296
 						array(
1297
-							'html_label_text' => __( 'Send Related Messages', 'event_espresso' ),
1297
+							'html_label_text' => __('Send Related Messages', 'event_espresso'),
1298 1298
 							'default'         => false,
1299
-							'html_help_text'  => __( 'If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso' ),
1299
+							'html_help_text'  => __('If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso'),
1300 1300
 						)
1301 1301
 					),
1302
-					'submit' => new EE_Submit_Input( array(
1302
+					'submit' => new EE_Submit_Input(array(
1303 1303
 						'html_class'      => 'button-primary',
1304 1304
 						'html_label_text' => '&nbsp;',
1305
-						'default'         => __( 'Update Registration Status', 'event_espresso' )
1306
-					) ),
1305
+						'default'         => __('Update Registration Status', 'event_espresso')
1306
+					)),
1307 1307
 				),
1308 1308
 			)
1309 1309
 		);
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 	 * Returns an array of all the buttons for the various statuses and switch status actions
1317 1317
 	 * @return string
1318 1318
 	 */
1319
-	protected function _get_current_reg_status_help_text( $STS_ID = '' ) {
1319
+	protected function _get_current_reg_status_help_text($STS_ID = '') {
1320 1320
 		//$reg_status_help_text = array(
1321 1321
 		//	'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ),
1322 1322
 		//	'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ),
@@ -1349,14 +1349,14 @@  discard block
 block discarded – undo
1349 1349
 	 */
1350 1350
 	protected function _get_reg_statuses() {
1351 1351
 		$reg_status_array = EEM_Registration::instance()->reg_status_array();
1352
-		unset ( $reg_status_array[ EEM_Registration::status_id_incomplete ] );
1352
+		unset ($reg_status_array[EEM_Registration::status_id_incomplete]);
1353 1353
 		// get current reg status
1354 1354
 		$current_status = $this->_registration->status_ID();
1355 1355
 		// is registration for free event? This will determine whether to display the pending payment option
1356
-		if ( $current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free() ) {
1357
-			unset( $reg_status_array[ EEM_Registration::status_id_pending_payment ] );
1356
+		if ($current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free()) {
1357
+			unset($reg_status_array[EEM_Registration::status_id_pending_payment]);
1358 1358
 		}
1359
-		return EEM_Status::instance()->localized_status( $reg_status_array, false, 'sentence' );
1359
+		return EEM_Status::instance()->localized_status($reg_status_array, false, 'sentence');
1360 1360
 	}
1361 1361
 
1362 1362
 
@@ -1369,15 +1369,15 @@  discard block
 block discarded – undo
1369 1369
 	 *
1370 1370
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1371 1371
 	 */
1372
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1373
-		if ( isset( $this->_req_data[ 'reg_status_change_form' ] ) ) {
1374
-			$REG_IDs = isset( $this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ] )
1375
-				? (array)$this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ]
1372
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1373
+		if (isset($this->_req_data['reg_status_change_form'])) {
1374
+			$REG_IDs = isset($this->_req_data['reg_status_change_form']['REG_ID'])
1375
+				? (array) $this->_req_data['reg_status_change_form']['REG_ID']
1376 1376
 				: array();
1377 1377
 		} else {
1378
-			$REG_IDs = isset( $this->_req_data[ '_REG_ID' ] ) ? (array)$this->_req_data[ '_REG_ID' ] : array();
1378
+			$REG_IDs = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1379 1379
 		}
1380
-		$success = $this->_set_registration_status( $REG_IDs, $status );
1380
+		$success = $this->_set_registration_status($REG_IDs, $status);
1381 1381
 		//notify?
1382 1382
 		if (
1383 1383
 			$success
@@ -1404,21 +1404,21 @@  discard block
 block discarded – undo
1404 1404
 	 * @param bool $status
1405 1405
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1406 1406
 	 */
1407
-	protected function _set_registration_status( $REG_IDs = array(), $status = false ) {
1407
+	protected function _set_registration_status($REG_IDs = array(), $status = false) {
1408 1408
 		$success = false;
1409 1409
 		// typecast $REG_IDs
1410
-		$REG_IDs = (array)$REG_IDs;
1411
-		if ( ! empty( $REG_IDs ) ) {
1410
+		$REG_IDs = (array) $REG_IDs;
1411
+		if ( ! empty($REG_IDs)) {
1412 1412
 			$success = true;
1413 1413
 			// set default status if none is passed
1414 1414
 			$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1415 1415
 			// sanitize $REG_IDs
1416
-			$REG_IDs = array_filter( $REG_IDs, 'absint' );
1416
+			$REG_IDs = array_filter($REG_IDs, 'absint');
1417 1417
 			//loop through REG_ID's and change status
1418
-			foreach ( $REG_IDs as $REG_ID ) {
1419
-				$registration = EEM_Registration::instance()->get_one_by_ID( $REG_ID );
1420
-				if ( $registration instanceof EE_Registration ) {
1421
-					$registration->set_status( $status );
1418
+			foreach ($REG_IDs as $REG_ID) {
1419
+				$registration = EEM_Registration::instance()->get_one_by_ID($REG_ID);
1420
+				if ($registration instanceof EE_Registration) {
1421
+					$registration->set_status($status);
1422 1422
 					$result = $registration->save();
1423 1423
 					// verifying explicit fails because update *may* just return 0 for 0 rows affected
1424 1424
 					$success = $result !== false ? $success : false;
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 		//reset _req_data['_REG_ID'] for any potential future messages notifications
1429 1429
 		$this->_req_data['_REG_ID'] = $REG_IDs;
1430 1430
 		//return $success and processed registrations
1431
-		return array( 'REG_ID' => $REG_IDs, 'success' => $success );
1431
+		return array('REG_ID' => $REG_IDs, 'success' => $success);
1432 1432
 	}
1433 1433
 
1434 1434
 
@@ -1440,49 +1440,49 @@  discard block
 block discarded – undo
1440 1440
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1441 1441
 	 * @return void
1442 1442
 	 */
1443
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1444
-		$result = ! empty( $STS_ID )
1445
-            ? $this->_set_registration_status_from_request( $STS_ID, $notify )
1446
-            : array( 'success' => false );
1447
-		$success = isset( $result['success'] ) && $result['success'];
1443
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1444
+		$result = ! empty($STS_ID)
1445
+            ? $this->_set_registration_status_from_request($STS_ID, $notify)
1446
+            : array('success' => false);
1447
+		$success = isset($result['success']) && $result['success'];
1448 1448
 		//setup success message
1449
-		if ( $success ) {
1450
-			if ( is_array( $result[ 'REG_ID' ] ) && count( $result[ 'REG_ID' ] ) === 1 ) {
1449
+		if ($success) {
1450
+			if (is_array($result['REG_ID']) && count($result['REG_ID']) === 1) {
1451 1451
 				$msg = sprintf(
1452
-					__( 'Registration status has been set to %s', 'event_espresso' ),
1453
-					EEH_Template::pretty_status( $STS_ID, false, 'lower' )
1452
+					__('Registration status has been set to %s', 'event_espresso'),
1453
+					EEH_Template::pretty_status($STS_ID, false, 'lower')
1454 1454
 				);
1455 1455
 			} else {
1456 1456
 				$msg = sprintf(
1457
-					__( 'Registrations have been set to %s.', 'event_espresso' ),
1458
-					EEH_Template::pretty_status( $STS_ID, false, 'lower' )
1457
+					__('Registrations have been set to %s.', 'event_espresso'),
1458
+					EEH_Template::pretty_status($STS_ID, false, 'lower')
1459 1459
 				);
1460 1460
 			}
1461
-			EE_Error::add_success( $msg );
1461
+			EE_Error::add_success($msg);
1462 1462
 		} else {
1463 1463
 			EE_Error::add_error(
1464
-				__( 'Something went wrong, and the status was not changed', 'event_espresso' ),
1464
+				__('Something went wrong, and the status was not changed', 'event_espresso'),
1465 1465
 				__FILE__, __LINE__, __FUNCTION__
1466 1466
 			);
1467 1467
 		}
1468
-		if ( isset( $this->_req_data[ 'return' ] ) && $this->_req_data[ 'return' ] == 'view_registration' ) {
1469
-			$route = array( 'action' => 'view_registration', '_REG_ID' => reset( $result[ 'REG_ID' ] ) );
1468
+		if (isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration') {
1469
+			$route = array('action' => 'view_registration', '_REG_ID' => reset($result['REG_ID']));
1470 1470
 		} else {
1471
-			$route = array( 'action' => 'default' );
1471
+			$route = array('action' => 'default');
1472 1472
 		}
1473 1473
 		//unset nonces
1474
-		foreach ( $this->_req_data as $ref => $value ) {
1475
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1476
-				unset( $this->_req_data[$ref] );
1474
+		foreach ($this->_req_data as $ref => $value) {
1475
+			if (strpos($ref, 'nonce') !== false) {
1476
+				unset($this->_req_data[$ref]);
1477 1477
 				continue;
1478 1478
 			}
1479 1479
 
1480
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1480
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1481 1481
 			$this->_req_data[$ref] = $value;
1482 1482
 		}
1483 1483
 		//merge request vars so that the reloaded list table contains any existing filter query params
1484
-		$route = array_merge( $this->_req_data, $route );
1485
-		$this->_redirect_after_action( $success, '', '', $route, true );
1484
+		$route = array_merge($this->_req_data, $route);
1485
+		$this->_redirect_after_action($success, '', '', $route, true);
1486 1486
 	}
1487 1487
 
1488 1488
 
@@ -1493,51 +1493,51 @@  discard block
 block discarded – undo
1493 1493
 	protected function _change_reg_status() {
1494 1494
 		$this->_req_data['return'] = 'view_registration';
1495 1495
 		//set notify based on whether the send notifications toggle is set or not
1496
-		$notify = ! empty( $this->_req_data['reg_status_change_form']['send_notifications'] );
1496
+		$notify = ! empty($this->_req_data['reg_status_change_form']['send_notifications']);
1497 1497
 		//$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1498
-		$this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ] = isset(
1499
-			$this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ]
1498
+		$this->_req_data['reg_status_change_form']['reg_status'] = isset(
1499
+			$this->_req_data['reg_status_change_form']['reg_status']
1500 1500
 		)
1501
-			? $this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ]
1501
+			? $this->_req_data['reg_status_change_form']['reg_status']
1502 1502
 			: '';
1503 1503
 
1504
-		switch ( $this->_req_data[ 'reg_status_change_form' ]['reg_status'] ) {
1504
+		switch ($this->_req_data['reg_status_change_form']['reg_status']) {
1505 1505
 
1506 1506
 			case EEM_Registration::status_id_approved :
1507
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1508
-				$this->approve_registration( $notify );
1507
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1508
+				$this->approve_registration($notify);
1509 1509
 				break;
1510 1510
 
1511 1511
 			case EEM_Registration::status_id_pending_payment :
1512
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1513
-				$this->pending_registration( $notify );
1512
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1513
+				$this->pending_registration($notify);
1514 1514
 				break;
1515 1515
 
1516 1516
 			case EEM_Registration::status_id_not_approved :
1517
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1518
-				$this->not_approve_registration( $notify );
1517
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1518
+				$this->not_approve_registration($notify);
1519 1519
 				break;
1520 1520
 
1521 1521
 			case EEM_Registration::status_id_declined :
1522
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1523
-				$this->decline_registration( $notify );
1522
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1523
+				$this->decline_registration($notify);
1524 1524
 				break;
1525 1525
 
1526 1526
 			case EEM_Registration::status_id_cancelled :
1527
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1528
-				$this->cancel_registration( $notify );
1527
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1528
+				$this->cancel_registration($notify);
1529 1529
 				break;
1530 1530
 
1531 1531
 			case EEM_Registration::status_id_wait_list :
1532
-			case EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' ) :
1533
-				$this->waitlist_registration( $notify );
1532
+			case EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence') :
1533
+				$this->waitlist_registration($notify);
1534 1534
 				break;
1535 1535
 
1536 1536
 			case EEM_Registration::status_id_incomplete :
1537 1537
 			default :
1538 1538
 				$result['success'] = false;
1539
-				unset( $this->_req_data['return'] );
1540
-				$this->_reg_status_change_return( '', false );
1539
+				unset($this->_req_data['return']);
1540
+				$this->_reg_status_change_return('', false);
1541 1541
 				break;
1542 1542
 		}
1543 1543
 	}
@@ -1551,8 +1551,8 @@  discard block
 block discarded – undo
1551 1551
 	 * @param bool $notify whether or not to notify the registrant about their approval.
1552 1552
 	 * @return void
1553 1553
 	 */
1554
-	protected function approve_registration( $notify = false ) {
1555
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1554
+	protected function approve_registration($notify = false) {
1555
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1556 1556
 	}
1557 1557
 
1558 1558
 
@@ -1564,8 +1564,8 @@  discard block
 block discarded – undo
1564 1564
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1565 1565
 	 * @return void
1566 1566
 	 */
1567
-	protected function decline_registration( $notify = false ) {
1568
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1567
+	protected function decline_registration($notify = false) {
1568
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1569 1569
 	}
1570 1570
 
1571 1571
 
@@ -1577,8 +1577,8 @@  discard block
 block discarded – undo
1577 1577
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1578 1578
 	 * @return void
1579 1579
 	 */
1580
-	protected function cancel_registration( $notify = false ) {
1581
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1580
+	protected function cancel_registration($notify = false) {
1581
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1582 1582
 	}
1583 1583
 
1584 1584
 
@@ -1590,8 +1590,8 @@  discard block
 block discarded – undo
1590 1590
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1591 1591
 	 * @return void
1592 1592
 	 */
1593
-	protected function not_approve_registration( $notify = false ) {
1594
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1593
+	protected function not_approve_registration($notify = false) {
1594
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1595 1595
 	}
1596 1596
 
1597 1597
 
@@ -1603,8 +1603,8 @@  discard block
 block discarded – undo
1603 1603
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1604 1604
 	 * @return void
1605 1605
 	 */
1606
-	protected function pending_registration( $notify = false ) {
1607
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1606
+	protected function pending_registration($notify = false) {
1607
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1608 1608
 	}
1609 1609
 
1610 1610
 
@@ -1616,8 +1616,8 @@  discard block
 block discarded – undo
1616 1616
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1617 1617
 	 * @return void
1618 1618
 	 */
1619
-	protected function waitlist_registration( $notify = false ) {
1620
-		$this->_reg_status_change_return( EEM_Registration::status_id_wait_list, $notify );
1619
+	protected function waitlist_registration($notify = false) {
1620
+		$this->_reg_status_change_return(EEM_Registration::status_id_wait_list, $notify);
1621 1621
 	}
1622 1622
 
1623 1623
 
@@ -1631,14 +1631,14 @@  discard block
 block discarded – undo
1631 1631
 	public function _reg_details_meta_box() {
1632 1632
 		EEH_Autoloader::register_line_item_display_autoloaders();
1633 1633
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1634
-		EE_Registry::instance()->load_helper( 'Line_Item' );
1634
+		EE_Registry::instance()->load_helper('Line_Item');
1635 1635
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1636 1636
 		$this->_session = $transaction->session_data();
1637 1637
 
1638 1638
 		$filters = new EE_Line_Item_Filter_Collection();
1639 1639
 		//$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1640
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1641
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1640
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1641
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1642 1642
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1643 1643
 		$line_item_display = new EE_Line_Item_Display(
1644 1644
 			'reg_admin_table',
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
 		);
1647 1647
 		$this->_template_args['line_item_table'] = $line_item_display->display_line_item(
1648 1648
 			$filtered_line_item_tree,
1649
-			array( 'EE_Registration' => $this->_registration )
1649
+			array('EE_Registration' => $this->_registration)
1650 1650
 		);
1651 1651
 		$attendee = $this->_registration->attendee();
1652 1652
 
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 				'espresso_transactions_view_transaction'
1657 1657
 			)
1658 1658
 		) {
1659
-			$this->_template_args[ 'view_transaction_button' ] =  EEH_Template::get_button_or_link(
1659
+			$this->_template_args['view_transaction_button'] = EEH_Template::get_button_or_link(
1660 1660
 				EE_Admin_Page::add_query_args_and_nonce(
1661 1661
 					array(
1662 1662
 						'action' => 'view_transaction',
@@ -1664,12 +1664,12 @@  discard block
 block discarded – undo
1664 1664
 					),
1665 1665
 					TXN_ADMIN_URL
1666 1666
 				),
1667
-				esc_html__( ' View Transaction' ),
1667
+				esc_html__(' View Transaction'),
1668 1668
 				'button secondary-button right',
1669 1669
 				'dashicons dashicons-cart'
1670 1670
 			);
1671 1671
 		} else {
1672
-			$this->_template_args[ 'view_transaction_button' ] = '';
1672
+			$this->_template_args['view_transaction_button'] = '';
1673 1673
 		}
1674 1674
 
1675 1675
 		if (
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 				'espresso_registrations_resend_registration'
1680 1680
 			)
1681 1681
 		) {
1682
-			$this->_template_args[ 'resend_registration_button' ] = EEH_Template::get_button_or_link(
1682
+			$this->_template_args['resend_registration_button'] = EEH_Template::get_button_or_link(
1683 1683
 				EE_Admin_Page::add_query_args_and_nonce(
1684 1684
 					array(
1685 1685
 						'action' 		=> 'resend_registration',
@@ -1688,55 +1688,55 @@  discard block
 block discarded – undo
1688 1688
 					),
1689 1689
 					REG_ADMIN_URL
1690 1690
 				),
1691
-				esc_html__( ' Resend Registration' ),
1691
+				esc_html__(' Resend Registration'),
1692 1692
 				'button secondary-button right',
1693 1693
 				'dashicons dashicons-email-alt'
1694 1694
 			);
1695 1695
 		} else {
1696
-			$this->_template_args[ 'resend_registration_button' ] = '';
1696
+			$this->_template_args['resend_registration_button'] = '';
1697 1697
 		}
1698 1698
 
1699 1699
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1700
-		$payment = $transaction->get_first_related( 'Payment' );
1700
+		$payment = $transaction->get_first_related('Payment');
1701 1701
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1702
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1702
+		$payment_method = $payment->get_first_related('Payment_Method');
1703 1703
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1704 1704
 
1705 1705
 		$reg_details = array(
1706 1706
 			'payment_method' => $payment_method->name(),
1707 1707
 			'response_msg' => $payment->gateway_response(),
1708
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1708
+			'registration_id' => $this->_registration->get('REG_code'),
1709 1709
 			'registration_session' => $this->_registration->session_ID(),
1710
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1711
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1710
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1711
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1712 1712
 		);
1713 1713
 
1714 1714
 
1715
-		if ( isset( $reg_details['registration_id'] )) {
1715
+		if (isset($reg_details['registration_id'])) {
1716 1716
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1717
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1717
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1718 1718
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1719 1719
 		}
1720 1720
 
1721
-		if ( isset( $reg_details['payment_method'] ) ) {
1721
+		if (isset($reg_details['payment_method'])) {
1722 1722
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1723
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1723
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1724 1724
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1725 1725
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1726
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1726
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1727 1727
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1728 1728
 		}
1729 1729
 
1730 1730
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1731
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1731
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1732 1732
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1733 1733
 
1734 1734
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1735
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1735
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1736 1736
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1737 1737
 
1738 1738
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1739
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1739
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1740 1740
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1741 1741
 
1742 1742
 		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(
@@ -1749,8 +1749,8 @@  discard block
 block discarded – undo
1749 1749
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1750 1750
 		$this->_template_args['event_id'] = $this->_registration->event_ID();
1751 1751
 
1752
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1753
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1752
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1753
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1754 1754
 
1755 1755
 	}
1756 1756
 
@@ -1764,14 +1764,14 @@  discard block
 block discarded – undo
1764 1764
 	*/
1765 1765
 	public function _reg_questions_meta_box() {
1766 1766
 		//allow someone to override this method entirely
1767
-		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
1768
-			$form = $this->_get_reg_custom_questions_form( $this->_registration->ID() );
1769
-			$this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : '';
1767
+		if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) {
1768
+			$form = $this->_get_reg_custom_questions_form($this->_registration->ID());
1769
+			$this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : '';
1770 1770
 			$this->_template_args['reg_questions_form_action'] = 'edit_registration';
1771 1771
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1772 1772
 
1773
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1774
-			echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1773
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1774
+			echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1775 1775
 		}
1776 1776
 	}
1777 1777
 
@@ -1785,12 +1785,12 @@  discard block
 block discarded – undo
1785 1785
 	 * @param        string $output
1786 1786
 	 * @return        string
1787 1787
 	 */
1788
-	public function form_before_question_group( $output ) {
1788
+	public function form_before_question_group($output) {
1789 1789
 		EE_Error::doing_it_wrong(
1790
-			__CLASS__ . '::' . __FUNCTION__,
1791
-			__( 'This method would have been protected but was used on a filter callback'
1790
+			__CLASS__.'::'.__FUNCTION__,
1791
+			__('This method would have been protected but was used on a filter callback'
1792 1792
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1793
-				'event_espresso' ),
1793
+				'event_espresso'),
1794 1794
 			'4.8.32.rc.000'
1795 1795
 		);
1796 1796
 		return '
@@ -1809,20 +1809,20 @@  discard block
 block discarded – undo
1809 1809
 	 * @param        string $output
1810 1810
 	 * @return        string
1811 1811
 	 */
1812
-	public function form_after_question_group( $output ) {
1812
+	public function form_after_question_group($output) {
1813 1813
 		EE_Error::doing_it_wrong(
1814
-			__CLASS__ . '::' . __FUNCTION__,
1815
-			__( 'This method would have been protected but was used on a filter callback'
1814
+			__CLASS__.'::'.__FUNCTION__,
1815
+			__('This method would have been protected but was used on a filter callback'
1816 1816
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1817
-				'event_espresso' ),
1817
+				'event_espresso'),
1818 1818
 			'4.8.32.rc.000'
1819 1819
 		);
1820 1820
 		return  '
1821 1821
 			<tr class="hide-if-no-js">
1822 1822
 				<th> </th>
1823 1823
 				<td class="reg-admin-edit-attendee-question-td">
1824
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1825
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1824
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1825
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1826 1826
 						<div class="dashicons dashicons-edit"></div>
1827 1827
 					</a>
1828 1828
 				</td>
@@ -1842,18 +1842,18 @@  discard block
 block discarded – undo
1842 1842
 	 * @param        string $label
1843 1843
 	 * @return        string
1844 1844
 	 */
1845
-	public function form_form_field_label_wrap( $label ) {
1845
+	public function form_form_field_label_wrap($label) {
1846 1846
 		EE_Error::doing_it_wrong(
1847
-			__CLASS__ . '::' . __FUNCTION__,
1848
-			__( 'This method would have been protected but was used on a filter callback'
1847
+			__CLASS__.'::'.__FUNCTION__,
1848
+			__('This method would have been protected but was used on a filter callback'
1849 1849
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1850
-				'event_espresso' ),
1850
+				'event_espresso'),
1851 1851
 			'4.8.32.rc.000'
1852 1852
 		);
1853 1853
 		return '
1854 1854
 			<tr>
1855 1855
 				<th>
1856
-					' . $label  . '
1856
+					' . $label.'
1857 1857
 				</th>';
1858 1858
 	}
1859 1859
 
@@ -1867,17 +1867,17 @@  discard block
 block discarded – undo
1867 1867
 	 * @param        string $input
1868 1868
 	 * @return        string
1869 1869
 	 */
1870
-	public function form_form_field_input__wrap( $input ) {
1870
+	public function form_form_field_input__wrap($input) {
1871 1871
 		EE_Error::doing_it_wrong(
1872
-			__CLASS__ . '::' . __FUNCTION__,
1873
-			__( 'This method would have been protected but was used on a filter callback'
1872
+			__CLASS__.'::'.__FUNCTION__,
1873
+			__('This method would have been protected but was used on a filter callback'
1874 1874
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1875
-				'event_espresso' ),
1875
+				'event_espresso'),
1876 1876
 			'4.8.32.rc.000'
1877 1877
 		);
1878 1878
 		return '
1879 1879
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1880
-					' . $input . '
1880
+					' . $input.'
1881 1881
 				</td>
1882 1882
 			</tr>';
1883 1883
 	}
@@ -1891,14 +1891,14 @@  discard block
 block discarded – undo
1891 1891
 	 * @return void
1892 1892
 	 */
1893 1893
 	protected function _update_attendee_registration_form() {
1894
-		do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this );
1895
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
1896
-			$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1897
-			$success = $this->_save_reg_custom_questions_form( $REG_ID );
1898
-			if( $success ) {
1894
+		do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
1895
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
1896
+			$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1897
+			$success = $this->_save_reg_custom_questions_form($REG_ID);
1898
+			if ($success) {
1899 1899
 				$what = __('Registration Form', 'event_espresso');
1900
-				$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1901
-				$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1900
+				$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1901
+				$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1902 1902
 			}
1903 1903
 		}
1904 1904
 	}
@@ -1909,11 +1909,11 @@  discard block
 block discarded – undo
1909 1909
 	 * @param int $REG_ID
1910 1910
 	 * @return EE_Registration_Custom_Questions_Form
1911 1911
 	 */
1912
-	protected function _get_reg_custom_questions_form( $REG_ID ) {
1913
-		if( ! $this->_reg_custom_questions_form ) {
1914
-			require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' );
1915
-			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) );
1916
-			$this->_reg_custom_questions_form->_construct_finalize( null, null );
1912
+	protected function _get_reg_custom_questions_form($REG_ID) {
1913
+		if ( ! $this->_reg_custom_questions_form) {
1914
+			require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php');
1915
+			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID));
1916
+			$this->_reg_custom_questions_form->_construct_finalize(null, null);
1917 1917
 		}
1918 1918
 		return $this->_reg_custom_questions_form;
1919 1919
 	}
@@ -1926,17 +1926,17 @@  discard block
 block discarded – undo
1926 1926
 	 * @param bool $REG_ID
1927 1927
 	 * @return bool
1928 1928
 	 */
1929
-	private function _save_reg_custom_questions_form( $REG_ID = FALSE ) {
1929
+	private function _save_reg_custom_questions_form($REG_ID = FALSE) {
1930 1930
 
1931 1931
 		if ( ! $REG_ID) {
1932
-			EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1932
+			EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1933 1933
 		}
1934
-		$form = $this->_get_reg_custom_questions_form( $REG_ID );
1935
-		$form->receive_form_submission( $this->_req_data );
1934
+		$form = $this->_get_reg_custom_questions_form($REG_ID);
1935
+		$form->receive_form_submission($this->_req_data);
1936 1936
 		$success = false;
1937
-		if( $form->is_valid() ) {
1938
-			foreach( $form->subforms() as $question_group_id => $question_group_form ) {
1939
-				foreach( $question_group_form->inputs() as $question_id => $input ) {
1937
+		if ($form->is_valid()) {
1938
+			foreach ($form->subforms() as $question_group_id => $question_group_form) {
1939
+				foreach ($question_group_form->inputs() as $question_id => $input) {
1940 1940
 					$where_conditions = array(
1941 1941
 							'QST_ID' => $question_id,
1942 1942
 							'REG_ID' => $REG_ID
@@ -1944,19 +1944,19 @@  discard block
 block discarded – undo
1944 1944
 					$possibly_new_values = array(
1945 1945
 							'ANS_value' => $input->normalized_value()
1946 1946
 						);
1947
-					$answer = EEM_Answer::instance()->get_one( array( $where_conditions ) );
1948
-					if( $answer instanceof EE_Answer ) {
1949
-						$success = $answer->save( $possibly_new_values );
1947
+					$answer = EEM_Answer::instance()->get_one(array($where_conditions));
1948
+					if ($answer instanceof EE_Answer) {
1949
+						$success = $answer->save($possibly_new_values);
1950 1950
 					} else {
1951 1951
 						//insert it then
1952
-						$cols_n_vals = array_merge( $where_conditions, $possibly_new_values );
1953
-						$answer = EE_Answer::new_instance( $cols_n_vals );
1952
+						$cols_n_vals = array_merge($where_conditions, $possibly_new_values);
1953
+						$answer = EE_Answer::new_instance($cols_n_vals);
1954 1954
 						$success = $answer->save();
1955 1955
 					}
1956 1956
 				}
1957 1957
 			}
1958 1958
 		} else {
1959
-			EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ );
1959
+			EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
1960 1960
 		}
1961 1961
 		return $success;
1962 1962
 	}
@@ -1974,31 +1974,31 @@  discard block
 block discarded – undo
1974 1974
 		$registrations = $REG->get_all(array(
1975 1975
 			array(
1976 1976
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1977
-				'REG_ID'=>array('!=',$this->_registration->ID())
1977
+				'REG_ID'=>array('!=', $this->_registration->ID())
1978 1978
 			),
1979 1979
 			'force_join'=>array('Attendee')));
1980 1980
 
1981 1981
 		$this->_template_args['attendees'] = array();
1982 1982
 		$this->_template_args['attendee_notice'] = '';
1983
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1984
-			EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1983
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1984
+			EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1985 1985
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1986 1986
 		} else {
1987 1987
 
1988 1988
 			$att_nmbr = 1;
1989
-			foreach ( $registrations as $registration ) {
1989
+			foreach ($registrations as $registration) {
1990 1990
 				/* @var $registration EE_Registration */
1991 1991
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1992
-				$this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID();
1993
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1994
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1995
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1996
-				$this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1992
+				$this->_template_args['attendees'][$att_nmbr]['STS_ID'] = $registration->status_ID();
1993
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1994
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1995
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1996
+				$this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1997 1997
 
1998
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1998
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1999 1999
 
2000
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
2001
-				$this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name();
2000
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
2001
+				$this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name();
2002 2002
 
2003 2003
 				$att_nmbr++;
2004 2004
 			}
@@ -2008,8 +2008,8 @@  discard block
 block discarded – undo
2008 2008
 
2009 2009
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
2010 2010
 		}
2011
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
2012
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2011
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
2012
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2013 2013
 
2014 2014
 	}
2015 2015
 
@@ -2030,14 +2030,14 @@  discard block
 block discarded – undo
2030 2030
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
2031 2031
 
2032 2032
 		//now let's determine if this is not the primary registration.  If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show create button or not)
2033
-		if ( ! $this->_registration->is_primary_registrant() ) {
2033
+		if ( ! $this->_registration->is_primary_registrant()) {
2034 2034
 
2035 2035
 			$primary_registration = $this->_registration->get_primary_registration();
2036 2036
 			$primary_attendee = $primary_registration instanceof EE_Registration
2037 2037
 				? $primary_registration->attendee()
2038 2038
 				: null;
2039 2039
 
2040
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
2040
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
2041 2041
 				//in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg.
2042 2042
 				$primary_registration = NULL;
2043 2043
 			}
@@ -2046,27 +2046,27 @@  discard block
 block discarded – undo
2046 2046
 		}
2047 2047
 
2048 2048
 		$this->_template_args['ATT_ID'] = $attendee->ID();
2049
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
2050
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
2051
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
2049
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
2050
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
2051
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
2052 2052
 		$this->_template_args['phone'] = $attendee->phone();
2053 2053
 
2054
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
2054
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
2055 2055
 
2056 2056
 
2057 2057
 		//edit link
2058
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
2058
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
2059 2059
 		$this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso');
2060 2060
 
2061 2061
 		//create link
2062
-		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee',  '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): '';
2062
+		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : '';
2063 2063
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
2064 2064
 
2065 2065
 		$this->_template_args['att_check'] = $att_check;
2066 2066
 
2067 2067
 
2068
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
2069
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2068
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
2069
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2070 2070
 	}
2071 2071
 
2072 2072
 
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
 	 * @access protected
2080 2080
 	 * @return void
2081 2081
 	 */
2082
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
2082
+	protected function _trash_or_restore_registrations($trash = TRUE) {
2083 2083
 		$REGM = EEM_Registration::instance();
2084 2084
 
2085 2085
 		$success = 1;
@@ -2089,26 +2089,26 @@  discard block
 block discarded – undo
2089 2089
 		$dtts = array();
2090 2090
 
2091 2091
 		//if empty _REG_ID then get out because there's nothing to do
2092
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
2092
+		if (empty($this->_req_data['_REG_ID'])) {
2093 2093
 			$msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso');
2094
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
2095
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
2094
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
2095
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
2096 2096
 		}
2097 2097
 
2098 2098
 		//Checkboxes
2099
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2099
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2100 2100
 			// if array has more than one element than success message should be plural
2101
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
2101
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
2102 2102
 			// cycle thru checkboxes
2103
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
2103
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
2104 2104
 				/** @var EE_Registration $REG */
2105
-				$REG = $REGM->get_one_by_ID( $REG_ID);
2105
+				$REG = $REGM->get_one_by_ID($REG_ID);
2106 2106
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
2107
-				if ( $payment_count > 0 ) {
2108
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
2107
+				if ($payment_count > 0) {
2108
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
2109 2109
 					$error = 1;
2110 2110
 					$success = 0;
2111
-					EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ );
2111
+					EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__);
2112 2112
 					continue; //can't trash this registration because it has payments.
2113 2113
 				}
2114 2114
 				$ticket = $REG->get_first_related('Ticket');
@@ -2117,7 +2117,7 @@  discard block
 block discarded – undo
2117 2117
 				$dtts = array_merge($dtts, $dtt);
2118 2118
 
2119 2119
 				$updated = $trash ? $REG->delete() : $REG->restore();
2120
-				if ( !$updated ) {
2120
+				if ( ! $updated) {
2121 2121
 					$success = 0;
2122 2122
 				} else {
2123 2123
 					$success = 2;
@@ -2132,7 +2132,7 @@  discard block
 block discarded – undo
2132 2132
 			$tickets[$ticket->ID()] = $ticket;
2133 2133
 			$dtts = $ticket->get_many_related('Datetime');
2134 2134
 			$updated = $trash ? $REG->delete() : $REG->restore();
2135
-			if ( ! $updated ) {
2135
+			if ( ! $updated) {
2136 2136
 				$success = 0;
2137 2137
 			}
2138 2138
 
@@ -2142,10 +2142,10 @@  discard block
 block discarded – undo
2142 2142
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
2143 2143
 		EEM_Datetime::instance()->update_sold($dtts);
2144 2144
 
2145
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
2146
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2145
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
2146
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2147 2147
 		$overwrite_msgs = $error ? TRUE : FALSE;
2148
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
2148
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
2149 2149
 	}
2150 2150
 
2151 2151
 
@@ -2169,16 +2169,16 @@  discard block
 block discarded – undo
2169 2169
 		$success = 1;
2170 2170
 
2171 2171
 		//Checkboxes
2172
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2172
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2173 2173
 			// if array has more than one element than success message should be plural
2174
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
2174
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
2175 2175
 			// cycle thru checkboxes
2176
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
2176
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
2177 2177
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
2178
-				if ( ! $REG instanceof EE_Registration )
2178
+				if ( ! $REG instanceof EE_Registration)
2179 2179
 					continue;
2180 2180
 				$deleted = $this->_delete_registration($REG);
2181
-				if ( !$deleted ) {
2181
+				if ( ! $deleted) {
2182 2182
 					$success = 0;
2183 2183
 				}
2184 2184
 			}
@@ -2188,15 +2188,15 @@  discard block
 block discarded – undo
2188 2188
 			$REG_ID = $this->_req_data['_REG_ID'];
2189 2189
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
2190 2190
 			$deleted = $this->_delete_registration($REG);
2191
-			if ( ! $deleted ) {
2191
+			if ( ! $deleted) {
2192 2192
 				$success = 0;
2193 2193
 			}
2194 2194
 
2195 2195
 		}
2196 2196
 
2197
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
2198
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
2199
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
2197
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
2198
+		$action_desc = __('permanently deleted.', 'event_espresso');
2199
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
2200 2200
 	}
2201 2201
 
2202 2202
 
@@ -2208,31 +2208,31 @@  discard block
 block discarded – undo
2208 2208
 	 * @param  EE_Registration $REG registration to be deleted permenantly
2209 2209
 	 * @return boolean              true = successful deletion, false = fail.
2210 2210
 	 */
2211
-	protected function _delete_registration( EE_Registration $REG ) {
2211
+	protected function _delete_registration(EE_Registration $REG) {
2212 2212
 		//first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed.
2213 2213
 		$TXN = $REG->get_first_related('Transaction');
2214 2214
 		$REGS = $TXN->get_many_related('Registration');
2215 2215
 
2216 2216
 		$all_trashed = TRUE;
2217
-		foreach ( $REGS as $registration ) {
2218
-			if ( ! $registration->get('REG_deleted') )
2217
+		foreach ($REGS as $registration) {
2218
+			if ( ! $registration->get('REG_deleted'))
2219 2219
 				$all_trashed = FALSE;
2220 2220
 		}
2221 2221
 
2222
-		if ( ! $all_trashed ) {
2223
-			EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2222
+		if ( ! $all_trashed) {
2223
+			EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2224 2224
 			return false;
2225 2225
 		}
2226 2226
 
2227 2227
 		//k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one).
2228
-		foreach ( $REGS as $registration ) {
2228
+		foreach ($REGS as $registration) {
2229 2229
 
2230 2230
 			//delete related answers
2231 2231
 			$registration->delete_related_permanently('Answer');
2232 2232
 
2233 2233
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
2234 2234
 			$attendee = $registration->get_first_related('Attendee');
2235
-			if ( $attendee instanceof EE_Attendee ) {
2235
+			if ($attendee instanceof EE_Attendee) {
2236 2236
 				$registration->_remove_relation_to($attendee, 'Attendee');
2237 2237
 			}
2238 2238
 
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
 			//now delete permanently the checkins related to this registration.
2243 2243
 			$registration->delete_related_permanently('Checkin');
2244 2244
 
2245
-			if ( $registration->ID() === $REG->ID() )
2245
+			if ($registration->ID() === $REG->ID())
2246 2246
 				continue; //we don't want to delete permanently the existing registration just yet.
2247 2247
 
2248 2248
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -2279,35 +2279,35 @@  discard block
 block discarded – undo
2279 2279
 	 * @return void
2280 2280
 	 */
2281 2281
 	public function new_registration() {
2282
-		if ( ! $this->_set_reg_event() ) {
2283
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
2282
+		if ( ! $this->_set_reg_event()) {
2283
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
2284 2284
 		}
2285
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2285
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2286 2286
 		// gotta start with a clean slate if we're not coming here via ajax
2287 2287
 		if (
2288
-			! defined('DOING_AJAX' )
2289
-			&& ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) )
2288
+			! defined('DOING_AJAX')
2289
+			&& ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))
2290 2290
 		) {
2291
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2291
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2292 2292
 		}
2293 2293
 
2294
-		$this->_template_args['event_name'] = '' ;
2294
+		$this->_template_args['event_name'] = '';
2295 2295
 		// event name
2296
-		if ( $this->_reg_event ) {
2296
+		if ($this->_reg_event) {
2297 2297
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2298
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2299
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2300
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2298
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2299
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2300
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2301 2301
 		}
2302 2302
 
2303 2303
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2304 2304
 
2305
-		if ( defined('DOING_AJAX' ) ) {
2305
+		if (defined('DOING_AJAX')) {
2306 2306
 			$this->_return_json();
2307 2307
 		}
2308 2308
 		// grab header
2309
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2310
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2309
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2310
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2311 2311
 
2312 2312
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2313 2313
 		// the details template wrapper
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
 	 * @return string html
2325 2325
 	 */
2326 2326
 	protected function _get_registration_step_content() {
2327
-		if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) {
2327
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2328 2328
 			$warning_msg = sprintf(
2329 2329
 				__(
2330 2330
 					'%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s',
@@ -2340,7 +2340,7 @@  discard block
 block discarded – undo
2340 2340
 				'</b>'
2341 2341
 			);
2342 2342
 			return '
2343
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2343
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2344 2344
 	<script >
2345 2345
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2346 2346
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2375,16 +2375,16 @@  discard block
 block discarded – undo
2375 2375
 		$cart = EE_Registry::instance()->SSN->cart();
2376 2376
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2377 2377
 
2378
-		switch ( $step ) {
2378
+		switch ($step) {
2379 2379
 			case 'ticket' :
2380 2380
 				$hidden_fields['processing_registration']['value'] = 1;
2381 2381
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2382
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2382
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2383 2383
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2384 2384
 				$template_args['show_notification_toggle'] = FALSE;
2385 2385
 				break;
2386 2386
 			case 'questions' :
2387
-				$hidden_fields[ 'processing_registration' ][ 'value' ] = 2;
2387
+				$hidden_fields['processing_registration']['value'] = 2;
2388 2388
 				$template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso');
2389 2389
 				//in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run.
2390 2390
 				$template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin();
@@ -2393,10 +2393,10 @@  discard block
 block discarded – undo
2393 2393
 				break;
2394 2394
 		}
2395 2395
 
2396
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2396
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2397 2397
 
2398 2398
 		return EEH_Template::display_template(
2399
-			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2399
+			REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2400 2400
 		);
2401 2401
 	}
2402 2402
 
@@ -2411,11 +2411,11 @@  discard block
 block discarded – undo
2411 2411
 	*		@return boolean
2412 2412
 	*/
2413 2413
 	private function _set_reg_event() {
2414
-		if ( is_object( $this->_reg_event )) {
2414
+		if (is_object($this->_reg_event)) {
2415 2415
 			return TRUE;
2416 2416
 		}
2417
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2418
-		if ( ! $EVT_ID ) {
2417
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2418
+		if ( ! $EVT_ID) {
2419 2419
 			return FALSE;
2420 2420
 		}
2421 2421
 
@@ -2436,82 +2436,82 @@  discard block
 block discarded – undo
2436 2436
 	public function process_reg_step() {
2437 2437
 		EE_System::do_not_cache();
2438 2438
 		$this->_set_reg_event();
2439
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2439
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2440 2440
 
2441 2441
 		//what step are we on?
2442 2442
 		$cart = EE_Registry::instance()->SSN->cart();
2443 2443
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2444 2444
 
2445 2445
 		//if doing ajax then we need to verify the nonce
2446
-		if ( defined( 'DOING_AJAX' ) ) {
2447
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2448
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2446
+		if (defined('DOING_AJAX')) {
2447
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2448
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2449 2449
 		}
2450 2450
 
2451
-		switch ( $step ) {
2451
+		switch ($step) {
2452 2452
 
2453 2453
 			case 'ticket' :
2454 2454
 				//process ticket selection
2455 2455
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2456
-				if ( $success ) {
2457
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2456
+				if ($success) {
2457
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2458 2458
 				} else {
2459 2459
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2460 2460
 				}
2461
-				if ( defined('DOING_AJAX') ) {
2461
+				if (defined('DOING_AJAX')) {
2462 2462
 					$this->new_registration(); //display next step
2463 2463
 				} else {
2464 2464
 					$query_args['action'] = 'new_registration';
2465 2465
 					$query_args['processing_registration'] = 1;
2466 2466
 					$query_args['event_id'] = $this->_reg_event->ID();
2467
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2467
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2468 2468
 				}
2469 2469
 				break;
2470 2470
 
2471 2471
 			case 'questions' :
2472
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2473
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2472
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2473
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2474 2474
 				}
2475 2475
 				//process registration
2476 2476
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2477
-				if ( $cart instanceof EE_Cart ) {
2477
+				if ($cart instanceof EE_Cart) {
2478 2478
 					$grand_total = $cart->get_cart_grand_total();
2479
-					if ( $grand_total instanceof EE_Line_Item ) {
2479
+					if ($grand_total instanceof EE_Line_Item) {
2480 2480
 						$grand_total->save_this_and_descendants_to_txn();
2481 2481
 					}
2482 2482
 				}
2483
-				if ( ! $transaction instanceof EE_Transaction ) {
2483
+				if ( ! $transaction instanceof EE_Transaction) {
2484 2484
 					$query_args = array(
2485 2485
 						'action' => 'new_registration',
2486 2486
 						'processing_registration' => 2,
2487 2487
 						'event_id' => $this->_reg_event->ID()
2488 2488
 					);
2489 2489
 
2490
-					if ( defined('DOING_AJAX' )) {
2490
+					if (defined('DOING_AJAX')) {
2491 2491
 						//display registration form again because there are errors (maybe validation?)
2492 2492
 						$this->new_registration();
2493 2493
 						return;
2494 2494
 					} else {
2495
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2495
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2496 2496
 						return;
2497 2497
 					}
2498 2498
 				}
2499 2499
 				/** @type EE_Transaction_Payments $transaction_payments */
2500
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2500
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2501 2501
 				// maybe update status, and make sure to save transaction if not done already
2502
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2502
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2503 2503
 					$transaction->save();
2504 2504
 				}
2505
-				EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2505
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2506 2506
 				$this->_req_data = array();
2507 2507
 				$query_args = array(
2508 2508
 					'action'        => 'redirect_to_txn',
2509 2509
 					'TXN_ID'        => $transaction->ID(),
2510 2510
 					'EVT_ID'        => $this->_reg_event->ID(),
2511
-					'event_name'    => urlencode( $this->_reg_event->name() ),
2511
+					'event_name'    => urlencode($this->_reg_event->name()),
2512 2512
 					'redirect_from' => 'new_registration'
2513 2513
 				);
2514
-				$this->_redirect_after_action( false, '', '', $query_args, true );
2514
+				$this->_redirect_after_action(false, '', '', $query_args, true);
2515 2515
 				break;
2516 2516
 		}
2517 2517
 
@@ -2528,21 +2528,21 @@  discard block
 block discarded – undo
2528 2528
 	 */
2529 2529
 	public function redirect_to_txn() {
2530 2530
 		EE_System::do_not_cache();
2531
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2531
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2532 2532
 		$query_args = array(
2533 2533
 			'action' => 'view_transaction',
2534
-			'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] )  : 0,
2534
+			'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0,
2535 2535
 			'page'   => 'espresso_transactions'
2536 2536
 		);
2537
-		if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) {
2538
-			$query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ];
2539
-			$query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] );
2540
-			$query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ];
2537
+		if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) {
2538
+			$query_args['EVT_ID'] = $this->_req_data['EVT_ID'];
2539
+			$query_args['event_name'] = urlencode($this->_req_data['event_name']);
2540
+			$query_args['redirect_from'] = $this->_req_data['redirect_from'];
2541 2541
 		}
2542 2542
 		EE_Error::add_success(
2543
-			__( 'Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso' )
2543
+			__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')
2544 2544
 		);
2545
-		$this->_redirect_after_action( false, '', '', $query_args, true );
2545
+		$this->_redirect_after_action(false, '', '', $query_args, true);
2546 2546
 	}
2547 2547
 
2548 2548
 
@@ -2553,7 +2553,7 @@  discard block
 block discarded – undo
2553 2553
 	*		@return void
2554 2554
 	*/
2555 2555
 	protected function _attendee_contact_list_table() {
2556
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2556
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2557 2557
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2558 2558
 		$this->display_admin_list_table_page_with_no_sidebar();
2559 2559
 	}
@@ -2568,10 +2568,10 @@  discard block
 block discarded – undo
2568 2568
 	*		@access public
2569 2569
 	*		@return array
2570 2570
 	*/
2571
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2571
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2572 2572
 
2573
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2574
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2573
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2574
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2575 2575
 		$ATT_MDL = EEM_Attendee::instance();
2576 2576
 
2577 2577
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2599,47 +2599,47 @@  discard block
 block discarded – undo
2599 2599
 				$orderby = 'ATT_lname';
2600 2600
 		}
2601 2601
 
2602
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2602
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2603 2603
 
2604
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2605
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2606
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2604
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2605
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2606
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2607 2607
 
2608 2608
 		$_where = array();
2609 2609
 
2610
-		if ( ! empty( $this->_req_data['s'] ) ) {
2611
-			$sstr = '%' . $this->_req_data['s'] . '%';
2610
+		if ( ! empty($this->_req_data['s'])) {
2611
+			$sstr = '%'.$this->_req_data['s'].'%';
2612 2612
 			$_where['OR'] = array(
2613
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2614
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2615
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2616
-				'ATT_fname' => array( 'LIKE', $sstr ),
2617
-				'ATT_lname' => array( 'LIKE', $sstr ),
2618
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2619
-				'ATT_email' => array('LIKE', $sstr ),
2620
-				'ATT_address' => array( 'LIKE', $sstr ),
2621
-				'ATT_address2' => array( 'LIKE', $sstr ),
2622
-				'ATT_city' => array( 'LIKE', $sstr ),
2623
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2624
-				'State.STA_name' => array('LIKE', $sstr ),
2625
-				'ATT_phone' => array( 'LIKE', $sstr ),
2626
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2627
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2628
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2629
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2613
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2614
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2615
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2616
+				'ATT_fname' => array('LIKE', $sstr),
2617
+				'ATT_lname' => array('LIKE', $sstr),
2618
+				'ATT_short_bio' => array('LIKE', $sstr),
2619
+				'ATT_email' => array('LIKE', $sstr),
2620
+				'ATT_address' => array('LIKE', $sstr),
2621
+				'ATT_address2' => array('LIKE', $sstr),
2622
+				'ATT_city' => array('LIKE', $sstr),
2623
+				'Country.CNT_name' => array('LIKE', $sstr),
2624
+				'State.STA_name' => array('LIKE', $sstr),
2625
+				'ATT_phone' => array('LIKE', $sstr),
2626
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2627
+				'Registration.REG_code' => array('LIKE', $sstr),
2628
+				'Registration.REG_count' => array('LIKE', $sstr),
2629
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2630 2630
 				);
2631 2631
 		}
2632 2632
 
2633 2633
 
2634
-		$offset = ($current_page-1)*$per_page;
2635
-		$limit = $count ? NULL : array( $offset, $per_page );
2634
+		$offset = ($current_page - 1) * $per_page;
2635
+		$limit = $count ? NULL : array($offset, $per_page);
2636 2636
 
2637
-		if ( $trash ) {
2638
-			$_where['status'] = array( '!=', 'publish' );
2639
-			$all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true ): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2637
+		if ($trash) {
2638
+			$_where['status'] = array('!=', 'publish');
2639
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2640 2640
 		} else {
2641
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2642
-			$all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit ), 'ATT_ID' , true ) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );
2641
+			$_where['status'] = array('IN', array('publish'));
2642
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2643 2643
 		}
2644 2644
 
2645 2645
 		return $all_attendees;
@@ -2656,10 +2656,10 @@  discard block
 block discarded – undo
2656 2656
 	 */
2657 2657
 	protected function _resend_registration() {
2658 2658
 		$this->_process_resend_registration();
2659
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2659
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2660 2660
 			'action' => 'default'
2661 2661
 		);
2662
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2662
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2663 2663
 	}
2664 2664
 
2665 2665
 
@@ -2667,26 +2667,26 @@  discard block
 block discarded – undo
2667 2667
 
2668 2668
 
2669 2669
 
2670
-	public function _registrations_report(){
2671
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2672
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2670
+	public function _registrations_report() {
2671
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2672
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2673 2673
 				array(
2674 2674
 					'page' => 'espresso_batch',
2675 2675
 					'batch' => 'file',
2676
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2677
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2678
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2679
-				)) );
2676
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2677
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2678
+					'return_url' => urlencode($this->_req_data['return_url']),
2679
+				)));
2680 2680
 		} else {
2681 2681
 			$new_request_args = array(
2682 2682
 				'export' => 'report',
2683 2683
 				'action' => 'registrations_report_for_event',
2684
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2684
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2685 2685
 			);
2686 2686
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2687 2687
 
2688
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2689
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2688
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2689
+				require_once(EE_CLASSES.'EE_Export.class.php');
2690 2690
 				$EE_Export = EE_Export::instance($this->_req_data);
2691 2691
 				$EE_Export->export();
2692 2692
 			}
@@ -2695,26 +2695,26 @@  discard block
 block discarded – undo
2695 2695
 
2696 2696
 
2697 2697
 
2698
-	public function _contact_list_export(){
2699
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2700
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2698
+	public function _contact_list_export() {
2699
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2700
+			require_once(EE_CLASSES.'EE_Export.class.php');
2701 2701
 			$EE_Export = EE_Export::instance($this->_req_data);
2702 2702
 			$EE_Export->export_attendees();
2703 2703
 		}
2704 2704
 	}
2705 2705
 
2706
-	public function _contact_list_report(){
2707
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2708
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2706
+	public function _contact_list_report() {
2707
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2708
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2709 2709
 				array(
2710 2710
 					'page' => 'espresso_batch',
2711 2711
 					'batch' => 'file',
2712
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2713
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2714
-				)) );
2712
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2713
+					'return_url' => urlencode($this->_req_data['return_url']),
2714
+				)));
2715 2715
 		} else {
2716
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2717
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2716
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2717
+				require_once(EE_CLASSES.'EE_Export.class.php');
2718 2718
 				$EE_Export = EE_Export::instance($this->_req_data);
2719 2719
 				$EE_Export->report_attendees();
2720 2720
 			}
@@ -2733,73 +2733,73 @@  discard block
 block discarded – undo
2733 2733
 	 * @return void
2734 2734
 	 */
2735 2735
 	protected function _duplicate_attendee() {
2736
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2736
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2737 2737
 		//verify we have necessary info
2738
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2739
-			EE_Error::add_error( __('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ );
2740
-			$query_args = array( 'action' => $action );
2738
+		if (empty($this->_req_data['_REG_ID'])) {
2739
+			EE_Error::add_error(__('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
2740
+			$query_args = array('action' => $action);
2741 2741
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2742 2742
 		}
2743 2743
 
2744 2744
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2745
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2745
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2746 2746
 		$attendee = $registration->attendee();
2747 2747
 
2748 2748
 		//remove relation of existing attendee on registration
2749
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2749
+		$registration->_remove_relation_to($attendee, 'Attendee');
2750 2750
 		//new attendee
2751 2751
 		$new_attendee = clone $attendee;
2752
-		$new_attendee->set( 'ATT_ID', 0 );
2752
+		$new_attendee->set('ATT_ID', 0);
2753 2753
 		$new_attendee->save();
2754 2754
 
2755 2755
 		//add new attendee to reg
2756
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2756
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2757 2757
 
2758
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2758
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2759 2759
 
2760 2760
 		//redirect to edit page for attendee
2761
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2761
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2762 2762
 
2763
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2763
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2764 2764
 	}
2765 2765
 
2766 2766
 
2767 2767
 	//related to cpt routes
2768 2768
 	protected function _insert_update_cpt_item($post_id, $post) {
2769 2769
 		$success = true;
2770
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2770
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2771 2771
 		//for attendee updates
2772
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2772
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2773 2773
 			//note we should only be UPDATING attendees at this point.
2774 2774
 			$updated_fields = array(
2775 2775
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2776 2776
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2777
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2777
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2778 2778
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2779 2779
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2780
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2781
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2782
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2783
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2784
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2785
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2780
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2781
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2782
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2783
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2784
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2785
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2786 2786
 				);
2787
-			foreach ( $updated_fields as $field => $value ) {
2787
+			foreach ($updated_fields as $field => $value) {
2788 2788
 				$attendee->set($field, $value);
2789 2789
 			}
2790 2790
 
2791 2791
 			$success = $attendee->save();
2792 2792
 
2793
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2794
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2795
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2796
-					throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback ) );
2793
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2794
+			foreach ($attendee_update_callbacks as $a_callback) {
2795
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2796
+					throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback));
2797 2797
 				}
2798 2798
 			}
2799 2799
 		}
2800 2800
 
2801
-		if ( $success === FALSE )
2802
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2801
+		if ($success === FALSE)
2802
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2803 2803
 
2804 2804
 	}
2805 2805
 
@@ -2819,17 +2819,17 @@  discard block
 block discarded – undo
2819 2819
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2820 2820
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2821 2821
 
2822
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2823
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2822
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2823
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2824 2824
 		}
2825 2825
 
2826
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2826
+		if (post_type_supports('espresso_attendees', 'comments')) {
2827 2827
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2828 2828
 		}
2829 2829
 
2830
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2831
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2832
-		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2830
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2831
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2832
+		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2833 2833
 	}
2834 2834
 
2835 2835
 
@@ -2838,10 +2838,10 @@  discard block
 block discarded – undo
2838 2838
 	 * @param  WP_Post $post wp post object
2839 2839
 	 * @return string        attendee contact info ( and form )
2840 2840
 	 */
2841
-	public function attendee_contact_info( $post ) {
2841
+	public function attendee_contact_info($post) {
2842 2842
 		//get attendee object ( should already have it )
2843 2843
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2844
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2844
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2845 2845
 		EEH_Template::display_template($template, $this->_template_args);
2846 2846
 	}
2847 2847
 
@@ -2857,12 +2857,12 @@  discard block
 block discarded – undo
2857 2857
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2858 2858
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2859 2859
 				new EE_Question_Form_Input(
2860
-				EE_Question::new_instance( array(
2860
+				EE_Question::new_instance(array(
2861 2861
 					'QST_ID' => 0,
2862 2862
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2863 2863
 					'QST_system' => 'admin-state'
2864 2864
 					)),
2865
-				EE_Answer::new_instance( array(
2865
+				EE_Answer::new_instance(array(
2866 2866
 					'ANS_ID' => 0,
2867 2867
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2868 2868
 					)),
@@ -2875,12 +2875,12 @@  discard block
 block discarded – undo
2875 2875
 			));
2876 2876
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2877 2877
 				new EE_Question_Form_Input(
2878
-				EE_Question::new_instance( array(
2878
+				EE_Question::new_instance(array(
2879 2879
 					'QST_ID' => 0,
2880 2880
 					'QST_display_text' => __('Country', 'event_espresso'),
2881 2881
 					'QST_system' => 'admin-country'
2882 2882
 					)),
2883
-				EE_Answer::new_instance( array(
2883
+				EE_Answer::new_instance(array(
2884 2884
 					'ANS_ID' => 0,
2885 2885
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2886 2886
 					)),
@@ -2891,8 +2891,8 @@  discard block
 block discarded – undo
2891 2891
 					'append_qstn_id' => FALSE
2892 2892
 					)
2893 2893
 				));
2894
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2895
-		EEH_Template::display_template($template, $this->_template_args );
2894
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2895
+		EEH_Template::display_template($template, $this->_template_args);
2896 2896
 
2897 2897
 	}
2898 2898
 
@@ -2902,11 +2902,11 @@  discard block
 block discarded – undo
2902 2902
 	*		@access protected
2903 2903
 	*		@return void
2904 2904
 	*/
2905
-	public function attendee_registrations_meta_box( $post ) {
2905
+	public function attendee_registrations_meta_box($post) {
2906 2906
 
2907 2907
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2908 2908
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2909
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2909
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2910 2910
 		EEH_Template::display_template($template, $this->_template_args);
2911 2911
 
2912 2912
 	}
@@ -2920,8 +2920,8 @@  discard block
 block discarded – undo
2920 2920
 	 * @return string        html for new form.
2921 2921
 	 */
2922 2922
 	public function after_title_form_fields($post) {
2923
-		if ( $post->post_type == 'espresso_attendees' ) {
2924
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2923
+		if ($post->post_type == 'espresso_attendees') {
2924
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2925 2925
 			$template_args['attendee'] = $this->_cpt_model_obj;
2926 2926
 			EEH_Template::display_template($template, $template_args);
2927 2927
 		}
@@ -2938,21 +2938,21 @@  discard block
 block discarded – undo
2938 2938
 	*		@access protected
2939 2939
 	*		@return void
2940 2940
 	*/
2941
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2941
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2942 2942
 
2943
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2943
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2944 2944
 
2945 2945
 		$ATT_MDL = EEM_Attendee::instance();
2946 2946
 
2947 2947
 		$success = 1;
2948 2948
 		//Checkboxes
2949
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2949
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2950 2950
 			// if array has more than one element than success message should be plural
2951
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2951
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2952 2952
 			// cycle thru checkboxes
2953
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2954
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2955
-				if ( !$updated ) {
2953
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2954
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2955
+				if ( ! $updated) {
2956 2956
 					$success = 0;
2957 2957
 				}
2958 2958
 			}
@@ -2961,18 +2961,18 @@  discard block
 block discarded – undo
2961 2961
 			// grab single id and delete
2962 2962
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2963 2963
 			//get attendee
2964
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2964
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2965 2965
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2966 2966
 			$updated = $att->save();
2967
-			if ( ! $updated ) {
2967
+			if ( ! $updated) {
2968 2968
 				$success = 0;
2969 2969
 			}
2970 2970
 
2971 2971
 		}
2972 2972
 
2973
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2974
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2975
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2973
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2974
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2975
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2976 2976
 
2977 2977
 	}
2978 2978
 
Please login to merge, or discard this patch.