Completed
Branch FET-7011-toggle-country-state-... (f8da57)
by
unknown
60:28 queued 44:32
created
core/db_classes/EE_Line_Item.class.php 1 patch
Spacing   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	 *                             		    date_format and the second value is the time format
51 51
 	 * @return EE_Line_Item
52 52
 	 */
53
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
54
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
55
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
53
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
54
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
55
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
56 56
 	}
57 57
 
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 *                          		the website will be used.
64 64
 	 * @return EE_Line_Item
65 65
 	 */
66
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
67
-		return new self( $props_n_values, TRUE, $timezone );
66
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
67
+		return new self($props_n_values, TRUE, $timezone);
68 68
 	}
69 69
 
70 70
 
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 	 * @param bool   $bydb
76 76
 	 * @param string $timezone
77 77
 	 */
78
-	protected function __construct( $fieldValues = array(), $bydb = FALSE, $timezone = '' ) {
79
-		parent::__construct( $fieldValues, $bydb, $timezone );
80
-		if ( ! $this->get( 'LIN_code' ) ) {
81
-			$this->set_code( $this->generate_code() );
78
+	protected function __construct($fieldValues = array(), $bydb = FALSE, $timezone = '') {
79
+		parent::__construct($fieldValues, $bydb, $timezone);
80
+		if ( ! $this->get('LIN_code')) {
81
+			$this->set_code($this->generate_code());
82 82
 		}
83 83
 	}
84 84
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return int
90 90
 	 */
91 91
 	public function ID() {
92
-		return $this->get( 'LIN_ID' );
92
+		return $this->get('LIN_ID');
93 93
 	}
94 94
 
95 95
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return int
100 100
 	 */
101 101
 	public function TXN_ID() {
102
-		return $this->get( 'TXN_ID' );
102
+		return $this->get('TXN_ID');
103 103
 	}
104 104
 
105 105
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * Sets TXN_ID
109 109
 	 * @param int $TXN_ID
110 110
 	 */
111
-	public function set_TXN_ID( $TXN_ID ) {
112
-		$this->set( 'TXN_ID', $TXN_ID );
111
+	public function set_TXN_ID($TXN_ID) {
112
+		$this->set('TXN_ID', $TXN_ID);
113 113
 	}
114 114
 
115 115
 
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 	 * @return string
120 120
 	 */
121 121
 	public function name() {
122
-		$name =  $this->get( 'LIN_name' );
123
-		if( ! $name ){
124
-			$name = ucwords( str_replace( '-', ' ', $this->type() ) );
122
+		$name = $this->get('LIN_name');
123
+		if ( ! $name) {
124
+			$name = ucwords(str_replace('-', ' ', $this->type()));
125 125
 		}
126 126
 		return $name;
127 127
 	}
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * Sets name
133 133
 	 * @param string $name
134 134
 	 */
135
-	public function set_name( $name ) {
136
-		$this->set( 'LIN_name', $name );
135
+	public function set_name($name) {
136
+		$this->set('LIN_name', $name);
137 137
 	}
138 138
 
139 139
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return string
144 144
 	 */
145 145
 	public function desc() {
146
-		return $this->get( 'LIN_desc' );
146
+		return $this->get('LIN_desc');
147 147
 	}
148 148
 
149 149
 
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * Sets desc
153 153
 	 * @param string $desc
154 154
 	 */
155
-	public function set_desc( $desc ) {
156
-		$this->set( 'LIN_desc', $desc );
155
+	public function set_desc($desc) {
156
+		$this->set('LIN_desc', $desc);
157 157
 	}
158 158
 
159 159
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @return int
164 164
 	 */
165 165
 	public function quantity() {
166
-		return $this->get( 'LIN_quantity' );
166
+		return $this->get('LIN_quantity');
167 167
 	}
168 168
 
169 169
 
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	 * Sets quantity
173 173
 	 * @param int $quantity
174 174
 	 */
175
-	function set_quantity( $quantity ) {
176
-		$this->set( 'LIN_quantity', max( $quantity, 0 ) );
175
+	function set_quantity($quantity) {
176
+		$this->set('LIN_quantity', max($quantity, 0));
177 177
 	}
178 178
 
179 179
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return string
184 184
 	 */
185 185
 	public function OBJ_ID() {
186
-		return $this->get( 'OBJ_ID' );
186
+		return $this->get('OBJ_ID');
187 187
 	}
188 188
 
189 189
 
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 * Sets item_id
193 193
 	 * @param string $item_id
194 194
 	 */
195
-	public function set_OBJ_ID( $item_id ) {
196
-		$this->set( 'OBJ_ID', $item_id );
195
+	public function set_OBJ_ID($item_id) {
196
+		$this->set('OBJ_ID', $item_id);
197 197
 	}
198 198
 
199 199
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @return string
204 204
 	 */
205 205
 	public function OBJ_type() {
206
-		return $this->get( 'OBJ_type' );
206
+		return $this->get('OBJ_type');
207 207
 	}
208 208
 
209 209
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 * Sets item_type
241 241
 	 * @param string $OBJ_type
242 242
 	 */
243
-	public function set_OBJ_type( $OBJ_type ) {
244
-		$this->set( 'OBJ_type', $OBJ_type );
243
+	public function set_OBJ_type($OBJ_type) {
244
+		$this->set('OBJ_type', $OBJ_type);
245 245
 	}
246 246
 
247 247
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * @return float
252 252
 	 */
253 253
 	public function unit_price() {
254
-		return $this->get( 'LIN_unit_price' );
254
+		return $this->get('LIN_unit_price');
255 255
 	}
256 256
 
257 257
 
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
 	 *
262 262
 	 * @param float $unit_price
263 263
 	 */
264
-	public function set_unit_price( $unit_price ) {
265
-		$this->set( 'LIN_unit_price', $unit_price );
264
+	public function set_unit_price($unit_price) {
265
+		$this->set('LIN_unit_price', $unit_price);
266 266
 	}
267 267
 
268 268
 
@@ -273,19 +273,19 @@  discard block
 block discarded – undo
273 273
 	 * @return boolean
274 274
 	 */
275 275
 	public function is_percent() {
276
-		if( $this->is_tax_sub_total() ) {
276
+		if ($this->is_tax_sub_total()) {
277 277
 			//tax subtotals HAVE a percent on them, that percentage only applies
278 278
 			//to taxable items, so its' an exception. Treat it like a flat line item
279 279
 			return false;
280 280
 		}
281
-		$unit_price = abs( $this->get( 'LIN_unit_price' ) );
282
-		$percent = abs( $this->get( 'LIN_percent' ) );
283
-		if ( $unit_price < .001 && $percent ) {
281
+		$unit_price = abs($this->get('LIN_unit_price'));
282
+		$percent = abs($this->get('LIN_percent'));
283
+		if ($unit_price < .001 && $percent) {
284 284
 			return TRUE;
285
-		} elseif ( $unit_price >= .001 && !$percent ) {
285
+		} elseif ($unit_price >= .001 && ! $percent) {
286 286
 			return FALSE;
287
-		} elseif ( $unit_price >= .001 && $percent ) {
288
-			throw new EE_Error( sprintf( __( "A Line Item can not have a unit price of (%s) AND a percent (%s)!", "event_espresso" ), $unit_price, $percent ) );
287
+		} elseif ($unit_price >= .001 && $percent) {
288
+			throw new EE_Error(sprintf(__("A Line Item can not have a unit price of (%s) AND a percent (%s)!", "event_espresso"), $unit_price, $percent));
289 289
 		} else {
290 290
 			// if they're both 0, assume its not a percent item
291 291
 			return FALSE;
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @return float
300 300
 	 */
301 301
 	public function percent() {
302
-		return $this->get( 'LIN_percent' );
302
+		return $this->get('LIN_percent');
303 303
 	}
304 304
 
305 305
 
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 	 * Sets percent (between 100-0.01)
309 309
 	 * @param float $percent
310 310
 	 */
311
-	public function set_percent( $percent ) {
312
-		$this->set( 'LIN_percent', $percent );
311
+	public function set_percent($percent) {
312
+		$this->set('LIN_percent', $percent);
313 313
 	}
314 314
 
315 315
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 * @return float
320 320
 	 */
321 321
 	public function total() {
322
-		return $this->get( 'LIN_total' );
322
+		return $this->get('LIN_total');
323 323
 	}
324 324
 
325 325
 
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 	 * Sets total
329 329
 	 * @param float $total
330 330
 	 */
331
-	public function set_total( $total ) {
332
-		$this->set( 'LIN_total', $total );
331
+	public function set_total($total) {
332
+		$this->set('LIN_total', $total);
333 333
 	}
334 334
 
335 335
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	 * @return int
340 340
 	 */
341 341
 	public function order() {
342
-		return $this->get( 'LIN_order' );
342
+		return $this->get('LIN_order');
343 343
 	}
344 344
 
345 345
 
@@ -348,8 +348,8 @@  discard block
 block discarded – undo
348 348
 	 * Sets order
349 349
 	 * @param int $order
350 350
 	 */
351
-	public function set_order( $order ) {
352
-		$this->set( 'LIN_order', $order );
351
+	public function set_order($order) {
352
+		$this->set('LIN_order', $order);
353 353
 	}
354 354
 
355 355
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	 * @return int
360 360
 	 */
361 361
 	public function parent_ID() {
362
-		return $this->get( 'LIN_parent' );
362
+		return $this->get('LIN_parent');
363 363
 	}
364 364
 
365 365
 
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
 	 * Sets parent
369 369
 	 * @param int $parent
370 370
 	 */
371
-	public function set_parent_ID( $parent ) {
372
-		$this->set( 'LIN_parent', $parent );
371
+	public function set_parent_ID($parent) {
372
+		$this->set('LIN_parent', $parent);
373 373
 	}
374 374
 
375 375
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	 * @return string
380 380
 	 */
381 381
 	public function type() {
382
-		return $this->get( 'LIN_type' );
382
+		return $this->get('LIN_type');
383 383
 	}
384 384
 
385 385
 
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
 	 * Sets type
389 389
 	 * @param string $type
390 390
 	 */
391
-	public function set_type( $type ) {
392
-		$this->set( 'LIN_type', $type );
391
+	public function set_type($type) {
392
+		$this->set('LIN_type', $type);
393 393
 	}
394 394
 
395 395
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 	 * @return EE_Line_Item
403 403
 	 */
404 404
 	public function parent() {
405
-		if( $this->ID() ) {
406
-			return $this->get_model()->get_one_by_ID( $this->parent_ID() );
405
+		if ($this->ID()) {
406
+			return $this->get_model()->get_one_by_ID($this->parent_ID());
407 407
 		} else {
408 408
 			return $this->_parent;
409 409
 		}
@@ -416,13 +416,13 @@  discard block
 block discarded – undo
416 416
 	 * @return EE_Line_Item[]
417 417
 	 */
418 418
 	public function children() {
419
-		if ( $this->ID() ) {
419
+		if ($this->ID()) {
420 420
 			return $this->get_model()->get_all(
421 421
 					array(
422
-						array( 'LIN_parent' => $this->ID() ),
423
-						'order_by' => array( 'LIN_order' => 'ASC' ) ) );
422
+						array('LIN_parent' => $this->ID()),
423
+						'order_by' => array('LIN_order' => 'ASC') ) );
424 424
 		} else {
425
-			if ( ! is_array( $this->_children ) ) {
425
+			if ( ! is_array($this->_children)) {
426 426
 				$this->_children = array();
427 427
 			}
428 428
 			return $this->_children;
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 	 * @return string
437 437
 	 */
438 438
 	public function code() {
439
-		return $this->get( 'LIN_code' );
439
+		return $this->get('LIN_code');
440 440
 	}
441 441
 
442 442
 
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 	 * Sets code
446 446
 	 * @param string $code
447 447
 	 */
448
-	public function set_code( $code ) {
449
-		$this->set( 'LIN_code', $code );
448
+	public function set_code($code) {
449
+		$this->set('LIN_code', $code);
450 450
 	}
451 451
 
452 452
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 	 * @return boolean
457 457
 	 */
458 458
 	public function is_taxable() {
459
-		return $this->get( 'LIN_is_taxable' );
459
+		return $this->get('LIN_is_taxable');
460 460
 	}
461 461
 
462 462
 
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 	 * Sets is_taxable
466 466
 	 * @param boolean $is_taxable
467 467
 	 */
468
-	public function set_is_taxable( $is_taxable ) {
469
-		$this->set( 'LIN_is_taxable', $is_taxable );
468
+	public function set_is_taxable($is_taxable) {
469
+		$this->set('LIN_is_taxable', $is_taxable);
470 470
 	}
471 471
 
472 472
 
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 	 */
482 482
 	public function get_object() {
483 483
 		$model_name_of_related_obj = $this->OBJ_type();
484
-		return $this->get_model()->has_relation(  $model_name_of_related_obj ) ? $this->get_first_related( $model_name_of_related_obj ) : NULL;
484
+		return $this->get_model()->has_relation($model_name_of_related_obj) ? $this->get_first_related($model_name_of_related_obj) : NULL;
485 485
 	}
486 486
 
487 487
 
@@ -492,11 +492,11 @@  discard block
 block discarded – undo
492 492
 	 * @param array $query_params
493 493
 	 * @return EE_Ticket
494 494
 	 */
495
-	public function ticket( $query_params = array() ) {
495
+	public function ticket($query_params = array()) {
496 496
 		//we're going to assume that when this method is called we always want to receive the attached ticket EVEN if that ticket is archived.  This can be overridden via the incoming $query_params argument
497
-		$remove_defaults = array( 'default_where_conditions' => 'none' );
498
-		$query_params = array_merge( $remove_defaults, $query_params );
499
-		return $this->get_first_related( 'Ticket', $query_params );
497
+		$remove_defaults = array('default_where_conditions' => 'none');
498
+		$query_params = array_merge($remove_defaults, $query_params);
499
+		return $this->get_first_related('Ticket', $query_params);
500 500
 	}
501 501
 
502 502
 
@@ -506,11 +506,11 @@  discard block
 block discarded – undo
506 506
 	 * @return EE_Datetime | NULL
507 507
 	 */
508 508
 	public function get_ticket_datetime() {
509
-		if ( $this->OBJ_type() === 'Ticket' ) {
509
+		if ($this->OBJ_type() === 'Ticket') {
510 510
 			$ticket = $this->ticket();
511
-			if ( $ticket instanceof EE_Ticket ) {
511
+			if ($ticket instanceof EE_Ticket) {
512 512
 				$datetime = $ticket->first_datetime();
513
-				if ( $datetime instanceof EE_Datetime ) {
513
+				if ($datetime instanceof EE_Datetime) {
514 514
 					return $datetime;
515 515
 				}
516 516
 			}
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
 	 * @return string
527 527
 	 */
528 528
 	public function ticket_event_name() {
529
-		$event_name = __( "Unknown", "event_espresso" );
529
+		$event_name = __("Unknown", "event_espresso");
530 530
 		$event = $this->ticket_event();
531
-		if ( $event instanceof EE_Event ) {
531
+		if ($event instanceof EE_Event) {
532 532
 			$event_name = $event->name();
533 533
 		}
534 534
 		return $event_name;
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
 	public function ticket_event() {
543 543
 		$event = null;
544 544
 		$ticket = $this->ticket();
545
-		if ( $ticket instanceof EE_Ticket ) {
545
+		if ($ticket instanceof EE_Ticket) {
546 546
 			$datetime = $ticket->first_datetime();
547
-			if ( $datetime instanceof EE_Datetime ) {
547
+			if ($datetime instanceof EE_Datetime) {
548 548
 				$event = $datetime->event();
549 549
 			}
550 550
 		}
@@ -559,11 +559,11 @@  discard block
 block discarded – undo
559 559
 	 * @param string $time_format
560 560
 	 * @return string
561 561
 	 */
562
-	public function ticket_datetime_start( $date_format = '', $time_format = '' ) {
563
-		$first_datetime_string = __( "Unknown", "event_espresso" );
562
+	public function ticket_datetime_start($date_format = '', $time_format = '') {
563
+		$first_datetime_string = __("Unknown", "event_espresso");
564 564
 		$datetime = $this->get_ticket_datetime();
565
-		if ( $datetime ) {
566
-			$first_datetime_string = $datetime->start_date_and_time( $date_format, $time_format );
565
+		if ($datetime) {
566
+			$first_datetime_string = $datetime->start_date_and_time($date_format, $time_format);
567 567
 		}
568 568
 		return $first_datetime_string;
569 569
 	}
@@ -578,26 +578,26 @@  discard block
 block discarded – undo
578 578
 	 * @return bool success
579 579
 	 * @throws \EE_Error
580 580
 	 */
581
-	public function add_child_line_item( EEI_Line_Item $line_item, $set_order = true ) {
581
+	public function add_child_line_item(EEI_Line_Item $line_item, $set_order = true) {
582 582
 		// should we calculate the LIN_order for this line item ?
583
-		if ( $set_order || $line_item->order() === null ) {
584
-			$line_item->set_order( count( $this->children() ) );
583
+		if ($set_order || $line_item->order() === null) {
584
+			$line_item->set_order(count($this->children()));
585 585
 		}
586
-		if ( $this->ID() ) {
586
+		if ($this->ID()) {
587 587
 			//check for any duplicate line items (with the same code), if so, this replaces it
588
-			$line_item_with_same_code = $this->get_child_line_item(  $line_item->code() );
589
-			if( $line_item_with_same_code instanceof EE_Line_Item && $line_item_with_same_code !== $line_item ) {
590
-				$this->delete_child_line_item( $line_item_with_same_code->code() );
588
+			$line_item_with_same_code = $this->get_child_line_item($line_item->code());
589
+			if ($line_item_with_same_code instanceof EE_Line_Item && $line_item_with_same_code !== $line_item) {
590
+				$this->delete_child_line_item($line_item_with_same_code->code());
591 591
 			}
592
-			$line_item->set_parent_ID( $this->ID() );
593
-			if( $this->TXN_ID() ){
594
-				$line_item->set_TXN_ID( $this->TXN_ID() );
592
+			$line_item->set_parent_ID($this->ID());
593
+			if ($this->TXN_ID()) {
594
+				$line_item->set_TXN_ID($this->TXN_ID());
595 595
 			}
596 596
 			return $line_item->save();
597 597
 		} else {
598
-			$this->_children[ $line_item->code() ] = $line_item;
599
-			if( $line_item->parent() != $this ) {
600
-				$line_item->set_parent( $this );
598
+			$this->_children[$line_item->code()] = $line_item;
599
+			if ($line_item->parent() != $this) {
600
+				$line_item->set_parent($this);
601 601
 			}
602 602
 			return TRUE;
603 603
 		}
@@ -611,16 +611,16 @@  discard block
 block discarded – undo
611 611
 	 * @param EE_Line_Item $line_item
612 612
 	 *
613 613
 	 */
614
-	public function set_parent( $line_item ) {
615
-		if ( $this->ID() ) {
616
-			if( ! $line_item->ID() ) {
614
+	public function set_parent($line_item) {
615
+		if ($this->ID()) {
616
+			if ( ! $line_item->ID()) {
617 617
 				$line_item->save();
618 618
 			}
619
-			$this->set_parent_ID( $line_item->ID() );
619
+			$this->set_parent_ID($line_item->ID());
620 620
 			$this->save();
621 621
 		} else {
622 622
 			$this->_parent = $line_item;
623
-			$this->set_parent_ID( $line_item->ID() );
623
+			$this->set_parent_ID($line_item->ID());
624 624
 		}
625 625
 	}
626 626
 
@@ -633,11 +633,11 @@  discard block
 block discarded – undo
633 633
 	 * @param string $code
634 634
 	 * @return EE_Line_Item
635 635
 	 */
636
-	public function get_child_line_item( $code ) {
637
-		if ( $this->ID() ) {
638
-			return $this->get_model()->get_one( array( array( 'LIN_parent' => $this->ID(), 'LIN_code' => $code ) ) );
636
+	public function get_child_line_item($code) {
637
+		if ($this->ID()) {
638
+			return $this->get_model()->get_one(array(array('LIN_parent' => $this->ID(), 'LIN_code' => $code)));
639 639
 		} else {
640
-			return isset( $this->_children[ $code ] ) ? $this->_children[ $code ] : null;
640
+			return isset($this->_children[$code]) ? $this->_children[$code] : null;
641 641
 		}
642 642
 	}
643 643
 
@@ -648,10 +648,10 @@  discard block
 block discarded – undo
648 648
 	 * @return int
649 649
 	 */
650 650
 	public function delete_children_line_items() {
651
-		if ( $this->ID() ) {
652
-			return $this->get_model()->delete( array( array( 'LIN_parent' => $this->ID() ) ) );
651
+		if ($this->ID()) {
652
+			return $this->get_model()->delete(array(array('LIN_parent' => $this->ID())));
653 653
 		} else {
654
-			$count = count( $this->_children );
654
+			$count = count($this->_children);
655 655
 			$this->_children = array();
656 656
 			return $count;
657 657
 		}
@@ -668,25 +668,25 @@  discard block
 block discarded – undo
668 668
 	 * @param bool $stop_search_once_found
669 669
 	 * @return int count of items deleted (or simply removed from the line item's cache, if not has not been saved to the DB yet)
670 670
 	 */
671
-	public function delete_child_line_item( $code, $stop_search_once_found = true ) {
672
-		if ( $this->ID() ) {
671
+	public function delete_child_line_item($code, $stop_search_once_found = true) {
672
+		if ($this->ID()) {
673 673
 			$items_deleted = 0;
674
-			if( $this->code() == $code ) {
675
-				$items_deleted += EEH_Line_Item::delete_all_child_items( $this );
674
+			if ($this->code() == $code) {
675
+				$items_deleted += EEH_Line_Item::delete_all_child_items($this);
676 676
 				$items_deleted += (int) $this->delete();
677
-				if( $stop_search_once_found ){
677
+				if ($stop_search_once_found) {
678 678
 					return $items_deleted;
679 679
 				}
680 680
 			}
681
-			foreach( $this->children() as $child_line_item ) {
682
-				$items_deleted += $child_line_item->delete_child_line_item( $code, $stop_search_once_found );
681
+			foreach ($this->children() as $child_line_item) {
682
+				$items_deleted += $child_line_item->delete_child_line_item($code, $stop_search_once_found);
683 683
 			}
684 684
 			return $items_deleted;
685 685
 		} else {
686
-			if( isset( $this->_children[ $code ] ) ) {
687
-				unset( $this->_children[ $code ] );
686
+			if (isset($this->_children[$code])) {
687
+				unset($this->_children[$code]);
688 688
 				return 1;
689
-			}else{
689
+			} else {
690 690
 				return 0;
691 691
 			}
692 692
 		}
@@ -699,9 +699,9 @@  discard block
 block discarded – undo
699 699
 	 * @return boolean
700 700
 	 */
701 701
 	public function delete_if_childless_subtotal() {
702
-		if( $this->ID() &&
702
+		if ($this->ID() &&
703 703
 				$this->type() == EEM_Line_Item::type_sub_total &&
704
-				! $this->children() ) {
704
+				! $this->children()) {
705 705
 			return $this->delete();
706 706
 		} else {
707 707
 			return false;
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 	 */
717 717
 	public function generate_code() {
718 718
 		// each line item in the cart requires a unique identifier
719
-		return md5( $this->get( 'OBJ_type' ) . $this->get( 'OBJ_ID' ) . microtime() );
719
+		return md5($this->get('OBJ_type').$this->get('OBJ_ID').microtime());
720 720
 	}
721 721
 
722 722
 
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 	 * @return string like '2, 004.00', formatted according to the localized currency
800 800
 	 */
801 801
 	public function unit_price_no_code() {
802
-		return $this->get_pretty( 'LIN_unit_price', 'no_currency_code' );
802
+		return $this->get_pretty('LIN_unit_price', 'no_currency_code');
803 803
 	}
804 804
 
805 805
 
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 	 * @return string like '2, 004.00', formatted according to the localized currency
810 810
 	 */
811 811
 	public function total_no_code() {
812
-		return $this->get_pretty( 'LIN_total', 'no_currency_code' );
812
+		return $this->get_pretty('LIN_total', 'no_currency_code');
813 813
 	}
814 814
 
815 815
 
@@ -829,17 +829,17 @@  discard block
 block discarded – undo
829 829
 		$tax_total = $this->recalculate_taxes_and_tax_total();
830 830
 		$total = $pre_tax_total + $tax_total;
831 831
 		// no negative totals plz
832
-		$total = max( $total, 0 );
833
-		$this->set_total( $total );
832
+		$total = max($total, 0);
833
+		$this->set_total($total);
834 834
 		//only update the related transaction's total
835 835
 		//if we intend to save this line item and its a grand total
836
-		if(
836
+		if (
837 837
 			$this->allow_persist() &&
838 838
 			$this->type() === EEM_Line_Item::type_total &&
839 839
 			$this->transaction() instanceof EE_Transaction
840
-		){
841
-			$this->transaction()->set_total( $total );
842
-			if ( $this->transaction()->ID() ) {
840
+		) {
841
+			$this->transaction()->set_total($total);
842
+			if ($this->transaction()->ID()) {
843 843
 				$this->transaction()->save();
844 844
 			}
845 845
 		}
@@ -858,47 +858,47 @@  discard block
 block discarded – undo
858 858
 	public function recalculate_pre_tax_total() {
859 859
 		$total = 0;
860 860
 		$my_children = $this->children();
861
-		$has_children = ! empty( $my_children );
862
-		if ( $has_children && $this->is_line_item() ) {
863
-			$total = $this->_recalculate_pretax_total_for_line_item( $total, $my_children );
864
-		} elseif ( ! $has_children && ( $this->is_sub_line_item() || $this->is_line_item() ) ) {
861
+		$has_children = ! empty($my_children);
862
+		if ($has_children && $this->is_line_item()) {
863
+			$total = $this->_recalculate_pretax_total_for_line_item($total, $my_children);
864
+		} elseif ( ! $has_children && ($this->is_sub_line_item() || $this->is_line_item())) {
865 865
 			$total = $this->unit_price() * $this->quantity();
866
-		} elseif( $this->is_sub_total() || $this->is_total() ) {
867
-			$total = $this->_recalculate_pretax_total_for_subtotal( $total, $my_children );
868
-		} elseif ( $this->is_tax_sub_total() || $this->is_tax() || $this->is_cancelled() ) {
866
+		} elseif ($this->is_sub_total() || $this->is_total()) {
867
+			$total = $this->_recalculate_pretax_total_for_subtotal($total, $my_children);
868
+		} elseif ($this->is_tax_sub_total() || $this->is_tax() || $this->is_cancelled()) {
869 869
 			// completely ignore tax totals, tax sub-totals, and cancelled line items, when calculating the pre-tax-total
870 870
 			return 0;
871 871
 		}
872 872
 		// ensure all non-line items and non-sub-line-items have a quantity of 1 (except for Events)
873
-		if(
873
+		if (
874 874
 			! $this->is_line_item() &&
875 875
 			! $this->is_sub_line_item() &&
876 876
 			! $this->is_cancellation()
877 877
 		) {
878
-			if ( $this->OBJ_type() !== 'Event' ) {
879
-				$this->set_quantity( 1 );
878
+			if ($this->OBJ_type() !== 'Event') {
879
+				$this->set_quantity(1);
880 880
 			}
881
-			if( ! $this->is_percent() ) {
882
-				$this->set_unit_price( $this->total() );
881
+			if ( ! $this->is_percent()) {
882
+				$this->set_unit_price($this->total());
883 883
 			}
884 884
 		}
885 885
 
886 886
 		//we don't want to bother saving grand totals, because that needs to factor in taxes anyways
887 887
 		//so it ought to be
888
-		if( ! $this->is_total() ) {
889
-			$this->set_total( $total );
888
+		if ( ! $this->is_total()) {
889
+			$this->set_total($total);
890 890
 			//if not a percent line item, make sure we keep the unit price in sync
891
-			if(
891
+			if (
892 892
 				$has_children
893 893
 				&& $this->is_line_item()
894 894
 				&& ! $this->is_percent()
895 895
 			) {
896
-				if( $this->quantity() === 0 ){
896
+				if ($this->quantity() === 0) {
897 897
 					$new_unit_price = 0;
898 898
 				} else {
899 899
 					$new_unit_price = $this->total() / $this->quantity();
900 900
 				}
901
-				$this->set_unit_price( $new_unit_price );
901
+				$this->set_unit_price($new_unit_price);
902 902
 			}
903 903
 			$this->maybe_save();
904 904
 		}
@@ -918,39 +918,39 @@  discard block
 block discarded – undo
918 918
 	 * @return float
919 919
 	 * @throws \EE_Error
920 920
 	 */
921
-	protected function _recalculate_pretax_total_for_subtotal( $calculated_total_so_far, $my_children = null ) {
922
-		if( $my_children === null ) {
921
+	protected function _recalculate_pretax_total_for_subtotal($calculated_total_so_far, $my_children = null) {
922
+		if ($my_children === null) {
923 923
 			$my_children = $this->children();
924 924
 		}
925 925
 		//get the total of all its children
926
-		foreach ( $my_children as $child_line_item ) {
927
-			if ( $child_line_item instanceof EE_Line_Item && ! $child_line_item->is_cancellation() ) {
926
+		foreach ($my_children as $child_line_item) {
927
+			if ($child_line_item instanceof EE_Line_Item && ! $child_line_item->is_cancellation()) {
928 928
 				// percentage line items are based on total so far
929
-				if ( $child_line_item->is_percent() ) {
929
+				if ($child_line_item->is_percent()) {
930 930
 					//round as we go so that the line items add up ok
931 931
 					$percent_total = round(
932 932
 						$calculated_total_so_far * $child_line_item->percent() / 100,
933 933
 						EE_Registry::instance()->CFG->currency->dec_plc
934 934
 					);
935
-					$child_line_item->set_total( $percent_total );
935
+					$child_line_item->set_total($percent_total);
936 936
 					//so far all percent line items should have a quantity of 1
937 937
 					//(ie, no double percent discounts. Although that might be requested someday)
938
-					$child_line_item->set_quantity( 1 );
938
+					$child_line_item->set_quantity(1);
939 939
 					$child_line_item->maybe_save();
940 940
 					$calculated_total_so_far += $percent_total;
941 941
 				} else {
942 942
 					//verify flat sub-line-item quantities match their parent
943
-					if( $child_line_item->is_sub_line_item() ) {
944
-						$child_line_item->set_quantity( $this->quantity() );
943
+					if ($child_line_item->is_sub_line_item()) {
944
+						$child_line_item->set_quantity($this->quantity());
945 945
 					}
946 946
 					$calculated_total_so_far += $child_line_item->recalculate_pre_tax_total();
947 947
 				}
948 948
 			}
949 949
 		}
950 950
 
951
-		if( $this->is_sub_total() ){
951
+		if ($this->is_sub_total()) {
952 952
 			// no negative totals plz
953
-			$calculated_total_so_far = max( $calculated_total_so_far, 0 );
953
+			$calculated_total_so_far = max($calculated_total_so_far, 0);
954 954
 		}
955 955
 		return $calculated_total_so_far;
956 956
 	}
@@ -968,8 +968,8 @@  discard block
 block discarded – undo
968 968
 	 * @return float
969 969
 	 * @throws \EE_Error
970 970
 	 */
971
-	protected function _recalculate_pretax_total_for_line_item( $calculated_total_so_far, $my_children = null ) {
972
-		if( $my_children === null ) {
971
+	protected function _recalculate_pretax_total_for_line_item($calculated_total_so_far, $my_children = null) {
972
+		if ($my_children === null) {
973 973
 			$my_children = $this->children();
974 974
 		}
975 975
 		//we need to keep track of the running total for a single item,
@@ -977,10 +977,10 @@  discard block
 block discarded – undo
977 977
 		$unit_price_for_total = 0;
978 978
 		$quantity_for_total = 1;
979 979
 		//get the total of all its children
980
-		foreach ( $my_children as $child_line_item ) {
981
-			if ( $child_line_item instanceof EE_Line_Item &&
980
+		foreach ($my_children as $child_line_item) {
981
+			if ($child_line_item instanceof EE_Line_Item &&
982 982
 					! $child_line_item->is_cancellation()) {
983
-				if ( $child_line_item->is_percent() ) {
983
+				if ($child_line_item->is_percent()) {
984 984
 					//it should be the unit-price-so-far multiplied by teh percent multiplied by the quantity
985 985
 					//not total multiplied by percent, because that ignores rounding along-the-way
986 986
 					$percent_unit_price = round(
@@ -988,17 +988,17 @@  discard block
 block discarded – undo
988 988
 						EE_Registry::instance()->CFG->currency->dec_plc
989 989
 					);
990 990
 					$percent_total = $percent_unit_price * $quantity_for_total;
991
-					$child_line_item->set_total( $percent_total );
991
+					$child_line_item->set_total($percent_total);
992 992
 					//so far all percent line items should have a quantity of 1
993 993
 					//(ie, no double percent discounts. Although that might be requested someday)
994
-					$child_line_item->set_quantity( 1 );
994
+					$child_line_item->set_quantity(1);
995 995
 					$child_line_item->maybe_save();
996 996
 					$calculated_total_so_far += $percent_total;
997 997
 					$unit_price_for_total += $percent_unit_price;
998 998
 				} else {
999 999
 					//verify flat sub-line-item quantities match their parent
1000
-					if( $child_line_item->is_sub_line_item() ) {
1001
-						$child_line_item->set_quantity( $this->quantity() );
1000
+					if ($child_line_item->is_sub_line_item()) {
1001
+						$child_line_item->set_quantity($this->quantity());
1002 1002
 					}
1003 1003
 					$quantity_for_total = $child_line_item->quantity();
1004 1004
 					$calculated_total_so_far += $child_line_item->recalculate_pre_tax_total();
@@ -1022,10 +1022,10 @@  discard block
 block discarded – undo
1022 1022
 		//calculate the pretax total
1023 1023
 		$taxable_total = $this->taxable_total();
1024 1024
 		$tax_total = 0;
1025
-		foreach ( $taxes as $tax ) {
1025
+		foreach ($taxes as $tax) {
1026 1026
 			$total_on_this_tax = $taxable_total * $tax->percent() / 100;
1027 1027
 			//remember the total on this line item
1028
-			$tax->set_total( $total_on_this_tax );
1028
+			$tax->set_total($total_on_this_tax);
1029 1029
 			$tax_total += $tax->total();
1030 1030
 		}
1031 1031
 		$this->_recalculate_tax_sub_total();
@@ -1039,21 +1039,21 @@  discard block
 block discarded – undo
1039 1039
 	 * @return void
1040 1040
 	 */
1041 1041
 	private function _recalculate_tax_sub_total() {
1042
-		if ( $this->is_tax_sub_total() ) {
1042
+		if ($this->is_tax_sub_total()) {
1043 1043
 			$total = 0;
1044 1044
 			$total_percent = 0;
1045 1045
 			//simply loop through all its children (which should be taxes) and sum their total
1046
-			foreach ( $this->children() as $child_tax ) {
1047
-				if ( $child_tax instanceof EE_Line_Item ) {
1046
+			foreach ($this->children() as $child_tax) {
1047
+				if ($child_tax instanceof EE_Line_Item) {
1048 1048
 					$total += $child_tax->total();
1049 1049
 					$total_percent += $child_tax->percent();
1050 1050
 				}
1051 1051
 			}
1052
-			$this->set_total( $total );
1053
-			$this->set_percent( $total_percent );
1054
-		} elseif ( $this->is_total() ) {
1055
-			foreach ( $this->children() as $maybe_tax_subtotal ) {
1056
-				if ( $maybe_tax_subtotal instanceof EE_Line_Item ) {
1052
+			$this->set_total($total);
1053
+			$this->set_percent($total_percent);
1054
+		} elseif ($this->is_total()) {
1055
+			foreach ($this->children() as $maybe_tax_subtotal) {
1056
+				if ($maybe_tax_subtotal instanceof EE_Line_Item) {
1057 1057
 					$maybe_tax_subtotal->_recalculate_tax_sub_total();
1058 1058
 				}
1059 1059
 			}
@@ -1069,8 +1069,8 @@  discard block
 block discarded – undo
1069 1069
 	public function get_total_tax() {
1070 1070
 		$this->_recalculate_tax_sub_total();
1071 1071
 		$total = 0;
1072
-		foreach ( $this->tax_descendants() as $tax_line_item ) {
1073
-			if ( $tax_line_item instanceof EE_Line_Item ) {
1072
+		foreach ($this->tax_descendants() as $tax_line_item) {
1073
+			if ($tax_line_item instanceof EE_Line_Item) {
1074 1074
 				$total += $tax_line_item->total();
1075 1075
 			}
1076 1076
 		}
@@ -1084,15 +1084,15 @@  discard block
 block discarded – undo
1084 1084
 	 */
1085 1085
 	public function get_items_total() {
1086 1086
 		//by default, let's make sure we're consistent with the existing line item
1087
-		if( $this->is_total() ) {
1088
-			$pretax_subtotal_li = EEH_Line_Item::get_pre_tax_subtotal( $this );
1089
-			if( $pretax_subtotal_li instanceof EE_Line_Item ) {
1087
+		if ($this->is_total()) {
1088
+			$pretax_subtotal_li = EEH_Line_Item::get_pre_tax_subtotal($this);
1089
+			if ($pretax_subtotal_li instanceof EE_Line_Item) {
1090 1090
 				return $pretax_subtotal_li->total();
1091 1091
 			}
1092 1092
 		}
1093 1093
 		$total = 0;
1094
-		foreach ( $this->get_items() as $item ) {
1095
-			if ( $item instanceof EE_Line_Item ) {
1094
+		foreach ($this->get_items() as $item) {
1095
+			if ($item instanceof EE_Line_Item) {
1096 1096
 				$total += $item->total();
1097 1097
 			}
1098 1098
 		}
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 	 * @return EE_Line_Item[]
1108 1108
 	 */
1109 1109
 	public function tax_descendants() {
1110
-		return EEH_Line_Item::get_tax_descendants( $this );
1110
+		return EEH_Line_Item::get_tax_descendants($this);
1111 1111
 	}
1112 1112
 
1113 1113
 
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 	 * @return EE_Line_Item[]
1118 1118
 	 */
1119 1119
 	public function get_items() {
1120
-		return EEH_Line_Item::get_line_item_descendants( $this );
1120
+		return EEH_Line_Item::get_line_item_descendants($this);
1121 1121
 	}
1122 1122
 
1123 1123
 
@@ -1133,22 +1133,22 @@  discard block
 block discarded – undo
1133 1133
 	 */
1134 1134
 	public function taxable_total() {
1135 1135
 		$total = 0;
1136
-		if ( $this->children() ) {
1137
-			foreach ( $this->children() as $child_line_item ) {
1138
-				if ( $child_line_item->type() === EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) {
1136
+		if ($this->children()) {
1137
+			foreach ($this->children() as $child_line_item) {
1138
+				if ($child_line_item->type() === EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) {
1139 1139
 					//if it's a percent item, only take into account the percent
1140 1140
 					//that's taxable too (the taxable total so far)
1141
-					if( $child_line_item->is_percent() ) {
1142
-						$total = $total + ( $total * $child_line_item->percent() / 100 );
1143
-					}else{
1141
+					if ($child_line_item->is_percent()) {
1142
+						$total = $total + ($total * $child_line_item->percent() / 100);
1143
+					} else {
1144 1144
 						$total += $child_line_item->total();
1145 1145
 					}
1146
-				}elseif( $child_line_item->type() === EEM_Line_Item::type_sub_total ){
1146
+				}elseif ($child_line_item->type() === EEM_Line_Item::type_sub_total) {
1147 1147
 					$total += $child_line_item->taxable_total();
1148 1148
 				}
1149 1149
 			}
1150 1150
 		}
1151
-		return max( $total, 0 );
1151
+		return max($total, 0);
1152 1152
 	}
1153 1153
 
1154 1154
 
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 	 * @return EE_Transaction
1159 1159
 	 */
1160 1160
 	public function transaction() {
1161
-		return $this->get_first_related( 'Transaction' );
1161
+		return $this->get_first_related('Transaction');
1162 1162
 	}
1163 1163
 
1164 1164
 
@@ -1171,18 +1171,18 @@  discard block
 block discarded – undo
1171 1171
 	 * @param int $txn_id if none is provided, assumes $this->TXN_ID()
1172 1172
 	 * @return int count of items saved
1173 1173
 	 */
1174
-	public function save_this_and_descendants_to_txn( $txn_id = NULL ) {
1174
+	public function save_this_and_descendants_to_txn($txn_id = NULL) {
1175 1175
 		$count = 0;
1176
-		if ( ! $txn_id ) {
1176
+		if ( ! $txn_id) {
1177 1177
 			$txn_id = $this->TXN_ID();
1178 1178
 		}
1179
-		$this->set_TXN_ID( $txn_id );
1179
+		$this->set_TXN_ID($txn_id);
1180 1180
 		$children = $this->children();
1181 1181
 		$count += $this->save() ? 1 : 0;
1182
-		foreach ( $children as $child_line_item ) {
1183
-			if ( $child_line_item instanceof EE_Line_Item ) {
1184
-				$child_line_item->set_parent_ID( $this->ID() );
1185
-				$count += $child_line_item->save_this_and_descendants_to_txn( $txn_id );
1182
+		foreach ($children as $child_line_item) {
1183
+			if ($child_line_item instanceof EE_Line_Item) {
1184
+				$child_line_item->set_parent_ID($this->ID());
1185
+				$count += $child_line_item->save_this_and_descendants_to_txn($txn_id);
1186 1186
 			}
1187 1187
 		}
1188 1188
 		return $count;
@@ -1199,9 +1199,9 @@  discard block
 block discarded – undo
1199 1199
 		$count = 0;
1200 1200
 		$children = $this->children();
1201 1201
 		$count += $this->save() ? 1 : 0;
1202
-		foreach ( $children as $child_line_item ) {
1203
-			if ( $child_line_item instanceof EE_Line_Item ) {
1204
-				$child_line_item->set_parent_ID( $this->ID() );
1202
+		foreach ($children as $child_line_item) {
1203
+			if ($child_line_item instanceof EE_Line_Item) {
1204
+				$child_line_item->set_parent_ID($this->ID());
1205 1205
 				$count += $child_line_item->save_this_and_descendants();
1206 1206
 			}
1207 1207
 		}
@@ -1215,8 +1215,8 @@  discard block
 block discarded – undo
1215 1215
 	 * @return EE_Line_Item[]
1216 1216
 	 */
1217 1217
 	function get_cancellations() {
1218
-		EE_Registry::instance()->load_helper( 'Line_Item' );
1219
-		return EEH_Line_Item::get_descendants_of_type( $this, EEM_Line_Item::type_cancellation );
1218
+		EE_Registry::instance()->load_helper('Line_Item');
1219
+		return EEH_Line_Item::get_descendants_of_type($this, EEM_Line_Item::type_cancellation);
1220 1220
 	}
1221 1221
 
1222 1222
 
@@ -1226,9 +1226,9 @@  discard block
 block discarded – undo
1226 1226
 	 * @param string $type one of the constants on EEM_Line_Item
1227 1227
 	 * @return EE_Line_Item[]
1228 1228
 	 */
1229
-	protected function _get_descendants_of_type( $type ) {
1230
-		EE_Error::doing_it_wrong( 'EE_Line_Item::_get_descendants_of_type()', __('Method replaced with EEH_Line_Item::get_descendants_of_type()', 'event_espresso'), '4.6.0' );
1231
-		return EEH_Line_Item::get_descendants_of_type( $this, $type );
1229
+	protected function _get_descendants_of_type($type) {
1230
+		EE_Error::doing_it_wrong('EE_Line_Item::_get_descendants_of_type()', __('Method replaced with EEH_Line_Item::get_descendants_of_type()', 'event_espresso'), '4.6.0');
1231
+		return EEH_Line_Item::get_descendants_of_type($this, $type);
1232 1232
 	}
1233 1233
 
1234 1234
 
@@ -1238,9 +1238,9 @@  discard block
 block discarded – undo
1238 1238
 	 * @param string $type like one of the EEM_Line_Item::type_*
1239 1239
 	 * @return EE_Line_Item
1240 1240
 	 */
1241
-	public function get_nearest_descendant_of_type( $type ) {
1242
-		EE_Error::doing_it_wrong( 'EE_Line_Item::get_nearest_descendant_of_type()', __('Method replaced with EEH_Line_Item::get_nearest_descendant_of_type()', 'event_espresso'), '4.6.0' );
1243
-		return EEH_Line_Item::get_nearest_descendant_of_type( $this, $type );
1241
+	public function get_nearest_descendant_of_type($type) {
1242
+		EE_Error::doing_it_wrong('EE_Line_Item::get_nearest_descendant_of_type()', __('Method replaced with EEH_Line_Item::get_nearest_descendant_of_type()', 'event_espresso'), '4.6.0');
1243
+		return EEH_Line_Item::get_nearest_descendant_of_type($this, $type);
1244 1244
 	}
1245 1245
 
1246 1246
 
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
 	 * @return int count of items saved
1252 1252
 	 */
1253 1253
 	public function maybe_save() {
1254
-		if ( $this->ID() ) {
1254
+		if ($this->ID()) {
1255 1255
 			return $this->save();
1256 1256
 		}
1257 1257
 		return false;
Please login to merge, or discard this patch.
core/helpers/EEH_Line_Item.helper.php 1 patch
Spacing   +346 added lines, -346 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,15 +123,15 @@  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
-		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total() ) {
128
-			throw new EE_Error( sprintf( __( 'A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso' ), $ticket->ID(), $total_line_item->ID() ) );
126
+	public static function add_ticket_purchase(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
127
+		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total()) {
128
+			throw new EE_Error(sprintf(__('A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso'), $ticket->ID(), $total_line_item->ID()));
129 129
 		}
130 130
 		// either increment the qty for an existing ticket
131
-		$line_item = self::increment_ticket_qty_if_already_in_cart( $total_line_item, $ticket, $qty );
131
+		$line_item = self::increment_ticket_qty_if_already_in_cart($total_line_item, $ticket, $qty);
132 132
 		// or add a new one
133
-		if ( ! $line_item instanceof EE_Line_Item ) {
134
-			$line_item = self::create_ticket_line_item( $total_line_item, $ticket, $qty );
133
+		if ( ! $line_item instanceof EE_Line_Item) {
134
+			$line_item = self::create_ticket_line_item($total_line_item, $ticket, $qty);
135 135
 		}
136 136
 		$total_line_item->recalculate_total_including_taxes();
137 137
 		return $line_item;
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 	 * @return \EE_Line_Item
148 148
 	 * @throws \EE_Error
149 149
 	 */
150
-	public static function increment_ticket_qty_if_already_in_cart( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
150
+	public static function increment_ticket_qty_if_already_in_cart(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
151 151
 		$line_item = null;
152
-		if ( $total_line_item instanceof EE_Line_Item && $total_line_item->is_total() ) {
153
-			$ticket_line_items = EEH_Line_Item::get_ticket_line_items( $total_line_item );
154
-			foreach ( (array)$ticket_line_items as $ticket_line_item ) {
152
+		if ($total_line_item instanceof EE_Line_Item && $total_line_item->is_total()) {
153
+			$ticket_line_items = EEH_Line_Item::get_ticket_line_items($total_line_item);
154
+			foreach ((array) $ticket_line_items as $ticket_line_item) {
155 155
 				if (
156 156
 					$ticket_line_item instanceof EE_Line_Item
157 157
 					&& (int) $ticket_line_item->OBJ_ID() === (int) $ticket->ID()
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 				}
162 162
 			}
163 163
 		}
164
-		if ( $line_item instanceof EE_Line_Item ) {
165
-			EEH_Line_Item::increment_quantity( $line_item, $qty );
164
+		if ($line_item instanceof EE_Line_Item) {
165
+			EEH_Line_Item::increment_quantity($line_item, $qty);
166 166
 			return $line_item;
167 167
 		}
168 168
 		return null;
@@ -179,16 +179,16 @@  discard block
 block discarded – undo
179 179
 	 * @return void
180 180
 	 * @throws \EE_Error
181 181
 	 */
182
-	public static function increment_quantity( EE_Line_Item $line_item, $qty = 1 ) {
183
-		if( ! $line_item->is_percent() ) {
182
+	public static function increment_quantity(EE_Line_Item $line_item, $qty = 1) {
183
+		if ( ! $line_item->is_percent()) {
184 184
 			$qty += $line_item->quantity();
185
-			$line_item->set_quantity( $qty );
186
-			$line_item->set_total( $line_item->unit_price() * $qty );
185
+			$line_item->set_quantity($qty);
186
+			$line_item->set_total($line_item->unit_price() * $qty);
187 187
 			$line_item->save();
188 188
 		}
189
-		foreach( $line_item->children() as $child ) {
190
-			if( $child->is_sub_line_item() ) {
191
-				EEH_Line_Item::update_quantity( $child, $qty );
189
+		foreach ($line_item->children() as $child) {
190
+			if ($child->is_sub_line_item()) {
191
+				EEH_Line_Item::update_quantity($child, $qty);
192 192
 			}
193 193
 		}
194 194
 	}
@@ -204,17 +204,17 @@  discard block
 block discarded – undo
204 204
 	 * @return void
205 205
 	 * @throws \EE_Error
206 206
 	 */
207
-	public static function decrement_quantity( EE_Line_Item $line_item, $qty = 1 ) {
208
-		if( ! $line_item->is_percent() ) {
207
+	public static function decrement_quantity(EE_Line_Item $line_item, $qty = 1) {
208
+		if ( ! $line_item->is_percent()) {
209 209
 			$qty = $line_item->quantity() - $qty;
210
-			$qty = max( $qty, 0 );
211
-			$line_item->set_quantity( $qty );
212
-			$line_item->set_total( $line_item->unit_price() * $qty );
210
+			$qty = max($qty, 0);
211
+			$line_item->set_quantity($qty);
212
+			$line_item->set_total($line_item->unit_price() * $qty);
213 213
 			$line_item->save();
214 214
 		}
215
-		foreach( $line_item->children() as $child ) {
216
-			if( $child->is_sub_line_item() ) {
217
-				EEH_Line_Item::update_quantity( $child, $qty );
215
+		foreach ($line_item->children() as $child) {
216
+			if ($child->is_sub_line_item()) {
217
+				EEH_Line_Item::update_quantity($child, $qty);
218 218
 			}
219 219
 		}
220 220
 	}
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
 	 * @param int          $new_quantity
230 230
 	 * @throws \EE_Error
231 231
 	 */
232
-	public static function update_quantity( EE_Line_Item $line_item, $new_quantity ) {
233
-		if( ! $line_item->is_percent() ) {
234
-			$line_item->set_quantity( $new_quantity );
235
-			$line_item->set_total( $line_item->unit_price() * $new_quantity );
232
+	public static function update_quantity(EE_Line_Item $line_item, $new_quantity) {
233
+		if ( ! $line_item->is_percent()) {
234
+			$line_item->set_quantity($new_quantity);
235
+			$line_item->set_total($line_item->unit_price() * $new_quantity);
236 236
 			$line_item->save();
237 237
 		}
238
-		foreach( $line_item->children() as $child ) {
239
-			if( $child->is_sub_line_item() ) {
240
-				EEH_Line_Item::update_quantity( $child, $new_quantity );
238
+		foreach ($line_item->children() as $child) {
239
+			if ($child->is_sub_line_item()) {
240
+				EEH_Line_Item::update_quantity($child, $new_quantity);
241 241
 			}
242 242
 		}
243 243
 	}
@@ -252,43 +252,43 @@  discard block
 block discarded – undo
252 252
 	 * @return \EE_Line_Item
253 253
 	 * @throws \EE_Error
254 254
 	 */
255
-	public static function create_ticket_line_item( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
255
+	public static function create_ticket_line_item(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
256 256
 		$datetimes = $ticket->datetimes();
257
-		$first_datetime = reset( $datetimes );
258
-		if( $first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event ) {
257
+		$first_datetime = reset($datetimes);
258
+		if ($first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event) {
259 259
 			$first_datetime_name = $first_datetime->event()->name();
260 260
 		} else {
261
-			$first_datetime_name = __( 'Event', 'event_espresso' );
261
+			$first_datetime_name = __('Event', 'event_espresso');
262 262
 		}
263
-		$event = sprintf( _x( '(For %1$s)', '(For Event Name)', 'event_espresso' ), $first_datetime_name );
263
+		$event = sprintf(_x('(For %1$s)', '(For Event Name)', 'event_espresso'), $first_datetime_name);
264 264
 		// get event subtotal line
265
-		$events_sub_total = self::get_event_line_item_for_ticket( $total_line_item, $ticket );
265
+		$events_sub_total = self::get_event_line_item_for_ticket($total_line_item, $ticket);
266 266
 		// add $ticket to cart
267
-		$line_item = EE_Line_Item::new_instance( array(
267
+		$line_item = EE_Line_Item::new_instance(array(
268 268
 			'LIN_name'       	=> $ticket->name(),
269
-			'LIN_desc'       		=> $ticket->description() !== '' ? $ticket->description() . ' ' . $event : $event,
269
+			'LIN_desc'       		=> $ticket->description() !== '' ? $ticket->description().' '.$event : $event,
270 270
 			'LIN_unit_price' 	=> $ticket->price(),
271 271
 			'LIN_quantity'   	=> $qty,
272 272
 			'LIN_is_taxable' 	=> $ticket->taxable(),
273
-			'LIN_order'      	=> count( $events_sub_total->children() ),
273
+			'LIN_order'      	=> count($events_sub_total->children()),
274 274
 			'LIN_total'      		=> $ticket->price() * $qty,
275 275
 			'LIN_type'       		=> EEM_Line_Item::type_line_item,
276 276
 			'OBJ_ID'         		=> $ticket->ID(),
277 277
 			'OBJ_type'       	=> 'Ticket'
278
-		) );
278
+		));
279 279
 		$line_item = apply_filters(
280 280
 			'FHEE__EEH_Line_Item__create_ticket_line_item__line_item',
281 281
 			$line_item
282 282
 		);
283
-		$events_sub_total->add_child_line_item( $line_item );
283
+		$events_sub_total->add_child_line_item($line_item);
284 284
 		//now add the sub-line items
285 285
 		$running_total_for_ticket = 0;
286
-		foreach ( $ticket->prices( array( 'order_by' => array( 'PRC_order' => 'ASC' ) ) ) as $price ) {
286
+		foreach ($ticket->prices(array('order_by' => array('PRC_order' => 'ASC'))) as $price) {
287 287
 			$sign = $price->is_discount() ? -1 : 1;
288 288
 			$price_total = $price->is_percent()
289 289
 				? $running_total_for_ticket * $price->amount() / 100
290 290
 				: $price->amount() * $qty;
291
-			$sub_line_item = EE_Line_Item::new_instance( array(
291
+			$sub_line_item = EE_Line_Item::new_instance(array(
292 292
 				'LIN_name'       	=> $price->name(),
293 293
 				'LIN_desc'       		=> $price->desc(),
294 294
 				'LIN_quantity'   	=> $price->is_percent() ? null : $qty,
@@ -298,18 +298,18 @@  discard block
 block discarded – undo
298 298
 				'LIN_type'       		=> EEM_Line_Item::type_sub_line_item,
299 299
 				'OBJ_ID'         		=> $price->ID(),
300 300
 				'OBJ_type'       	=> 'Price'
301
-			) );
301
+			));
302 302
 			$sub_line_item = apply_filters(
303 303
 				'FHEE__EEH_Line_Item__create_ticket_line_item__sub_line_item',
304 304
 				$sub_line_item
305 305
 			);
306
-			if ( $price->is_percent() ) {
307
-				$sub_line_item->set_percent( $sign * $price->amount() );
306
+			if ($price->is_percent()) {
307
+				$sub_line_item->set_percent($sign * $price->amount());
308 308
 			} else {
309
-				$sub_line_item->set_unit_price( $sign * $price->amount() );
309
+				$sub_line_item->set_unit_price($sign * $price->amount());
310 310
 			}
311 311
 			$running_total_for_ticket += $price_total;
312
-			$line_item->add_child_line_item( $sub_line_item );
312
+			$line_item->add_child_line_item($sub_line_item);
313 313
 		}
314 314
 		return $line_item;
315 315
 	}
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 	 * @return boolean
330 330
 	 * @throws \EE_Error
331 331
 	 */
332
-	public static function add_item( EE_Line_Item $total_line_item, EE_Line_Item $item ){
333
-		$pre_tax_subtotal = self::get_pre_tax_subtotal( $total_line_item );
334
-		if ( $pre_tax_subtotal instanceof EE_Line_Item ){
332
+	public static function add_item(EE_Line_Item $total_line_item, EE_Line_Item $item) {
333
+		$pre_tax_subtotal = self::get_pre_tax_subtotal($total_line_item);
334
+		if ($pre_tax_subtotal instanceof EE_Line_Item) {
335 335
 			$success = $pre_tax_subtotal->add_child_line_item($item);
336
-		}else{
336
+		} else {
337 337
 			return FALSE;
338 338
 		}
339 339
 		$total_line_item->recalculate_total_including_taxes();
@@ -352,34 +352,34 @@  discard block
 block discarded – undo
352 352
 	 * @return bool success
353 353
 	 * @throws \EE_Error
354 354
 	 */
355
-	public static function cancel_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) {
355
+	public static function cancel_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1) {
356 356
 		// validate incoming line_item
357
-		if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) {
357
+		if ($ticket_line_item->OBJ_type() !== 'Ticket') {
358 358
 			throw new EE_Error(
359 359
 				sprintf(
360
-					__( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ),
360
+					__('The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso'),
361 361
 					$ticket_line_item->type()
362 362
 				)
363 363
 			);
364 364
 		}
365
-		if ( $ticket_line_item->quantity() < $qty ) {
365
+		if ($ticket_line_item->quantity() < $qty) {
366 366
 			throw new EE_Error(
367 367
 				sprintf(
368
-					__( 'Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.', 'event_espresso' ),
368
+					__('Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.', 'event_espresso'),
369 369
 					$qty,
370 370
 					$ticket_line_item->quantity()
371 371
 				)
372 372
 			);
373 373
 		}
374 374
 		// decrement ticket quantity; don't rely on auto-fixing when recalculating totals to do this
375
-		$ticket_line_item->set_quantity( $ticket_line_item->quantity() - $qty );
376
-		foreach( $ticket_line_item->children() as $child_line_item ) {
377
-			if(
375
+		$ticket_line_item->set_quantity($ticket_line_item->quantity() - $qty);
376
+		foreach ($ticket_line_item->children() as $child_line_item) {
377
+			if (
378 378
 				$child_line_item->is_sub_line_item()
379 379
 				&& ! $child_line_item->is_percent()
380 380
 				&& ! $child_line_item->is_cancellation()
381 381
 			) {
382
-				$child_line_item->set_quantity( $child_line_item->quantity() - $qty );
382
+				$child_line_item->set_quantity($child_line_item->quantity() - $qty);
383 383
 			}
384 384
 		}
385 385
 		// get cancellation sub line item
@@ -387,37 +387,37 @@  discard block
 block discarded – undo
387 387
 			$ticket_line_item,
388 388
 			EEM_Line_Item::type_cancellation
389 389
 		);
390
-		$cancellation_line_item = reset( $cancellation_line_item );
390
+		$cancellation_line_item = reset($cancellation_line_item);
391 391
 		// verify that this ticket was indeed previously cancelled
392
-		if ( $cancellation_line_item instanceof EE_Line_Item ) {
392
+		if ($cancellation_line_item instanceof EE_Line_Item) {
393 393
 			// increment cancelled quantity
394
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() + $qty );
394
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() + $qty);
395 395
 		} else {
396 396
 			// create cancellation sub line item
397
-			$cancellation_line_item = EE_Line_Item::new_instance( array(
398
-				'LIN_name'       => __( 'Cancellation', 'event_espresso' ),
397
+			$cancellation_line_item = EE_Line_Item::new_instance(array(
398
+				'LIN_name'       => __('Cancellation', 'event_espresso'),
399 399
 				'LIN_desc'       => sprintf(
400
-					_x( 'Cancelled %1$s : %2$s', 'Cancelled Ticket Name : 2015-01-01 11:11', 'event_espresso' ),
400
+					_x('Cancelled %1$s : %2$s', 'Cancelled Ticket Name : 2015-01-01 11:11', 'event_espresso'),
401 401
 					$ticket_line_item->name(),
402
-					current_time( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) )
402
+					current_time(get_option('date_format').' '.get_option('time_format'))
403 403
 				),
404 404
 				'LIN_unit_price' => 0, // $ticket_line_item->unit_price()
405 405
 				'LIN_quantity'   => $qty,
406 406
 				'LIN_is_taxable' => $ticket_line_item->is_taxable(),
407
-				'LIN_order'      => count( $ticket_line_item->children() ),
407
+				'LIN_order'      => count($ticket_line_item->children()),
408 408
 				'LIN_total'      => 0, // $ticket_line_item->unit_price()
409 409
 				'LIN_type'       => EEM_Line_Item::type_cancellation,
410
-			) );
411
-			$ticket_line_item->add_child_line_item( $cancellation_line_item );
410
+			));
411
+			$ticket_line_item->add_child_line_item($cancellation_line_item);
412 412
 		}
413
-		if ( $ticket_line_item->save_this_and_descendants() > 0 ) {
413
+		if ($ticket_line_item->save_this_and_descendants() > 0) {
414 414
 			// decrement parent line item quantity
415 415
 			$event_line_item = $ticket_line_item->parent();
416
-			if ( $event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event' ) {
417
-				$event_line_item->set_quantity( $event_line_item->quantity() - $qty );
416
+			if ($event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event') {
417
+				$event_line_item->set_quantity($event_line_item->quantity() - $qty);
418 418
 				$event_line_item->save();
419 419
 			}
420
-			EEH_Line_Item::get_grand_total_and_recalculate_everything( $ticket_line_item );
420
+			EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
421 421
 			return true;
422 422
 		}
423 423
 		return false;
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
 	 * @return bool success
436 436
 	 * @throws \EE_Error
437 437
 	 */
438
-	public static function reinstate_canceled_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) {
438
+	public static function reinstate_canceled_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1) {
439 439
 		// validate incoming line_item
440
-		if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) {
440
+		if ($ticket_line_item->OBJ_type() !== 'Ticket') {
441 441
 			throw new EE_Error(
442 442
 				sprintf(
443
-					__( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ),
443
+					__('The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso'),
444 444
 					$ticket_line_item->type()
445 445
 				)
446 446
 			);
@@ -450,42 +450,42 @@  discard block
 block discarded – undo
450 450
 			$ticket_line_item,
451 451
 			EEM_Line_Item::type_cancellation
452 452
 		);
453
-		$cancellation_line_item = reset( $cancellation_line_item );
453
+		$cancellation_line_item = reset($cancellation_line_item);
454 454
 		// verify that this ticket was indeed previously cancelled
455
-		if ( ! $cancellation_line_item instanceof EE_Line_Item ) {
455
+		if ( ! $cancellation_line_item instanceof EE_Line_Item) {
456 456
 			return false;
457 457
 		}
458
-		if ( $cancellation_line_item->quantity() > $qty ) {
458
+		if ($cancellation_line_item->quantity() > $qty) {
459 459
 			// decrement cancelled quantity
460
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() - $qty );
461
-		} else if ( $cancellation_line_item->quantity() == $qty ) {
460
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
461
+		} else if ($cancellation_line_item->quantity() == $qty) {
462 462
 			// decrement cancelled quantity in case anyone still has the object kicking around
463
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() - $qty );
463
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
464 464
 			// delete because quantity will end up as 0
465 465
 			$cancellation_line_item->delete();
466 466
 			// and attempt to destroy the object,
467 467
 			// even though PHP won't actually destroy it until it needs the memory
468
-			unset( $cancellation_line_item );
468
+			unset($cancellation_line_item);
469 469
 		} else {
470 470
 			// what ?!?! negative quantity ?!?!
471 471
 			throw new EE_Error(
472 472
 				sprintf(
473
-					__( 'Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.',
474
-						'event_espresso' ),
473
+					__('Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.',
474
+						'event_espresso'),
475 475
 					$qty,
476 476
 					$cancellation_line_item->quantity()
477 477
 				)
478 478
 			);
479 479
 		}
480 480
 		// increment ticket quantity
481
-		$ticket_line_item->set_quantity( $ticket_line_item->quantity() + $qty );
482
-		if ( $ticket_line_item->save_this_and_descendants() > 0 ) {
481
+		$ticket_line_item->set_quantity($ticket_line_item->quantity() + $qty);
482
+		if ($ticket_line_item->save_this_and_descendants() > 0) {
483 483
 			// increment parent line item quantity
484 484
 			$event_line_item = $ticket_line_item->parent();
485
-			if ( $event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event' ) {
486
-				$event_line_item->set_quantity( $event_line_item->quantity() + $qty );
485
+			if ($event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event') {
486
+				$event_line_item->set_quantity($event_line_item->quantity() + $qty);
487 487
 			}
488
-			EEH_Line_Item::get_grand_total_and_recalculate_everything( $ticket_line_item );
488
+			EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
489 489
 			return true;
490 490
 		}
491 491
 		return false;
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 	 * @param EE_Line_Item $line_item
501 501
 	 * @return \EE_Line_Item
502 502
 	 */
503
-	public static function get_grand_total_and_recalculate_everything( EE_Line_Item $line_item ){
504
-		$grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item( $line_item );
503
+	public static function get_grand_total_and_recalculate_everything(EE_Line_Item $line_item) {
504
+		$grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item);
505 505
 		return $grand_total_line_item->recalculate_total_including_taxes();
506 506
 	}
507 507
 
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 	 * @return \EE_Line_Item
515 515
 	 * @throws \EE_Error
516 516
 	 */
517
-	public static function get_pre_tax_subtotal( EE_Line_Item $total_line_item ){
518
-		$pre_tax_subtotal = $total_line_item->get_child_line_item( 'pre-tax-subtotal' );
517
+	public static function get_pre_tax_subtotal(EE_Line_Item $total_line_item) {
518
+		$pre_tax_subtotal = $total_line_item->get_child_line_item('pre-tax-subtotal');
519 519
 		return $pre_tax_subtotal instanceof EE_Line_Item
520 520
 			? $pre_tax_subtotal
521
-			: self::create_pre_tax_subtotal( $total_line_item );
521
+			: self::create_pre_tax_subtotal($total_line_item);
522 522
 	}
523 523
 
524 524
 
@@ -530,9 +530,9 @@  discard block
 block discarded – undo
530 530
 	 * @return \EE_Line_Item
531 531
 	 * @throws \EE_Error
532 532
 	 */
533
-	public static function get_taxes_subtotal( EE_Line_Item $total_line_item ){
534
-		$taxes = $total_line_item->get_child_line_item( 'taxes' );
535
-		return $taxes ? $taxes : self::create_taxes_subtotal( $total_line_item );
533
+	public static function get_taxes_subtotal(EE_Line_Item $total_line_item) {
534
+		$taxes = $total_line_item->get_child_line_item('taxes');
535
+		return $taxes ? $taxes : self::create_taxes_subtotal($total_line_item);
536 536
 	}
537 537
 
538 538
 
@@ -545,12 +545,12 @@  discard block
 block discarded – undo
545 545
 	 * @return void
546 546
 	 * @throws \EE_Error
547 547
 	 */
548
-	public static function set_TXN_ID( EE_Line_Item $line_item, $transaction = NULL ){
549
-		if( $transaction ){
548
+	public static function set_TXN_ID(EE_Line_Item $line_item, $transaction = NULL) {
549
+		if ($transaction) {
550 550
 			/** @type EEM_Transaction $EEM_Transaction */
551
-			$EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' );
552
-			$TXN_ID = $EEM_Transaction->ensure_is_ID( $transaction );
553
-			$line_item->set_TXN_ID( $TXN_ID );
551
+			$EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
552
+			$TXN_ID = $EEM_Transaction->ensure_is_ID($transaction);
553
+			$line_item->set_TXN_ID($TXN_ID);
554 554
 		}
555 555
 	}
556 556
 
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 	 * @return \EE_Line_Item of type total
566 566
 	 * @throws \EE_Error
567 567
 	 */
568
-	public static function create_total_line_item( $transaction = NULL ){
569
-		$total_line_item = EE_Line_Item::new_instance( array(
568
+	public static function create_total_line_item($transaction = NULL) {
569
+		$total_line_item = EE_Line_Item::new_instance(array(
570 570
 			'LIN_code'	=> 'total',
571 571
 			'LIN_name'	=> __('Grand Total', 'event_espresso'),
572 572
 			'LIN_type'	=> EEM_Line_Item::type_total,
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 			'FHEE__EEH_Line_Item__create_total_line_item__total_line_item',
577 577
 			$total_line_item
578 578
 		);
579
-		self::set_TXN_ID( $total_line_item, $transaction );
580
-		self::create_pre_tax_subtotal( $total_line_item, $transaction );
581
-		self::create_taxes_subtotal( $total_line_item, $transaction );
579
+		self::set_TXN_ID($total_line_item, $transaction);
580
+		self::create_pre_tax_subtotal($total_line_item, $transaction);
581
+		self::create_taxes_subtotal($total_line_item, $transaction);
582 582
 		return $total_line_item;
583 583
 	}
584 584
 
@@ -592,19 +592,19 @@  discard block
 block discarded – undo
592 592
 	 * @return EE_Line_Item
593 593
 	 * @throws \EE_Error
594 594
 	 */
595
-	protected static function create_pre_tax_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
596
-		$pre_tax_line_item = EE_Line_Item::new_instance( array(
595
+	protected static function create_pre_tax_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
596
+		$pre_tax_line_item = EE_Line_Item::new_instance(array(
597 597
 			'LIN_code' 	=> 'pre-tax-subtotal',
598
-			'LIN_name' 	=> __( 'Pre-Tax Subtotal', 'event_espresso' ),
598
+			'LIN_name' 	=> __('Pre-Tax Subtotal', 'event_espresso'),
599 599
 			'LIN_type' 	=> EEM_Line_Item::type_sub_total
600
-		) );
600
+		));
601 601
 		$pre_tax_line_item = apply_filters(
602 602
 			'FHEE__EEH_Line_Item__create_pre_tax_subtotal__pre_tax_line_item',
603 603
 			$pre_tax_line_item
604 604
 		);
605
-		self::set_TXN_ID( $pre_tax_line_item, $transaction );
606
-		$total_line_item->add_child_line_item( $pre_tax_line_item );
607
-		self::create_event_subtotal( $pre_tax_line_item, $transaction );
605
+		self::set_TXN_ID($pre_tax_line_item, $transaction);
606
+		$total_line_item->add_child_line_item($pre_tax_line_item);
607
+		self::create_event_subtotal($pre_tax_line_item, $transaction);
608 608
 		return $pre_tax_line_item;
609 609
 	}
610 610
 
@@ -619,21 +619,21 @@  discard block
 block discarded – undo
619 619
 	 * @return EE_Line_Item
620 620
 	 * @throws \EE_Error
621 621
 	 */
622
-	protected static function create_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
622
+	protected static function create_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
623 623
 		$tax_line_item = EE_Line_Item::new_instance(array(
624 624
 			'LIN_code'	=> 'taxes',
625 625
 			'LIN_name' 	=> __('Taxes', 'event_espresso'),
626 626
 			'LIN_type'	=> EEM_Line_Item::type_tax_sub_total,
627
-			'LIN_order' => 1000,//this should always come last
627
+			'LIN_order' => 1000, //this should always come last
628 628
 		));
629 629
 		$tax_line_item = apply_filters(
630 630
 			'FHEE__EEH_Line_Item__create_taxes_subtotal__tax_line_item',
631 631
 			$tax_line_item
632 632
 		);
633
-		self::set_TXN_ID( $tax_line_item, $transaction );
634
-		$total_line_item->add_child_line_item( $tax_line_item );
633
+		self::set_TXN_ID($tax_line_item, $transaction);
634
+		$total_line_item->add_child_line_item($tax_line_item);
635 635
 		//and lastly, add the actual taxes
636
-		self::apply_taxes( $total_line_item );
636
+		self::apply_taxes($total_line_item);
637 637
 		return $tax_line_item;
638 638
 	}
639 639
 
@@ -648,11 +648,11 @@  discard block
 block discarded – undo
648 648
 	 * @return EE_Line_Item
649 649
 	 * @throws \EE_Error
650 650
 	 */
651
-	public static function create_event_subtotal( EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL ){
651
+	public static function create_event_subtotal(EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL) {
652 652
 		$event_line_item = EE_Line_Item::new_instance(array(
653
-			'LIN_code'	=> self::get_event_code( $event ),
654
-			'LIN_name' 	=> self::get_event_name( $event ),
655
-			'LIN_desc' 	=> self::get_event_desc( $event ),
653
+			'LIN_code'	=> self::get_event_code($event),
654
+			'LIN_name' 	=> self::get_event_name($event),
655
+			'LIN_desc' 	=> self::get_event_desc($event),
656 656
 			'LIN_type'	=> EEM_Line_Item::type_sub_total,
657 657
 			'OBJ_type' 	=> 'Event',
658 658
 			'OBJ_ID' 		=>  $event instanceof EE_Event ? $event->ID() : 0
@@ -661,8 +661,8 @@  discard block
 block discarded – undo
661 661
 			'FHEE__EEH_Line_Item__create_event_subtotal__event_line_item',
662 662
 			$event_line_item
663 663
 		);
664
-		self::set_TXN_ID( $event_line_item, $transaction );
665
-		$pre_tax_line_item->add_child_line_item( $event_line_item );
664
+		self::set_TXN_ID($event_line_item, $transaction);
665
+		$pre_tax_line_item->add_child_line_item($event_line_item);
666 666
 		return $event_line_item;
667 667
 	}
668 668
 
@@ -675,8 +675,8 @@  discard block
 block discarded – undo
675 675
 	 * @return string
676 676
 	 * @throws \EE_Error
677 677
 	 */
678
-	public static function get_event_code( $event ) {
679
-		return 'event-' . ( $event instanceof EE_Event ? $event->ID() : '0' );
678
+	public static function get_event_code($event) {
679
+		return 'event-'.($event instanceof EE_Event ? $event->ID() : '0');
680 680
 	}
681 681
 
682 682
 	/**
@@ -684,8 +684,8 @@  discard block
 block discarded – undo
684 684
 	 * @param EE_Event $event
685 685
 	 * @return string
686 686
 	 */
687
-	public static function get_event_name( $event ) {
688
-		return $event instanceof EE_Event ? $event->name() : __( 'Event', 'event_espresso' );
687
+	public static function get_event_name($event) {
688
+		return $event instanceof EE_Event ? $event->name() : __('Event', 'event_espresso');
689 689
 	}
690 690
 
691 691
 	/**
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 * @param EE_Event $event
694 694
 	 * @return string
695 695
 	 */
696
-	public static function get_event_desc( $event ) {
696
+	public static function get_event_desc($event) {
697 697
 		return $event instanceof EE_Event ? $event->short_description() : '';
698 698
 	}
699 699
 
@@ -707,27 +707,27 @@  discard block
 block discarded – undo
707 707
 	  * @throws \EE_Error
708 708
 	  * @return EE_Line_Item
709 709
 	  */
710
-	public static function get_event_line_item_for_ticket( EE_Line_Item $grand_total, EE_Ticket $ticket ) {
710
+	public static function get_event_line_item_for_ticket(EE_Line_Item $grand_total, EE_Ticket $ticket) {
711 711
 		$first_datetime = $ticket->first_datetime();
712
-		if ( ! $first_datetime instanceof EE_Datetime ) {
712
+		if ( ! $first_datetime instanceof EE_Datetime) {
713 713
 			throw new EE_Error(
714
-				sprintf( __( 'The supplied ticket (ID %d) has no datetimes', 'event_espresso' ), $ticket->ID() )
714
+				sprintf(__('The supplied ticket (ID %d) has no datetimes', 'event_espresso'), $ticket->ID())
715 715
 			);
716 716
 		}
717 717
 		$event = $first_datetime->event();
718
-		if ( ! $event instanceof EE_Event ) {
718
+		if ( ! $event instanceof EE_Event) {
719 719
 			throw new EE_Error(
720 720
 				sprintf(
721
-					__( 'The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso' ),
721
+					__('The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso'),
722 722
 					$ticket->ID()
723 723
 				)
724 724
 			);
725 725
 		}
726
-		$events_sub_total = EEH_Line_Item::get_event_line_item( $grand_total, $event );
727
-		if ( ! $events_sub_total instanceof EE_Line_Item ) {
726
+		$events_sub_total = EEH_Line_Item::get_event_line_item($grand_total, $event);
727
+		if ( ! $events_sub_total instanceof EE_Line_Item) {
728 728
 			throw new EE_Error(
729 729
 				sprintf(
730
-					__( 'There is no events sub-total for ticket %s on total line item %d', 'event_espresso' ),
730
+					__('There is no events sub-total for ticket %s on total line item %d', 'event_espresso'),
731 731
 					$ticket->ID(),
732 732
 					$grand_total->ID()
733 733
 				)
@@ -746,31 +746,31 @@  discard block
 block discarded – undo
746 746
 	 * @return EE_Line_Item for the event subtotal which is a child of $grand_total
747 747
 	 * @throws \EE_Error
748 748
 	 */
749
-	public static function get_event_line_item( EE_Line_Item $grand_total, $event ) {
749
+	public static function get_event_line_item(EE_Line_Item $grand_total, $event) {
750 750
 		/** @type EE_Event $event */
751
-		$event = EEM_Event::instance()->ensure_is_obj( $event, true );
751
+		$event = EEM_Event::instance()->ensure_is_obj($event, true);
752 752
 		$event_line_item = NULL;
753 753
 		$found = false;
754
-		foreach ( EEH_Line_Item::get_event_subtotals( $grand_total ) as $event_line_item ) {
754
+		foreach (EEH_Line_Item::get_event_subtotals($grand_total) as $event_line_item) {
755 755
 			// default event subtotal, we should only ever find this the first time this method is called
756
-			if ( ! $event_line_item->OBJ_ID() ) {
756
+			if ( ! $event_line_item->OBJ_ID()) {
757 757
 				// let's use this! but first... set the event details
758
-				EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
758
+				EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
759 759
 				$found = true;
760 760
 				break;
761
-			} else if ( $event_line_item->OBJ_ID() === $event->ID() ) {
761
+			} else if ($event_line_item->OBJ_ID() === $event->ID()) {
762 762
 				// found existing line item for this event in the cart, so break out of loop and use this one
763 763
 				$found = true;
764 764
 				break;
765 765
 			}
766 766
 		}
767
-		if ( ! $found ) {
767
+		if ( ! $found) {
768 768
 			//there is no event sub-total yet, so add it
769
-			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal( $grand_total );
769
+			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal($grand_total);
770 770
 			// create a new "event" subtotal below that
771
-			$event_line_item = EEH_Line_Item::create_event_subtotal( $pre_tax_subtotal, null, $event );
771
+			$event_line_item = EEH_Line_Item::create_event_subtotal($pre_tax_subtotal, null, $event);
772 772
 			// and set the event details
773
-			EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
773
+			EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
774 774
 		}
775 775
 		return $event_line_item;
776 776
 	}
@@ -791,13 +791,13 @@  discard block
 block discarded – undo
791 791
 		EE_Event $event,
792 792
 		$transaction = null
793 793
 	) {
794
-		if ( $event instanceof EE_Event ) {
795
-			$event_line_item->set_code( self::get_event_code( $event ) );
796
-			$event_line_item->set_name( self::get_event_name( $event ) );
797
-			$event_line_item->set_desc( self::get_event_desc( $event ) );
798
-			$event_line_item->set_OBJ_ID( $event->ID() );
794
+		if ($event instanceof EE_Event) {
795
+			$event_line_item->set_code(self::get_event_code($event));
796
+			$event_line_item->set_name(self::get_event_name($event));
797
+			$event_line_item->set_desc(self::get_event_desc($event));
798
+			$event_line_item->set_OBJ_ID($event->ID());
799 799
 		}
800
-		self::set_TXN_ID( $event_line_item, $transaction );
800
+		self::set_TXN_ID($event_line_item, $transaction);
801 801
 	}
802 802
 
803 803
 
@@ -810,19 +810,19 @@  discard block
 block discarded – undo
810 810
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
811 811
 	 * @throws \EE_Error
812 812
 	 */
813
-	public static function apply_taxes( EE_Line_Item $total_line_item ){
813
+	public static function apply_taxes(EE_Line_Item $total_line_item) {
814 814
 		/** @type EEM_Price $EEM_Price */
815
-		$EEM_Price = EE_Registry::instance()->load_model( 'Price' );
815
+		$EEM_Price = EE_Registry::instance()->load_model('Price');
816 816
 		// get array of taxes via Price Model
817 817
 		$ordered_taxes = $EEM_Price->get_all_prices_that_are_taxes();
818
-		ksort( $ordered_taxes );
819
-		$taxes_line_item = self::get_taxes_subtotal( $total_line_item );
818
+		ksort($ordered_taxes);
819
+		$taxes_line_item = self::get_taxes_subtotal($total_line_item);
820 820
 		//just to be safe, remove its old tax line items
821 821
 		$taxes_line_item->delete_children_line_items();
822 822
 		//loop thru taxes
823
-		foreach ( $ordered_taxes as $order => $taxes ) {
824
-			foreach ( $taxes as $tax ) {
825
-				if ( $tax instanceof EE_Price ) {
823
+		foreach ($ordered_taxes as $order => $taxes) {
824
+			foreach ($taxes as $tax) {
825
+				if ($tax instanceof EE_Price) {
826 826
 					$tax_line_item = EE_Line_Item::new_instance(
827 827
 						array(
828 828
 							'LIN_name'       => $tax->name(),
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 						'FHEE__EEH_Line_Item__apply_taxes__tax_line_item',
841 841
 						$tax_line_item
842 842
 					);
843
-					$taxes_line_item->add_child_line_item( $tax_line_item );
843
+					$taxes_line_item->add_child_line_item($tax_line_item);
844 844
 				}
845 845
 			}
846 846
 		}
@@ -857,10 +857,10 @@  discard block
 block discarded – undo
857 857
 	 * @return float
858 858
 	 * @throws \EE_Error
859 859
 	 */
860
-	public static function ensure_taxes_applied( $total_line_item ){
861
-		$taxes_subtotal = self::get_taxes_subtotal( $total_line_item );
862
-		if( ! $taxes_subtotal->children()){
863
-			self::apply_taxes( $total_line_item );
860
+	public static function ensure_taxes_applied($total_line_item) {
861
+		$taxes_subtotal = self::get_taxes_subtotal($total_line_item);
862
+		if ( ! $taxes_subtotal->children()) {
863
+			self::apply_taxes($total_line_item);
864 864
 		}
865 865
 		return $taxes_subtotal->total();
866 866
 	}
@@ -874,16 +874,16 @@  discard block
 block discarded – undo
874 874
 	 * @return bool
875 875
 	 * @throws \EE_Error
876 876
 	 */
877
-	public static function delete_all_child_items( EE_Line_Item $parent_line_item ) {
877
+	public static function delete_all_child_items(EE_Line_Item $parent_line_item) {
878 878
 		$deleted = 0;
879
-		foreach ( $parent_line_item->children() as $child_line_item ) {
880
-			if ( $child_line_item instanceof EE_Line_Item ) {
881
-				$deleted += EEH_Line_Item::delete_all_child_items( $child_line_item );
882
-				if ( $child_line_item->ID() ) {
879
+		foreach ($parent_line_item->children() as $child_line_item) {
880
+			if ($child_line_item instanceof EE_Line_Item) {
881
+				$deleted += EEH_Line_Item::delete_all_child_items($child_line_item);
882
+				if ($child_line_item->ID()) {
883 883
 					$child_line_item->delete();
884
-					unset( $child_line_item );
884
+					unset($child_line_item);
885 885
 				} else {
886
-					$parent_line_item->delete_child_line_item( $child_line_item->code() );
886
+					$parent_line_item->delete_child_line_item($child_line_item->code());
887 887
 				}
888 888
 				$deleted++;
889 889
 			}
@@ -905,9 +905,9 @@  discard block
 block discarded – undo
905 905
 	 * @param array|bool|string $line_item_codes
906 906
 	 * @return int number of items successfully removed
907 907
 	 */
908
-	public static function delete_items( EE_Line_Item $total_line_item, $line_item_codes = FALSE ) {
908
+	public static function delete_items(EE_Line_Item $total_line_item, $line_item_codes = FALSE) {
909 909
 
910
-		if( $total_line_item->type() !== EEM_Line_Item::type_total ){
910
+		if ($total_line_item->type() !== EEM_Line_Item::type_total) {
911 911
 			EE_Error::doing_it_wrong(
912 912
 				'EEH_Line_Item::delete_items',
913 913
 				__(
@@ -917,20 +917,20 @@  discard block
 block discarded – undo
917 917
 				'4.6.18'
918 918
 			);
919 919
 		}
920
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
920
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
921 921
 
922 922
 		// check if only a single line_item_id was passed
923
-		if ( ! empty( $line_item_codes ) && ! is_array( $line_item_codes )) {
923
+		if ( ! empty($line_item_codes) && ! is_array($line_item_codes)) {
924 924
 			// place single line_item_id in an array to appear as multiple line_item_ids
925
-			$line_item_codes = array ( $line_item_codes );
925
+			$line_item_codes = array($line_item_codes);
926 926
 		}
927 927
 		$removals = 0;
928 928
 		// cycle thru line_item_ids
929
-		foreach ( $line_item_codes as $line_item_id ) {
929
+		foreach ($line_item_codes as $line_item_id) {
930 930
 			$removals += $total_line_item->delete_child_line_item($line_item_id);
931 931
 		}
932 932
 
933
-		if ( $removals > 0 ) {
933
+		if ($removals > 0) {
934 934
 			$total_line_item->recalculate_taxes_and_tax_total();
935 935
 			return $removals;
936 936
 		} else {
@@ -963,33 +963,33 @@  discard block
 block discarded – undo
963 963
 		$code = null,
964 964
 		$add_to_existing_line_item = false
965 965
 	) {
966
-		$tax_subtotal = self::get_taxes_subtotal( $total_line_item );
966
+		$tax_subtotal = self::get_taxes_subtotal($total_line_item);
967 967
             $taxable_total = $total_line_item->taxable_total();
968 968
 
969
-            if( $add_to_existing_line_item ) {
970
-                $new_tax = $tax_subtotal->get_child_line_item( $code );
969
+            if ($add_to_existing_line_item) {
970
+                $new_tax = $tax_subtotal->get_child_line_item($code);
971 971
 	            EEM_Line_Item::instance()->delete(
972
-		            array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) )
972
+		            array(array('LIN_code' => array('!=', $code), 'LIN_parent' => $tax_subtotal->ID()))
973 973
 	            );
974 974
             } else {
975 975
                 $new_tax = null;
976 976
                 $tax_subtotal->delete_children_line_items();
977 977
             }
978
-            if( $new_tax ) {
979
-                $new_tax->set_total( $new_tax->total() + $amount );
980
-                $new_tax->set_percent( $taxable_total ? $new_tax->total() / $taxable_total * 100 : 0 );
978
+            if ($new_tax) {
979
+                $new_tax->set_total($new_tax->total() + $amount);
980
+                $new_tax->set_percent($taxable_total ? $new_tax->total() / $taxable_total * 100 : 0);
981 981
             } else {
982 982
                 //no existing tax item. Create it
983
-				$new_tax = EE_Line_Item::new_instance( array(
983
+				$new_tax = EE_Line_Item::new_instance(array(
984 984
 					'TXN_ID'      => $total_line_item->TXN_ID(),
985
-					'LIN_name'    => $name ? $name : __( 'Tax', 'event_espresso' ),
985
+					'LIN_name'    => $name ? $name : __('Tax', 'event_espresso'),
986 986
 					'LIN_desc'    => $description ? $description : '',
987
-					'LIN_percent' => $taxable_total ? ( $amount / $taxable_total * 100 ) : 0,
987
+					'LIN_percent' => $taxable_total ? ($amount / $taxable_total * 100) : 0,
988 988
 					'LIN_total'   => $amount,
989 989
 					'LIN_parent'  => $tax_subtotal->ID(),
990 990
 					'LIN_type'    => EEM_Line_Item::type_tax,
991 991
 					'LIN_code'    => $code
992
-				) );
992
+				));
993 993
 			}
994 994
 
995 995
             $new_tax = apply_filters(
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 				$total_line_item
999 999
             );
1000 1000
             $new_tax->save();
1001
-            $tax_subtotal->set_total( $new_tax->total() );
1001
+            $tax_subtotal->set_total($new_tax->total());
1002 1002
             $tax_subtotal->save();
1003 1003
             $total_line_item->recalculate_total_including_taxes();
1004 1004
             return $new_tax;
@@ -1020,14 +1020,14 @@  discard block
 block discarded – undo
1020 1020
 		$code_substring_for_whitelist = null
1021 1021
 	) {
1022 1022
 		$whitelisted = false;
1023
-		if( $code_substring_for_whitelist !== null ) {
1024
-			$whitelisted = strpos( $line_item->code(), $code_substring_for_whitelist ) !== false ? true : false;
1023
+		if ($code_substring_for_whitelist !== null) {
1024
+			$whitelisted = strpos($line_item->code(), $code_substring_for_whitelist) !== false ? true : false;
1025 1025
 		}
1026
-		if( ! $whitelisted && $line_item->is_line_item() ) {
1027
-			$line_item->set_is_taxable( $taxable );
1026
+		if ( ! $whitelisted && $line_item->is_line_item()) {
1027
+			$line_item->set_is_taxable($taxable);
1028 1028
 		}
1029
-		foreach( $line_item->children() as $child_line_item ) {
1030
-			EEH_Line_Item::set_line_items_taxable( $child_line_item, $taxable, $code_substring_for_whitelist );
1029
+		foreach ($line_item->children() as $child_line_item) {
1030
+			EEH_Line_Item::set_line_items_taxable($child_line_item, $taxable, $code_substring_for_whitelist);
1031 1031
 		}
1032 1032
 	}
1033 1033
 
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1041 1041
 	 * @return EE_Line_Item[]
1042 1042
 	 */
1043
-	public static function get_event_subtotals( EE_Line_Item $parent_line_item ) {
1044
-		return self::get_subtotals_of_object_type( $parent_line_item, 'Event' );
1043
+	public static function get_event_subtotals(EE_Line_Item $parent_line_item) {
1044
+		return self::get_subtotals_of_object_type($parent_line_item, 'Event');
1045 1045
 	}
1046 1046
 
1047 1047
 
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 	 * @param string $obj_type
1055 1055
 	 * @return EE_Line_Item[]
1056 1056
 	 */
1057
-	public static function get_subtotals_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
1057
+	public static function get_subtotals_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
1058 1058
 		return self::_get_descendants_by_type_and_object_type(
1059 1059
 			$parent_line_item,
1060 1060
 			EEM_Line_Item::type_sub_total,
@@ -1071,8 +1071,8 @@  discard block
 block discarded – undo
1071 1071
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1072 1072
 	 * @return EE_Line_Item[]
1073 1073
 	 */
1074
-	public static function get_ticket_line_items( EE_Line_Item $parent_line_item ) {
1075
-		return self::get_line_items_of_object_type( $parent_line_item, 'Ticket' );
1074
+	public static function get_ticket_line_items(EE_Line_Item $parent_line_item) {
1075
+		return self::get_line_items_of_object_type($parent_line_item, 'Ticket');
1076 1076
 	}
1077 1077
 
1078 1078
 
@@ -1085,8 +1085,8 @@  discard block
 block discarded – undo
1085 1085
 	 * @param string $obj_type
1086 1086
 	 * @return EE_Line_Item[]
1087 1087
 	 */
1088
-	public static function get_line_items_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
1089
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, EEM_Line_Item::type_line_item, $obj_type );
1088
+	public static function get_line_items_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
1089
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, EEM_Line_Item::type_line_item, $obj_type);
1090 1090
 	}
1091 1091
 
1092 1092
 
@@ -1097,8 +1097,8 @@  discard block
 block discarded – undo
1097 1097
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1098 1098
 	 * @return EE_Line_Item[]
1099 1099
 	 */
1100
-	public static function get_tax_descendants( EE_Line_Item $parent_line_item ) {
1101
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_tax );
1100
+	public static function get_tax_descendants(EE_Line_Item $parent_line_item) {
1101
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_tax);
1102 1102
 	}
1103 1103
 
1104 1104
 
@@ -1109,8 +1109,8 @@  discard block
 block discarded – undo
1109 1109
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1110 1110
 	 * @return EE_Line_Item[]
1111 1111
 	 */
1112
-	public static function get_line_item_descendants( EE_Line_Item $parent_line_item ) {
1113
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_line_item );
1112
+	public static function get_line_item_descendants(EE_Line_Item $parent_line_item) {
1113
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_line_item);
1114 1114
 	}
1115 1115
 
1116 1116
 
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
 	 * @param string $line_item_type one of the EEM_Line_Item constants
1124 1124
 	 * @return EE_Line_Item[]
1125 1125
 	 */
1126
-	public static function get_descendants_of_type( EE_Line_Item $parent_line_item, $line_item_type ) {
1127
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, $line_item_type, NULL );
1126
+	public static function get_descendants_of_type(EE_Line_Item $parent_line_item, $line_item_type) {
1127
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, $line_item_type, NULL);
1128 1128
 	}
1129 1129
 
1130 1130
 
@@ -1143,8 +1143,8 @@  discard block
 block discarded – undo
1143 1143
 		$obj_type = null
1144 1144
 	) {
1145 1145
 		$objects = array();
1146
-		foreach ( $parent_line_item->children() as $child_line_item ) {
1147
-			if ( $child_line_item instanceof EE_Line_Item ) {
1146
+		foreach ($parent_line_item->children() as $child_line_item) {
1147
+			if ($child_line_item instanceof EE_Line_Item) {
1148 1148
 				if (
1149 1149
 					$child_line_item->type() === $line_item_type
1150 1150
 				    && (
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 		$OBJ_type = '',
1185 1185
 		$OBJ_IDs = array()
1186 1186
 	) {
1187
-		return self::_get_descendants_by_object_type_and_object_ID( $parent_line_item, $OBJ_type, $OBJ_IDs );
1187
+		return self::_get_descendants_by_object_type_and_object_ID($parent_line_item, $OBJ_type, $OBJ_IDs);
1188 1188
 	}
1189 1189
 
1190 1190
 
@@ -1203,12 +1203,12 @@  discard block
 block discarded – undo
1203 1203
 		$OBJ_IDs
1204 1204
 	) {
1205 1205
 		$objects = array();
1206
-		foreach ( $parent_line_item->children() as $child_line_item ) {
1207
-			if ( $child_line_item instanceof EE_Line_Item ) {
1206
+		foreach ($parent_line_item->children() as $child_line_item) {
1207
+			if ($child_line_item instanceof EE_Line_Item) {
1208 1208
 				if (
1209
-					is_array( $OBJ_IDs )
1209
+					is_array($OBJ_IDs)
1210 1210
 					&& $child_line_item->OBJ_type() === $OBJ_type
1211
-					&& in_array( $child_line_item->OBJ_ID(), $OBJ_IDs )
1211
+					&& in_array($child_line_item->OBJ_ID(), $OBJ_IDs)
1212 1212
 				) {
1213 1213
 					$objects[] = $child_line_item;
1214 1214
 				} else {
@@ -1238,8 +1238,8 @@  discard block
 block discarded – undo
1238 1238
 	 * @param string $type like one of the EEM_Line_Item::type_*
1239 1239
 	 * @return EE_Line_Item
1240 1240
 	 */
1241
-	public static function get_nearest_descendant_of_type( EE_Line_Item $parent_line_item, $type ) {
1242
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_type' , $type );
1241
+	public static function get_nearest_descendant_of_type(EE_Line_Item $parent_line_item, $type) {
1242
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_type', $type);
1243 1243
 	}
1244 1244
 
1245 1245
 
@@ -1253,8 +1253,8 @@  discard block
 block discarded – undo
1253 1253
 	 * @param string $code any value used for LIN_code
1254 1254
 	 * @return EE_Line_Item
1255 1255
 	 */
1256
-	public static function get_nearest_descendant_having_code( EE_Line_Item $parent_line_item, $code ) {
1257
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_code' , $code );
1256
+	public static function get_nearest_descendant_having_code(EE_Line_Item $parent_line_item, $code) {
1257
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_code', $code);
1258 1258
 	}
1259 1259
 
1260 1260
 
@@ -1268,15 +1268,15 @@  discard block
 block discarded – undo
1268 1268
 	 * @param string $value any value stored in $search_field
1269 1269
 	 * @return EE_Line_Item
1270 1270
 	 */
1271
-	protected static function _get_nearest_descendant( EE_Line_Item $parent_line_item, $search_field, $value ) {
1272
-		foreach( $parent_line_item->children() as $child ){
1273
-			if ( $child->get( $search_field ) == $value ){
1271
+	protected static function _get_nearest_descendant(EE_Line_Item $parent_line_item, $search_field, $value) {
1272
+		foreach ($parent_line_item->children() as $child) {
1273
+			if ($child->get($search_field) == $value) {
1274 1274
 				return $child;
1275 1275
 			}
1276 1276
 		}
1277
-		foreach( $parent_line_item->children() as $child ){
1278
-			$descendant_found = self::_get_nearest_descendant( $child, $search_field, $value );
1279
-			if ( $descendant_found ){
1277
+		foreach ($parent_line_item->children() as $child) {
1278
+			$descendant_found = self::_get_nearest_descendant($child, $search_field, $value);
1279
+			if ($descendant_found) {
1280 1280
 				return $descendant_found;
1281 1281
 			}
1282 1282
 		}
@@ -1293,24 +1293,24 @@  discard block
 block discarded – undo
1293 1293
 	 * @return \EE_Line_Item
1294 1294
 	 * @throws \EE_Error
1295 1295
 	 */
1296
-	public static function find_transaction_grand_total_for_line_item( EE_Line_Item $line_item ){
1297
-		if ( $line_item->TXN_ID() ) {
1298
-			$total_line_item = $line_item->transaction()->total_line_item( false );
1299
-			if ( $total_line_item instanceof EE_Line_Item ) {
1296
+	public static function find_transaction_grand_total_for_line_item(EE_Line_Item $line_item) {
1297
+		if ($line_item->TXN_ID()) {
1298
+			$total_line_item = $line_item->transaction()->total_line_item(false);
1299
+			if ($total_line_item instanceof EE_Line_Item) {
1300 1300
 				return $total_line_item;
1301 1301
 			}
1302 1302
 		} else {
1303 1303
 			$line_item_parent = $line_item->parent();
1304
-			if ( $line_item_parent instanceof EE_Line_Item ) {
1305
-				if ( $line_item_parent->is_total() ) {
1304
+			if ($line_item_parent instanceof EE_Line_Item) {
1305
+				if ($line_item_parent->is_total()) {
1306 1306
 					return $line_item_parent;
1307 1307
 				}
1308
-				return EEH_Line_Item::find_transaction_grand_total_for_line_item( $line_item_parent );
1308
+				return EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item_parent);
1309 1309
 			}
1310 1310
 		}
1311 1311
 		throw new EE_Error(
1312 1312
 			sprintf(
1313
-				__( 'A valid grand total for line item %1$d was not found.', 'event_espresso' ),
1313
+				__('A valid grand total for line item %1$d was not found.', 'event_espresso'),
1314 1314
 				$line_item->ID()
1315 1315
 			)
1316 1316
 		);
@@ -1327,31 +1327,31 @@  discard block
 block discarded – undo
1327 1327
 	 * @return void
1328 1328
 	 * @throws \EE_Error
1329 1329
 	 */
1330
-	public static function visualize( EE_Line_Item $line_item, $indentation = 0 ){
1330
+	public static function visualize(EE_Line_Item $line_item, $indentation = 0) {
1331 1331
 		echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1332
-		if ( ! $indentation ) {
1333
-			echo defined( 'EE_TESTS_DIR' ) ? "\n" : '<br />';
1332
+		if ( ! $indentation) {
1333
+			echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1334 1334
 		}
1335
-		for( $i = 0; $i < $indentation; $i++ ){
1335
+		for ($i = 0; $i < $indentation; $i++) {
1336 1336
 			echo ". ";
1337 1337
 		}
1338 1338
 		$breakdown = '';
1339
-		if ( $line_item->is_line_item()){
1340
-			if ( $line_item->is_percent() ) {
1339
+		if ($line_item->is_line_item()) {
1340
+			if ($line_item->is_percent()) {
1341 1341
 				$breakdown = "{$line_item->percent()}%";
1342 1342
 			} else {
1343
-				$breakdown = '$' . "{$line_item->unit_price()} x {$line_item->quantity()}";
1343
+				$breakdown = '$'."{$line_item->unit_price()} x {$line_item->quantity()}";
1344 1344
 			}
1345 1345
 		}
1346
-		echo $line_item->name() . " [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : " . '$' . "{$line_item->total()}";
1347
-		if ( $breakdown ) {
1346
+		echo $line_item->name()." [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : ".'$'."{$line_item->total()}";
1347
+		if ($breakdown) {
1348 1348
 			echo " ( {$breakdown} )";
1349 1349
 		}
1350
-		if( $line_item->is_taxable() ){
1350
+		if ($line_item->is_taxable()) {
1351 1351
 			echo "  * taxable";
1352 1352
 		}
1353
-		if( $line_item->children() ){
1354
-			foreach($line_item->children() as $child){
1353
+		if ($line_item->children()) {
1354
+			foreach ($line_item->children() as $child) {
1355 1355
 				self::visualize($child, $indentation + 1);
1356 1356
 			}
1357 1357
 		}
@@ -1392,97 +1392,97 @@  discard block
 block discarded – undo
1392 1392
 	 *                                          is theirs, which can be done with
1393 1393
 	 *                                          `EEM_Line_Item::instance()->get_line_item_for_registration( $registration );`
1394 1394
 	 */
1395
-	public static function calculate_reg_final_prices_per_line_item( EE_Line_Item $line_item, $billable_ticket_quantities = array() ) {
1395
+	public static function calculate_reg_final_prices_per_line_item(EE_Line_Item $line_item, $billable_ticket_quantities = array()) {
1396 1396
 		//init running grand total if not already
1397
-		if ( ! isset( $running_totals[ 'total' ] ) ) {
1398
-			$running_totals[ 'total' ] = 0;
1397
+		if ( ! isset($running_totals['total'])) {
1398
+			$running_totals['total'] = 0;
1399 1399
 		}
1400
-		if( ! isset( $running_totals[ 'taxable' ] ) ) {
1401
-			$running_totals[ 'taxable' ] = array( 'total' => 0 );
1400
+		if ( ! isset($running_totals['taxable'])) {
1401
+			$running_totals['taxable'] = array('total' => 0);
1402 1402
 		}
1403
-		foreach ( $line_item->children() as $child_line_item ) {
1404
-			switch ( $child_line_item->type() ) {
1403
+		foreach ($line_item->children() as $child_line_item) {
1404
+			switch ($child_line_item->type()) {
1405 1405
 
1406 1406
 				case EEM_Line_Item::type_sub_total :
1407
-					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $child_line_item, $billable_ticket_quantities );
1407
+					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item($child_line_item, $billable_ticket_quantities);
1408 1408
 					//combine arrays but preserve numeric keys
1409
-					$running_totals = array_replace_recursive( $running_totals_from_subtotal, $running_totals );
1410
-					$running_totals[ 'total' ] += $running_totals_from_subtotal[ 'total' ];
1411
-					$running_totals[ 'taxable'][ 'total' ] += $running_totals_from_subtotal[ 'taxable' ][ 'total' ];
1409
+					$running_totals = array_replace_recursive($running_totals_from_subtotal, $running_totals);
1410
+					$running_totals['total'] += $running_totals_from_subtotal['total'];
1411
+					$running_totals['taxable']['total'] += $running_totals_from_subtotal['taxable']['total'];
1412 1412
 					break;
1413 1413
 
1414 1414
 				case EEM_Line_Item::type_tax_sub_total :
1415 1415
 
1416 1416
 					//find how much the taxes percentage is
1417
-					if ( $child_line_item->percent() !== 0 ) {
1417
+					if ($child_line_item->percent() !== 0) {
1418 1418
 						$tax_percent_decimal = $child_line_item->percent() / 100;
1419 1419
 					} else {
1420 1420
 						$tax_percent_decimal = EE_Taxes::get_total_taxes_percentage() / 100;
1421 1421
 					}
1422 1422
 					//and apply to all the taxable totals, and add to the pretax totals
1423
-					foreach ( $running_totals as $line_item_id => $this_running_total ) {
1423
+					foreach ($running_totals as $line_item_id => $this_running_total) {
1424 1424
 						//"total" and "taxable" array key is an exception
1425
-						if ( $line_item_id === 'taxable' ) {
1425
+						if ($line_item_id === 'taxable') {
1426 1426
 							continue;
1427 1427
 						}
1428
-						$taxable_total = $running_totals[ 'taxable' ][ $line_item_id ];
1429
-						$running_totals[ $line_item_id ] += ( $taxable_total * $tax_percent_decimal );
1428
+						$taxable_total = $running_totals['taxable'][$line_item_id];
1429
+						$running_totals[$line_item_id] += ($taxable_total * $tax_percent_decimal);
1430 1430
 					}
1431 1431
 					break;
1432 1432
 
1433 1433
 				case EEM_Line_Item::type_line_item :
1434 1434
 
1435 1435
 					// ticket line items or ????
1436
-					if ( $child_line_item->OBJ_type() === 'Ticket' ) {
1436
+					if ($child_line_item->OBJ_type() === 'Ticket') {
1437 1437
 						// kk it's a ticket
1438
-						if ( isset( $running_totals[ $child_line_item->ID() ] ) ) {
1438
+						if (isset($running_totals[$child_line_item->ID()])) {
1439 1439
 							//huh? that shouldn't happen.
1440
-							$running_totals[ 'total' ] += $child_line_item->total();
1440
+							$running_totals['total'] += $child_line_item->total();
1441 1441
 						} else {
1442 1442
 							//its not in our running totals yet. great.
1443
-							if ( $child_line_item->is_taxable() ) {
1443
+							if ($child_line_item->is_taxable()) {
1444 1444
 								$taxable_amount = $child_line_item->unit_price();
1445 1445
 							} else {
1446 1446
 								$taxable_amount = 0;
1447 1447
 							}
1448 1448
 							// are we only calculating totals for some tickets?
1449
-							if ( isset( $billable_ticket_quantities[ $child_line_item->OBJ_ID() ] ) ) {
1450
-								$quantity = $billable_ticket_quantities[ $child_line_item->OBJ_ID() ];
1451
-								$running_totals[ $child_line_item->ID() ] = $quantity
1449
+							if (isset($billable_ticket_quantities[$child_line_item->OBJ_ID()])) {
1450
+								$quantity = $billable_ticket_quantities[$child_line_item->OBJ_ID()];
1451
+								$running_totals[$child_line_item->ID()] = $quantity
1452 1452
 									? $child_line_item->unit_price()
1453 1453
 									: 0;
1454
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $quantity
1454
+								$running_totals['taxable'][$child_line_item->ID()] = $quantity
1455 1455
 									? $taxable_amount
1456 1456
 									: 0;
1457 1457
 							} else {
1458 1458
 								$quantity = $child_line_item->quantity();
1459
-								$running_totals[ $child_line_item->ID() ] = $child_line_item->unit_price();
1460
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $taxable_amount;
1459
+								$running_totals[$child_line_item->ID()] = $child_line_item->unit_price();
1460
+								$running_totals['taxable'][$child_line_item->ID()] = $taxable_amount;
1461 1461
 							}
1462
-							$running_totals[ 'taxable' ][ 'total' ] += $taxable_amount * $quantity;
1463
-							$running_totals[ 'total' ] += $child_line_item->unit_price() * $quantity;
1462
+							$running_totals['taxable']['total'] += $taxable_amount * $quantity;
1463
+							$running_totals['total'] += $child_line_item->unit_price() * $quantity;
1464 1464
 						}
1465 1465
 					} else {
1466 1466
 						// it's some other type of item added to the cart
1467 1467
 						// it should affect the running totals
1468 1468
 						// basically we want to convert it into a PERCENT modifier. Because
1469 1469
 						// more clearly affect all registration's final price equally
1470
-						$line_items_percent_of_running_total = $running_totals[ 'total' ] > 0
1471
-							? ( $child_line_item->total() / $running_totals[ 'total' ] ) + 1
1470
+						$line_items_percent_of_running_total = $running_totals['total'] > 0
1471
+							? ($child_line_item->total() / $running_totals['total']) + 1
1472 1472
 							: 1;
1473
-						foreach ( $running_totals as $line_item_id => $this_running_total ) {
1473
+						foreach ($running_totals as $line_item_id => $this_running_total) {
1474 1474
 							//the "taxable" array key is an exception
1475
-							if ( $line_item_id === 'taxable' ) {
1475
+							if ($line_item_id === 'taxable') {
1476 1476
 								continue;
1477 1477
 							}
1478 1478
 							// update the running totals
1479 1479
 							// yes this actually even works for the running grand total!
1480
-							$running_totals[ $line_item_id ] =
1480
+							$running_totals[$line_item_id] =
1481 1481
 								$line_items_percent_of_running_total * $this_running_total;
1482 1482
 
1483
-							if ( $child_line_item->is_taxable() ) {
1484
-								$running_totals[ 'taxable' ][ $line_item_id ] =
1485
-									$line_items_percent_of_running_total * $running_totals[ 'taxable' ][ $line_item_id ];
1483
+							if ($child_line_item->is_taxable()) {
1484
+								$running_totals['taxable'][$line_item_id] =
1485
+									$line_items_percent_of_running_total * $running_totals['taxable'][$line_item_id];
1486 1486
 							}
1487 1487
 						}
1488 1488
 					}
@@ -1500,16 +1500,16 @@  discard block
 block discarded – undo
1500 1500
 	 * @return float | null
1501 1501
 	 * @throws \OutOfRangeException
1502 1502
 	 */
1503
-	public static function calculate_final_price_for_ticket_line_item( \EE_Line_Item $total_line_item, \EE_Line_Item $ticket_line_item ) {
1503
+	public static function calculate_final_price_for_ticket_line_item(\EE_Line_Item $total_line_item, \EE_Line_Item $ticket_line_item) {
1504 1504
 		static $final_prices_per_ticket_line_item = array();
1505
-		if ( empty( $final_prices_per_ticket_line_item ) ) {
1505
+		if (empty($final_prices_per_ticket_line_item)) {
1506 1506
 			$final_prices_per_ticket_line_item = \EEH_Line_Item::calculate_reg_final_prices_per_line_item(
1507 1507
 				$total_line_item
1508 1508
 			);
1509 1509
 		}
1510 1510
 		//ok now find this new registration's final price
1511
-		if ( isset( $final_prices_per_ticket_line_item[ $ticket_line_item->ID() ] ) ) {
1512
-			return $final_prices_per_ticket_line_item[ $ticket_line_item->ID() ];
1511
+		if (isset($final_prices_per_ticket_line_item[$ticket_line_item->ID()])) {
1512
+			return $final_prices_per_ticket_line_item[$ticket_line_item->ID()];
1513 1513
 		}
1514 1514
 		$message = sprintf(
1515 1515
 			__(
@@ -1518,10 +1518,10 @@  discard block
 block discarded – undo
1518 1518
 			),
1519 1519
 			$ticket_line_item->ID()
1520 1520
 		);
1521
-		if ( WP_DEBUG ) {
1522
-			throw new \OutOfRangeException( $message );
1521
+		if (WP_DEBUG) {
1522
+			throw new \OutOfRangeException($message);
1523 1523
 		} else {
1524
-			EE_Log::instance()->log( __CLASS__, __FUNCTION__, $message );
1524
+			EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message);
1525 1525
 		}
1526 1526
 		return null;
1527 1527
 	}
@@ -1537,15 +1537,15 @@  discard block
 block discarded – undo
1537 1537
 	 * @return \EE_Line_Item
1538 1538
 	 * @throws \EE_Error
1539 1539
 	 */
1540
-	public static function billable_line_item_tree( EE_Line_Item $line_item, $registrations ) {
1541
-		$copy_li = EEH_Line_Item::billable_line_item( $line_item, $registrations );
1542
-		foreach ( $line_item->children() as $child_li ) {
1543
-			$copy_li->add_child_line_item( EEH_Line_Item::billable_line_item_tree( $child_li, $registrations ) );
1540
+	public static function billable_line_item_tree(EE_Line_Item $line_item, $registrations) {
1541
+		$copy_li = EEH_Line_Item::billable_line_item($line_item, $registrations);
1542
+		foreach ($line_item->children() as $child_li) {
1543
+			$copy_li->add_child_line_item(EEH_Line_Item::billable_line_item_tree($child_li, $registrations));
1544 1544
 		}
1545 1545
 		//if this is the grand total line item, make sure the totals all add up
1546 1546
 		//(we could have duplicated this logic AS we copied the line items, but
1547 1547
 		//it seems DRYer this way)
1548
-		if ( $copy_li->type() === EEM_Line_Item::type_total ) {
1548
+		if ($copy_li->type() === EEM_Line_Item::type_total) {
1549 1549
 			$copy_li->recalculate_total_including_taxes();
1550 1550
 		}
1551 1551
 		return $copy_li;
@@ -1562,24 +1562,24 @@  discard block
 block discarded – undo
1562 1562
 	 * @throws \EE_Error
1563 1563
 	 * @param EE_Registration[] $registrations
1564 1564
 	 */
1565
-	public static function billable_line_item( EE_Line_Item $line_item, $registrations ) {
1565
+	public static function billable_line_item(EE_Line_Item $line_item, $registrations) {
1566 1566
 		$new_li_fields = $line_item->model_field_array();
1567
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1567
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1568 1568
 			$line_item->OBJ_type() === 'Ticket'
1569 1569
 		) {
1570 1570
 			$count = 0;
1571
-			foreach ( $registrations as $registration ) {
1572
-				if ( $line_item->OBJ_ID() === $registration->ticket_ID() &&
1573
-					in_array( $registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment() )
1571
+			foreach ($registrations as $registration) {
1572
+				if ($line_item->OBJ_ID() === $registration->ticket_ID() &&
1573
+					in_array($registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment())
1574 1574
 				) {
1575 1575
 					$count++;
1576 1576
 				}
1577 1577
 			}
1578
-			$new_li_fields[ 'LIN_quantity' ] = $count;
1578
+			$new_li_fields['LIN_quantity'] = $count;
1579 1579
 		}
1580 1580
 		//don't set the total. We'll leave that up to the code that calculates it
1581
-		unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ], $new_li_fields[ 'LIN_total' ] );
1582
-		return EE_Line_Item::new_instance( $new_li_fields );
1581
+		unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent'], $new_li_fields['LIN_total']);
1582
+		return EE_Line_Item::new_instance($new_li_fields);
1583 1583
 	}
1584 1584
 
1585 1585
 
@@ -1592,19 +1592,19 @@  discard block
 block discarded – undo
1592 1592
 	 * @return \EE_Line_Item|null
1593 1593
 	 * @throws \EE_Error
1594 1594
 	 */
1595
-	public static function non_empty_line_items( EE_Line_Item $line_item ) {
1596
-		$copied_li = EEH_Line_Item::non_empty_line_item( $line_item );
1597
-		if ( $copied_li === null ) {
1595
+	public static function non_empty_line_items(EE_Line_Item $line_item) {
1596
+		$copied_li = EEH_Line_Item::non_empty_line_item($line_item);
1597
+		if ($copied_li === null) {
1598 1598
 			return null;
1599 1599
 		}
1600 1600
 		//if this is an event subtotal, we want to only include it if it
1601 1601
 		//has a non-zero total and at least one ticket line item child
1602 1602
 		$ticket_children = 0;
1603
-		foreach ( $line_item->children() as $child_li ) {
1604
-			$child_li_copy = EEH_Line_Item::non_empty_line_items( $child_li );
1605
-			if ( $child_li_copy !== null ) {
1606
-				$copied_li->add_child_line_item( $child_li_copy );
1607
-				if ( $child_li_copy->type() === EEM_Line_Item::type_line_item &&
1603
+		foreach ($line_item->children() as $child_li) {
1604
+			$child_li_copy = EEH_Line_Item::non_empty_line_items($child_li);
1605
+			if ($child_li_copy !== null) {
1606
+				$copied_li->add_child_line_item($child_li_copy);
1607
+				if ($child_li_copy->type() === EEM_Line_Item::type_line_item &&
1608 1608
 					$child_li_copy->OBJ_type() === 'Ticket'
1609 1609
 				) {
1610 1610
 					$ticket_children++;
@@ -1634,8 +1634,8 @@  discard block
 block discarded – undo
1634 1634
 	 * @return EE_Line_Item
1635 1635
 	 * @throws \EE_Error
1636 1636
 	 */
1637
-	public static function non_empty_line_item( EE_Line_Item $line_item ) {
1638
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1637
+	public static function non_empty_line_item(EE_Line_Item $line_item) {
1638
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1639 1639
 			$line_item->OBJ_type() === 'Ticket' &&
1640 1640
 			$line_item->quantity() === 0
1641 1641
 		) {
@@ -1643,8 +1643,8 @@  discard block
 block discarded – undo
1643 1643
 		}
1644 1644
 		$new_li_fields = $line_item->model_field_array();
1645 1645
 		//don't set the total. We'll leave that up to the code that calculates it
1646
-		unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ] );
1647
-		return EE_Line_Item::new_instance( $new_li_fields );
1646
+		unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent']);
1647
+		return EE_Line_Item::new_instance($new_li_fields);
1648 1648
 	}
1649 1649
 
1650 1650
 
@@ -1656,9 +1656,9 @@  discard block
 block discarded – undo
1656 1656
 	 * @return \EE_Line_Item
1657 1657
 	 * @throws \EE_Error
1658 1658
 	 */
1659
-	public static function get_items_subtotal( EE_Line_Item $total_line_item ){
1660
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0' );
1661
-		return self::get_pre_tax_subtotal( $total_line_item );
1659
+	public static function get_items_subtotal(EE_Line_Item $total_line_item) {
1660
+		EE_Error::doing_it_wrong('EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0');
1661
+		return self::get_pre_tax_subtotal($total_line_item);
1662 1662
 	}
1663 1663
 
1664 1664
 
@@ -1669,9 +1669,9 @@  discard block
 block discarded – undo
1669 1669
 	 * @return \EE_Line_Item
1670 1670
 	 * @throws \EE_Error
1671 1671
 	 */
1672
-	public static function create_default_total_line_item( $transaction = NULL) {
1673
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0' );
1674
-		return self::create_total_line_item( $transaction );
1672
+	public static function create_default_total_line_item($transaction = NULL) {
1673
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0');
1674
+		return self::create_total_line_item($transaction);
1675 1675
 	}
1676 1676
 
1677 1677
 
@@ -1683,9 +1683,9 @@  discard block
 block discarded – undo
1683 1683
 	 * @return \EE_Line_Item
1684 1684
 	 * @throws \EE_Error
1685 1685
 	 */
1686
-	public static function create_default_tickets_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1687
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0' );
1688
-		return self::create_pre_tax_subtotal( $total_line_item, $transaction );
1686
+	public static function create_default_tickets_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1687
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0');
1688
+		return self::create_pre_tax_subtotal($total_line_item, $transaction);
1689 1689
 	}
1690 1690
 
1691 1691
 
@@ -1697,9 +1697,9 @@  discard block
 block discarded – undo
1697 1697
 	 * @return \EE_Line_Item
1698 1698
 	 * @throws \EE_Error
1699 1699
 	 */
1700
-	public static function create_default_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1701
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0' );
1702
-		return self::create_taxes_subtotal( $total_line_item, $transaction );
1700
+	public static function create_default_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1701
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0');
1702
+		return self::create_taxes_subtotal($total_line_item, $transaction);
1703 1703
 	}
1704 1704
 
1705 1705
 
@@ -1711,9 +1711,9 @@  discard block
 block discarded – undo
1711 1711
 	 * @return \EE_Line_Item
1712 1712
 	 * @throws \EE_Error
1713 1713
 	 */
1714
-	public static function create_default_event_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1715
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0' );
1716
-		return self::create_event_subtotal( $total_line_item, $transaction );
1714
+	public static function create_default_event_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1715
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0');
1716
+		return self::create_event_subtotal($total_line_item, $transaction);
1717 1717
 	}
1718 1718
 
1719 1719
 
Please login to merge, or discard this patch.
modules/gateways/Invoice/lib/templates/receipt_body.template.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -36,53 +36,53 @@  discard block
 block discarded – undo
36 36
 						<h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso')?></h2>
37 37
 						<h3 id="invoice-date"><?php _e('Date:', 'event_espresso')?> <span class="plain-text">[registration_date]</span></h3>
38 38
 						<h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso')?> <span class="plain-text">[transaction_id]</span></h3>
39
-						<h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status();?></span></h3>
39
+						<h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status(); ?></span></h3>
40 40
 					</div>
41 41
 				</td>
42 42
 			</tr>
43 43
 		</table>
44 44
 		<div class="events">
45
-		<?php foreach($events_for_txn as $event_id => $event){
46
-			?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png';?>"><?php _e("Event Name:","event_espresso")?> <span class="plain-text"><?php echo $event->name();?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3>
47
-			<?php if (strlen($event->description()>1)){?><p class="event-description"><?php $event->description()?></p><?php }?>
45
+		<?php foreach ($events_for_txn as $event_id => $event) {
46
+			?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png'; ?>"><?php _e("Event Name:", "event_espresso")?> <span class="plain-text"><?php echo $event->name(); ?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3>
47
+			<?php if (strlen($event->description() > 1)) {?><p class="event-description"><?php $event->description()?></p><?php }?>
48 48
 			<ul class="tickets-per-event">
49
-			<?php foreach($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item){
49
+			<?php foreach ($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item) {
50 50
 				$ticket = $line_item->ticket();
51
-				$taxable_html = $ticket->taxable() ? '*': '';
51
+				$taxable_html = $ticket->taxable() ? '*' : '';
52 52
 				$subitems = $line_item->children();
53
-				$ticket_uses = $ticket->get_pretty('TKT_uses',  __("any", "event_espresso"));
53
+				$ticket_uses = $ticket->get_pretty('TKT_uses', __("any", "event_espresso"));
54 54
 			?>
55 55
 				<li class="event-ticket">
56 56
 					<div class="ticket-details">
57 57
 						<table class="invoice-amount">
58 58
 							<thead>
59 59
 								<tr class="header_row">
60
-									<th class="name-column"><?php _e("Ticket", "event_espresso");?></th>
61
-									<th colspan="2" class="desc-column"><?php _e("Description", "event_espresso");?></th>
62
-									<th class="number-column item_c"><?php _e("Quantity", "event_espresso");?></th>
63
-									<th class="number-column item_c"><?php _e("Price", "event_espresso");?></th>
64
-									<th class="number-column item_r"><?php _e("Total", "event_espresso");?></th>
60
+									<th class="name-column"><?php _e("Ticket", "event_espresso"); ?></th>
61
+									<th colspan="2" class="desc-column"><?php _e("Description", "event_espresso"); ?></th>
62
+									<th class="number-column item_c"><?php _e("Quantity", "event_espresso"); ?></th>
63
+									<th class="number-column item_c"><?php _e("Price", "event_espresso"); ?></th>
64
+									<th class="number-column item_r"><?php _e("Total", "event_espresso"); ?></th>
65 65
 								</tr>
66 66
 							</thead>
67 67
 							<tbody>
68
-								<?php if( count($subitems) < 2){?>
68
+								<?php if (count($subitems) < 2) {?>
69 69
 								<tr class="item">
70 70
 									<td><?php echo $line_item->name().$taxable_html?></td>
71
-									<td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td>
71
+									<td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td>
72 72
 									<td class="item_c"><?php echo $line_item->quantity()?></td>
73 73
 									<td class="item_c"><?php echo $line_item->unit_price_no_code()?></td>
74 74
 									<td class="item_r"><?php echo $line_item->total_no_code()?></td>
75 75
 								</tr>
76
-								<?php }else{?>
76
+								<?php } else {?>
77 77
 									<tr class="item">
78 78
 										<td class="aln-left"><?php echo $line_item->name().$taxable_html?></td>
79
-										<td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td>
79
+										<td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td>
80 80
 										<td class="item_c"><?php echo $line_item->quantity()?></td>
81 81
 										<td class="item_c"><?php echo $line_item->unit_price_no_code()?></td>
82 82
 										<td class="item_r"><?php echo $line_item->total_no_code()?></td>
83 83
 									</tr>
84
-									<?php foreach($subitems as $sub_line_item){
85
-										$is_percent = $sub_line_item->is_percent();?>
84
+									<?php foreach ($subitems as $sub_line_item) {
85
+										$is_percent = $sub_line_item->is_percent(); ?>
86 86
 										<tr class="subitem-row">
87 87
 											<td class="subitem"><?php echo $sub_line_item->name()?></td>
88 88
 											<td colspan="2"><?php echo $sub_line_item->desc()?></td>
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 									<?php } ?>
94 94
 									<tr class="total_tr odd">
95 95
 										<td colspan="4"></td>
96
-										<td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso");?></td>
96
+										<td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso"); ?></td>
97 97
 										<td class="item_r"><?php echo $line_item->total_no_code()?></td>
98 98
 									</tr>
99 99
 								<?php }?>
@@ -104,22 +104,22 @@  discard block
 block discarded – undo
104 104
 					<div class="reg-details-for-ticket">
105 105
 						<div class="ticket-time-and-place-details">
106 106
 							<div class="ticket-time-details">
107
-								<h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png';?>"><?php echo _n("Date/Time:","Dates/Times:",count($ticket->datetimes()), "event_espresso");?></h4>
107
+								<h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png'; ?>"><?php echo _n("Date/Time:", "Dates/Times:", count($ticket->datetimes()), "event_espresso"); ?></h4>
108 108
 								<ul class="event-dates">
109
-									<?php foreach($ticket->datetimes_ordered() as $datetime){
109
+									<?php foreach ($ticket->datetimes_ordered() as $datetime) {
110 110
 										/* @var $datetime EE_Datetime */ ?>
111 111
 									<li><?php
112
-										echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : '' ;
113
-										echo sprintf(__("%s - %s (%s)", "event_espresso"),$datetime->start_date_and_time(),$datetime->end_date_and_time(),$datetime->get_timezone());
112
+										echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : '';
113
+										echo sprintf(__("%s - %s (%s)", "event_espresso"), $datetime->start_date_and_time(), $datetime->end_date_and_time(), $datetime->get_timezone());
114 114
 										echo $datetime->description() ? '<p class="ticket-note">'.$datetime->description().'</p>' : '' ?></li>
115 115
 									<?php }?>
116 116
 								</ul>
117 117
 							</div>
118
-							<?php if ($event->venues()){?>
118
+							<?php if ($event->venues()) {?>
119 119
 							<div class="ticket-place-details">
120
-								<h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png';?>"><?php echo _n("Venue:","Venues:",count($event->venues()), "event_espresso");?></h4>
120
+								<h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png'; ?>"><?php echo _n("Venue:", "Venues:", count($event->venues()), "event_espresso"); ?></h4>
121 121
 								<ul class="event-venues">
122
-									<?php foreach($event->venues() as $venue){?>
122
+									<?php foreach ($event->venues() as $venue) {?>
123 123
 									<li><?php echo $venue->name()?> <span class="small-text">[ <a href='<?php echo $venue->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></li>
124 124
 									<?php } ?>
125 125
 								</ul>
@@ -127,34 +127,34 @@  discard block
 block discarded – undo
127 127
 							<?php }?>
128 128
 						</div>
129 129
 						<div class="ticket-registrations-area">
130
-							<h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png';?>"><?php echo __("Registration Details", "event_espresso");?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4>
130
+							<h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png'; ?>"><?php echo __("Registration Details", "event_espresso"); ?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4>
131 131
 							<ul class="ticket-registrations-list">
132
-								<?php foreach($registrations_per_line_item[$line_item_id] as $registration){
132
+								<?php foreach ($registrations_per_line_item[$line_item_id] as $registration) {
133 133
 									/* @var $registration EE_Registration */
134 134
 									$attendee = $registration->attendee();
135
-									$answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC')));?>
135
+									$answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC'))); ?>
136 136
 								<li class="ticket-registration">
137 137
 									<table class="registration-details">
138 138
 										<tr class="odd">
139
-											<th><?php echo 	_e("Registration Code:", "event_espresso");?></th>
140
-											<td><?php echo $registration->reg_code();?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td>
139
+											<th><?php echo 	_e("Registration Code:", "event_espresso"); ?></th>
140
+											<td><?php echo $registration->reg_code(); ?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td>
141 141
 										</tr>
142 142
 										<?php
143
-										foreach($event->question_groups() as $question_group){
144
-											?><tr><th><?php $question_group->e('QSG_name');?></th><td></td></tr><?php
143
+										foreach ($event->question_groups() as $question_group) {
144
+											?><tr><th><?php $question_group->e('QSG_name'); ?></th><td></td></tr><?php
145 145
 											$has_personal_info = false;
146
-											foreach($question_group->questions() as $question){
147
-												if( in_array($question->system_ID(),$questions_to_skip)){
146
+											foreach ($question_group->questions() as $question) {
147
+												if (in_array($question->system_ID(), $questions_to_skip)) {
148 148
 													$has_personal_info = true;
149 149
 													continue;
150 150
 												}
151 151
 												?><tr>
152 152
 														<th><?php echo $question->display_text()?></th>
153
-														<td><?php echo $registration->answer_value_to_question($question);?></td>
153
+														<td><?php echo $registration->answer_value_to_question($question); ?></td>
154 154
 												</tr><?php
155 155
 											}
156
-											if($has_personal_info){
157
-												?><tr><th><?php	_e('Attendee', 'event_espresso');?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"),$attendee->full_name(),$attendee->email())?></td></tr><?php
156
+											if ($has_personal_info) {
157
+												?><tr><th><?php	_e('Attendee', 'event_espresso'); ?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"), $attendee->full_name(), $attendee->email())?></td></tr><?php
158 158
 											}
159 159
 										}
160 160
 										?>
@@ -171,21 +171,21 @@  discard block
 block discarded – undo
171 171
 		<?php }?>
172 172
 		</div>
173 173
 		<div class="taxes">
174
-			<?php if ($tax_total_line_item && $tax_total_line_item->children()){?>
175
-				<h3 class="section-title"><?php _e("Taxes",'event_espresso')?></h3>
174
+			<?php if ($tax_total_line_item && $tax_total_line_item->children()) {?>
175
+				<h3 class="section-title"><?php _e("Taxes", 'event_espresso')?></h3>
176 176
 				<table class="invoice-amount">
177 177
 
178 178
 					<thead>
179 179
 						<tr class="header_row">
180
-							<th class="left ticket_th"><?php _e("Tax Name", "event_espresso");?></th>
181
-							<th class="left"><?php _e('Description', 'event_espresso');?></th>
180
+							<th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th>
181
+							<th class="left"><?php _e('Description', 'event_espresso'); ?></th>
182 182
 							<th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th>
183 183
 							<th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th>
184 184
 						</tr>
185 185
 					</thead>
186 186
 					<tbody>
187 187
 						<?php
188
-						foreach($tax_total_line_item->children() as $child_tax){?>
188
+						foreach ($tax_total_line_item->children() as $child_tax) {?>
189 189
 						<tr>
190 190
 							<td><?php echo $child_tax->name()?></td>
191 191
 							<td><?php echo $child_tax->desc()?></td>
@@ -195,26 +195,26 @@  discard block
 block discarded – undo
195 195
 						<?php } ?>
196 196
 						<tr class="total_tr odd">
197 197
 							<td class="total_tr" colspan="2"></td>
198
-							<td class="total"><?php	_e("Tax Total:", "event_espresso");?></td>
198
+							<td class="total"><?php	_e("Tax Total:", "event_espresso"); ?></td>
199 199
 							<td class="item_r"><?php echo $tax_total_line_item->total_no_code()?></td>
200 200
 						</tr>
201 201
 					</tbody>
202 202
 
203 203
 				</table>
204 204
 			<?php }?>
205
-			<p><?php _e("* taxable items", "event_espresso");?></p>
205
+			<p><?php _e("* taxable items", "event_espresso"); ?></p>
206 206
 		</div>
207 207
 		<div class="grand-total-dv">
208
-		<h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"),EEH_Template::format_currency($total_cost));?></h2>
208
+		<h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), EEH_Template::format_currency($total_cost)); ?></h2>
209 209
 		</div>
210 210
 		<div class="payment-dv">
211
-			<h3 class="section-title"><?php _e("Payments",'event_espresso')?></h3>
211
+			<h3 class="section-title"><?php _e("Payments", 'event_espresso')?></h3>
212 212
 			<p>[instructions]</p>
213 213
 			<table class="invoice-amount">
214 214
 				<thead>
215 215
 					<tr class="header_row">
216 216
 						<th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th>
217
-						<th class='left datetime_th'><?php _e("Date",'event_espresso')?></th>
217
+						<th class='left datetime_th'><?php _e("Date", 'event_espresso')?></th>
218 218
 						<th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th>
219 219
 						<th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th>
220 220
 						<th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th>
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 				<tbody>
225 225
 					<?php
226 226
 					$c = false;
227
-					if(!empty($payments)){
227
+					if ( ! empty($payments)) {
228 228
 
229
-						foreach($payments as $payment){
229
+						foreach ($payments as $payment) {
230 230
 							/* @var $payment EE_Payment */?>
231
-						<tr class='item <?php echo (($c = !$c) ? ' odd' : '')?>'>
231
+						<tr class='item <?php echo (($c = ! $c) ? ' odd' : '')?>'>
232 232
 							<td><?php $payment->e('PAY_gateway')?></td>
233 233
 							<td><?php echo $payment->timestamp()?></td>
234 234
 							<td><?php $payment->e('PAY_txn_id_chq_nmbr')?></td>
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
 							<td class='item_r'><?php echo $payment->amount_no_code()?></td>
238 238
 						</tr>
239 239
 						<?php }
240
-					}else{?>
240
+					} else {?>
241 241
 						<tr class='item'>
242
-							<td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.",'event_espresso')?> </td>
242
+							<td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.", 'event_espresso')?> </td>
243 243
 						</tr>
244 244
 					<?php }
245
-					?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if($amount_owed){?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso");}?></a></td></tr>
245
+					?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if ($amount_owed) {?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso"); }?></a></td></tr>
246 246
 				</tbody>
247 247
 				<tfoot>
248 248
 					<tr class='total_tr'><td colspan="4">&nbsp;</td>
249
-						<td class="item_r"><?php _e('Total Paid','event_espresso')?></td>
250
-						<td class="item_r"><?php echo EEH_Template::format_currency($amount_pd,false,false)?> </td>
249
+						<td class="item_r"><?php _e('Total Paid', 'event_espresso')?></td>
250
+						<td class="item_r"><?php echo EEH_Template::format_currency($amount_pd, false, false)?> </td>
251 251
 					</tr>
252 252
 					<?php //echo $discount; ?>
253 253
 					<tr class="total_tr odd">
@@ -259,20 +259,20 @@  discard block
 block discarded – undo
259 259
 			</table>
260 260
 		</div>
261 261
 		<div class="additional-info-dv">
262
-			<h3 class="section-title"><?php _e("Additional Information:", "event_espresso");?></h3>
262
+			<h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3>
263 263
 			<div class="additional-info">
264
-				<?php if($venues_for_events){?>
265
-				<h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso",count($venues_for_events));?></h2>
264
+				<?php if ($venues_for_events) {?>
265
+				<h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso", count($venues_for_events)); ?></h2>
266 266
 				<table class="venue-list">
267
-					<?php foreach($venues_for_events as $venue){?>
267
+					<?php foreach ($venues_for_events as $venue) {?>
268 268
 						<tr class="venue-details">
269 269
 							<td class="venue-details-part venue-address-dv">
270 270
 								<h3><a href='<?php echo $venue->get_permalink()?>'><?php
271 271
 									echo $venue->name()
272 272
 								?></a></h3>
273 273
 								<p><?php echo $venue->description()?></p>
274
-								<?php echo  EEH_Address::format($venue);?></td>
275
-							<?php if($venue->enable_for_gmap()){?>
274
+								<?php echo  EEH_Address::format($venue); ?></td>
275
+							<?php if ($venue->enable_for_gmap()) {?>
276 276
 								<td class="venue-details-part venue-image-dv"><?php echo EEH_Venue_View::espresso_google_static_map($venue)?></td>
277 277
 							<?php } ?>
278 278
 						</tr>
Please login to merge, or discard this patch.
core/libraries/messages/defaults/default/html_receipt_content.template.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 			</td>
24 24
 			<td>
25 25
 				<div id="invoice-info">
26
-					<h2 id="invoice-hdr"><?php _e( 'Order Confirmation', 'event_espresso' ) ?></h2>
26
+					<h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso') ?></h2>
27 27
 
28
-					<h3 id="invoice-date"><?php _e( 'Date:', 'event_espresso' ) ?>
28
+					<h3 id="invoice-date"><?php _e('Date:', 'event_espresso') ?>
29 29
 						<span class="plain-text">[PRIMARY_REGISTRANT_REGISTRATION_DATE]</span></h3>
30 30
 
31
-					<h3 id="invoice-txn-id"><?php _e( 'Transaction ID:', 'event_espresso' ) ?>
31
+					<h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso') ?>
32 32
 						<span class="plain-text">[TXN_ID]</span></h3>
33 33
 
34
-					<h3 id="invoice-txn-status"><?php _e( 'Status:', 'event_espresso' ) ?>
34
+					<h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso') ?>
35 35
 						<span class="[TXN_STATUS_ID] plain-text">[TXN_STATUS]</span></h3>
36 36
 				</div>
37 37
 			</td>
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 		[EVENT_LIST]
42 42
 	</div>
43 43
 	<div class="taxes">
44
-		<h3 class="section-title"><?php _e( "Additional Charges/Discounts", 'event_espresso' ) ?></h3>
44
+		<h3 class="section-title"><?php _e("Additional Charges/Discounts", 'event_espresso') ?></h3>
45 45
 		<table class="invoice-amount">
46 46
 			<thead>
47 47
 				<tr class="header_row">
48
-					<th class="left ticket_th"><?php _e( "Name", "event_espresso" ); ?></th>
49
-					<th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th>
50
-					<th class="event_th item_c"><?php _e( 'Quantity', 'event_espresso' ); ?></th>
51
-					<th class="event_th item_c"><?php _e( 'Unit Price', 'event_espresso' ); ?></th>
52
-					<th class="subtotal_th"><?php _e( 'Total', 'event_espresso' ); ?></th>
48
+					<th class="left ticket_th"><?php _e("Name", "event_espresso"); ?></th>
49
+					<th class="left"><?php _e('Description', 'event_espresso'); ?></th>
50
+					<th class="event_th item_c"><?php _e('Quantity', 'event_espresso'); ?></th>
51
+					<th class="event_th item_c"><?php _e('Unit Price', 'event_espresso'); ?></th>
52
+					<th class="subtotal_th"><?php _e('Total', 'event_espresso'); ?></th>
53 53
 				</tr>
54 54
 			</thead>
55 55
 			<tbody>
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
 		</table>
61 61
 	</div>
62 62
 	<div class="taxes">
63
-		<h3 class="section-title"><?php _e( "Taxes", 'event_espresso' ) ?></h3>
64
-		<p><?php printf( __( '%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso' ), '<strong>', '</strong>' ); ?></p>
63
+		<h3 class="section-title"><?php _e("Taxes", 'event_espresso') ?></h3>
64
+		<p><?php printf(__('%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso'), '<strong>', '</strong>'); ?></p>
65 65
 		<table class="invoice-amount">
66 66
 			<thead>
67 67
 				<tr class="header_row">
68
-					<th class="left ticket_th"><?php _e( "Tax Name", "event_espresso" ); ?></th>
69
-					<th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th>
70
-					<th class="event_th item_c"><?php _e( 'Rate', 'event_espresso' ); ?></th>
71
-					<th class="subtotal_th"><?php _e( 'Tax Amount', 'event_espresso' ); ?></th>
68
+					<th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th>
69
+					<th class="left"><?php _e('Description', 'event_espresso'); ?></th>
70
+					<th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th>
71
+					<th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th>
72 72
 				</tr>
73 73
 			</thead>
74 74
 			<tbody>
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
 		</table>
80 80
 	</div>
81 81
 	<div class="grand-total-dv">
82
-		<h2 class="grand-total"><?php printf( __( "Grand Total: %s", "event_espresso" ), '[TOTAL_COST]' ); ?></h2>
82
+		<h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), '[TOTAL_COST]'); ?></h2>
83 83
 	</div>
84 84
 	<div class="payment-dv">
85
-		<h3 class="section-title"><?php _e( "Payments", 'event_espresso' ) ?></h3>
85
+		<h3 class="section-title"><?php _e("Payments", 'event_espresso') ?></h3>
86 86
 		<table class="invoice-amount">
87 87
 			<thead>
88 88
 				<tr class="header_row">
89
-					<th><span class=""><?php _e( 'Payment Method', 'event_espresso' ); ?></span></th>
90
-					<th class='left datetime_th'><?php _e( "Date", 'event_espresso' ) ?></th>
91
-					<th><span class=""><?php _e( 'Transaction Id / Cheque #', 'event_espresso' ); ?></span></th>
92
-					<th><span class=""><?php _e( 'P.O. / S.O.#', 'event_espresso' ); ?></span></th>
93
-					<th><span class=""><?php _e( 'Status', 'event_espresso' ); ?></span></th>
94
-					<th><?php _e( 'Amount', 'event_espresso' ); ?></th>
89
+					<th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th>
90
+					<th class='left datetime_th'><?php _e("Date", 'event_espresso') ?></th>
91
+					<th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th>
92
+					<th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th>
93
+					<th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th>
94
+					<th><?php _e('Amount', 'event_espresso'); ?></th>
95 95
 				</tr>
96 96
 			</thead>
97 97
 			<tbody>
@@ -105,21 +105,21 @@  discard block
 block discarded – undo
105 105
 			<tfoot>
106 106
 				<tr class='total_tr'>
107 107
 					<td colspan="4">&nbsp;</td>
108
-					<td class="item_r"><?php _e( 'Total Paid', 'event_espresso' ) ?></td>
108
+					<td class="item_r"><?php _e('Total Paid', 'event_espresso') ?></td>
109 109
 					<td class="item_r">[TOTAL_AMOUNT_PAID]</td>
110 110
 				</tr>
111 111
 				<tr class="total_tr odd">
112 112
 					<td colspan="4">&nbsp;</td>
113
-					<td class="total" id="total_currency"><?php _e( 'Amount Owed:', 'event_espresso' ); ?></td>
113
+					<td class="total" id="total_currency"><?php _e('Amount Owed:', 'event_espresso'); ?></td>
114 114
 					<td class="total">[TOTAL_OWING]</td>
115 115
 				</tr>
116 116
 			</tfoot>
117 117
 		</table>
118 118
 	</div>
119 119
 	<div class="additional-info-dv">
120
-		<h3 class="section-title"><?php _e( "Additional Information:", "event_espresso" ); ?></h3>
120
+		<h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3>
121 121
 		<div class="additional-info">
122
-			<h2><?php _e( "Venue Details:", "event_espresso" ); ?></h2>
122
+			<h2><?php _e("Venue Details:", "event_espresso"); ?></h2>
123 123
 			<table class="venue-list">
124 124
 				<tr class="venue-details">
125 125
 					<td class="venue-details-part venue-address-dv">
Please login to merge, or discard this patch.
core/helpers/EEH_Activation.helper.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	 * @since  4.6.0
601 601
 	 * @global WPDB $wpdb
602 602
 	 *
603
-	 * @return mixed null|int WP_user ID or NULL
603
+	 * @return integer|null null|int WP_user ID or NULL
604 604
 	 */
605 605
 	public static function get_default_creator_id() {
606 606
 		global $wpdb;
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 	 * @static
760 760
 	 * @deprecated instead use TableManager::dropTable()
761 761
 	 * @param string $table_name
762
-	 * @return bool | int
762
+	 * @return integer | int
763 763
 	 */
764 764
 	public static function delete_unused_db_table( $table_name ) {
765 765
 		return \EEH_Activation::getTableManager()->dropTable( $table_name );
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 	 * @deprecated instead use TableManager::dropIndex()
776 776
 	 * @param string $table_name
777 777
 	 * @param string $index_name
778
-	 * @return bool | int
778
+	 * @return integer | int
779 779
 	 */
780 780
 	public static function drop_index( $table_name, $index_name ) {
781 781
 		return \EEH_Activation::getTableManager()->dropIndex( $table_name, $index_name );
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			if ( is_array( $hooks_to_fire_at_time ) ) {
252 252
 				foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) {
253 253
 					if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] )
254
-					     && is_array( $ee_cron_tasks_to_remove[ $hook_name ] )
254
+						 && is_array( $ee_cron_tasks_to_remove[ $hook_name ] )
255 255
 					) {
256 256
 						unset( $crons[ $timestamp ][ $hook_name ] );
257 257
 					}
@@ -736,13 +736,13 @@  discard block
 block discarded – undo
736 736
 
737 737
 
738 738
 /**
739
-	 * delete_db_table_if_empty
740
-	 *
741
-	 * @access public
742
-	 * @static
743
-	 * @param string $table_name
744
-	 * @return bool | int
745
-	 */
739
+ * delete_db_table_if_empty
740
+ *
741
+ * @access public
742
+ * @static
743
+ * @param string $table_name
744
+ * @return bool | int
745
+ */
746 746
 	public static function delete_db_table_if_empty( $table_name ) {
747 747
 		if ( \EEH_Activation::getTableAnalysis()->tableIsEmpty( $table_name ) ) {
748 748
 			return \EEH_Activation::getTableManager()->dropTable( $table_name );
@@ -1103,14 +1103,14 @@  discard block
 block discarded – undo
1103 1103
 							$QSG_ID = reset( $id_col );
1104 1104
 						} else {
1105 1105
 							//ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method
1106
-                                                        EE_Log::instance()->log(
1107
-                                                                __FILE__,
1108
-                                                                __FUNCTION__,
1109
-                                                                sprintf(
1110
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'),
1111
-                                                                        $QST_ID ),
1112
-                                                                'error' );
1113
-                                                        continue;
1106
+														EE_Log::instance()->log(
1107
+																__FILE__,
1108
+																__FUNCTION__,
1109
+																sprintf(
1110
+																		__( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'),
1111
+																		$QST_ID ),
1112
+																'error' );
1113
+														continue;
1114 1114
 						}
1115 1115
 					}
1116 1116
 
@@ -1118,8 +1118,8 @@  discard block
 block discarded – undo
1118 1118
 					$wpdb->insert(
1119 1119
 						\EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question_group_question' ),
1120 1120
 						array( 'QSG_ID'    => $QSG_ID,
1121
-						       'QST_ID'    => $QST_ID,
1122
-						       'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++
1121
+							   'QST_ID'    => $QST_ID,
1122
+							   'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++
1123 1123
 						),
1124 1124
 						array( '%d', '%d', '%d' )
1125 1125
 					);
@@ -1663,8 +1663,8 @@  discard block
 block discarded – undo
1663 1663
 				}
1664 1664
 			}
1665 1665
 		}
1666
-                //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1667
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1666
+				//also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1667
+				remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1668 1668
 
1669 1669
 		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1670 1670
 			$db_update_sans_ee4 = array();
Please login to merge, or discard this patch.
Spacing   +318 added lines, -318 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
  * EEH_Activation Helper
4 4
  *
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 * @return \EventEspresso\core\services\database\TableAnalysis
55 55
 	 */
56 56
 	public static function getTableAnalysis() {
57
-		if ( ! self::$table_analysis instanceof \EventEspresso\core\services\database\TableAnalysis ) {
58
-			self::$table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true );
57
+		if ( ! self::$table_analysis instanceof \EventEspresso\core\services\database\TableAnalysis) {
58
+			self::$table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true);
59 59
 		}
60 60
 		return self::$table_analysis;
61 61
 	}
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	 * @return \EventEspresso\core\services\database\TableManager
67 67
 	 */
68 68
 	public static function getTableManager() {
69
-		if ( ! self::$table_manager instanceof \EventEspresso\core\services\database\TableManager ) {
70
-			self::$table_manager = EE_Registry::instance()->create( 'TableManager', array(), true );
69
+		if ( ! self::$table_manager instanceof \EventEspresso\core\services\database\TableManager) {
70
+			self::$table_manager = EE_Registry::instance()->create('TableManager', array(), true);
71 71
 		}
72 72
 		return self::$table_manager;
73 73
 	}
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * @param $table_name
83 83
 	 * @return string
84 84
 	 */
85
-	public static function ensure_table_name_has_prefix( $table_name ) {
86
-		return \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( $table_name );
85
+	public static function ensure_table_name_has_prefix($table_name) {
86
+		return \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix($table_name);
87 87
 	}
88 88
 
89 89
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @return boolean success, whether the database and folders are setup properly
112 112
 	 * @throws \EE_Error
113 113
 	 */
114
-	public static function initialize_db_and_folders(){
114
+	public static function initialize_db_and_folders() {
115 115
 		$good_filesystem = EEH_Activation::create_upload_directories();
116 116
 		$good_db = EEH_Activation::create_database_tables();
117 117
 		return $good_filesystem && $good_db;
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @throws \EE_Error
129 129
 	 */
130
-	public static function initialize_db_content(){
130
+	public static function initialize_db_content() {
131 131
 		//let's avoid doing all this logic repeatedly, especially when addons are requesting it
132
-		if( EEH_Activation::$_initialized_db_content_already_in_this_request ) {
132
+		if (EEH_Activation::$_initialized_db_content_already_in_this_request) {
133 133
 			return;
134 134
 		}
135 135
 		EEH_Activation::$_initialized_db_content_already_in_this_request = true;
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 		EEH_Activation::remove_cron_tasks();
147 147
 		EEH_Activation::create_cron_tasks();
148 148
 		// remove all TXN locks since that is being done via extra meta now
149
-		delete_option( 'ee_locked_transactions' );
149
+		delete_option('ee_locked_transactions');
150 150
 		//also, check for CAF default db content
151
-		do_action( 'AHEE__EEH_Activation__initialize_db_content' );
151
+		do_action('AHEE__EEH_Activation__initialize_db_content');
152 152
 		//also: EEM_Gateways::load_all_gateways() outputs a lot of success messages
153 153
 		//which users really won't care about on initial activation
154 154
 		EE_Error::overwrite_success();
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @return array
169 169
 	 * @throws \EE_Error
170 170
 	 */
171
-	public static function get_cron_tasks( $which_to_include ) {
171
+	public static function get_cron_tasks($which_to_include) {
172 172
 		$cron_tasks = apply_filters(
173 173
 			'FHEE__EEH_Activation__get_cron_tasks',
174 174
 			array(
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
 				'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates
178 178
 			)
179 179
 		);
180
-		if ( $which_to_include === 'old' ) {
180
+		if ($which_to_include === 'old') {
181 181
 			$cron_tasks = array_filter(
182 182
 				$cron_tasks,
183
-				function ( $value ) {
183
+				function($value) {
184 184
 					return $value === EEH_Activation::cron_task_no_longer_in_use;
185 185
 				}
186 186
 			);
187
-		} elseif ( $which_to_include === 'current' ) {
188
-			$cron_tasks = array_filter( $cron_tasks );
189
-		} elseif ( WP_DEBUG && $which_to_include !== 'all' ) {
187
+		} elseif ($which_to_include === 'current') {
188
+			$cron_tasks = array_filter($cron_tasks);
189
+		} elseif (WP_DEBUG && $which_to_include !== 'all') {
190 190
 			throw new EE_Error(
191 191
 				sprintf(
192 192
 					__(
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public static function create_cron_tasks() {
211 211
 
212
-		foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) {
213
-			if( ! wp_next_scheduled( $hook_name ) ) {
214
-				wp_schedule_event( time(), $frequency, $hook_name );
212
+		foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) {
213
+			if ( ! wp_next_scheduled($hook_name)) {
214
+				wp_schedule_event(time(), $frequency, $hook_name);
215 215
 			}
216 216
 		}
217 217
 
@@ -225,10 +225,10 @@  discard block
 block discarded – undo
225 225
 	 * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones
226 226
 	 * @throws \EE_Error
227 227
 	 */
228
-	public static function remove_cron_tasks( $remove_all = true ) {
228
+	public static function remove_cron_tasks($remove_all = true) {
229 229
 		$cron_tasks_to_remove = $remove_all ? 'all' : 'old';
230 230
 		$crons = _get_cron_array();
231
-		$crons = is_array( $crons ) ? $crons : array();
231
+		$crons = is_array($crons) ? $crons : array();
232 232
 		/* reminder of what $crons look like:
233 233
 		 * Top-level keys are timestamps, and their values are arrays.
234 234
 		 * The 2nd level arrays have keys with each of the cron task hook names to run at that time
@@ -246,23 +246,23 @@  discard block
 block discarded – undo
246 246
 		 *					...
247 247
 		 *      ...
248 248
 		 */
249
-		$ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks( $cron_tasks_to_remove );
250
-		foreach ( $crons as $timestamp => $hooks_to_fire_at_time ) {
251
-			if ( is_array( $hooks_to_fire_at_time ) ) {
252
-				foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) {
253
-					if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] )
254
-					     && is_array( $ee_cron_tasks_to_remove[ $hook_name ] )
249
+		$ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks($cron_tasks_to_remove);
250
+		foreach ($crons as $timestamp => $hooks_to_fire_at_time) {
251
+			if (is_array($hooks_to_fire_at_time)) {
252
+				foreach ($hooks_to_fire_at_time as $hook_name => $hook_actions) {
253
+					if (isset($ee_cron_tasks_to_remove[$hook_name])
254
+					     && is_array($ee_cron_tasks_to_remove[$hook_name])
255 255
 					) {
256
-						unset( $crons[ $timestamp ][ $hook_name ] );
256
+						unset($crons[$timestamp][$hook_name]);
257 257
 					}
258 258
 				}
259 259
 				//also take care of any empty cron timestamps.
260
-				if ( empty( $hooks_to_fire_at_time ) ) {
261
-					unset( $crons[ $timestamp ] );
260
+				if (empty($hooks_to_fire_at_time)) {
261
+					unset($crons[$timestamp]);
262 262
 				}
263 263
 			}
264 264
 		}
265
-		_set_cron_array( $crons );
265
+		_set_cron_array($crons);
266 266
 	}
267 267
 
268 268
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	public static function CPT_initialization() {
279 279
 		// register Custom Post Types
280
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
280
+		EE_Registry::instance()->load_core('Register_CPTs');
281 281
 		flush_rewrite_rules();
282 282
 	}
283 283
 
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 	 * 	@return void
296 296
 	 */
297 297
 	public static function reset_and_update_config() {
298
-		do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) );
299
-		add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 );
298
+		do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config'));
299
+		add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3);
300 300
 		//EE_Config::reset();
301 301
 	}
302 302
 
@@ -309,28 +309,28 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	public static function load_calendar_config() {
311 311
 		// grab array of all plugin folders and loop thru it
312
-		$plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR );
313
-		if ( empty( $plugins ) ) {
312
+		$plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR);
313
+		if (empty($plugins)) {
314 314
 			return;
315 315
 		}
316
-		foreach ( $plugins as $plugin_path ) {
316
+		foreach ($plugins as $plugin_path) {
317 317
 			// grab plugin folder name from path
318
-			$plugin = basename( $plugin_path );
318
+			$plugin = basename($plugin_path);
319 319
 			// drill down to Espresso plugins
320 320
 			// then to calendar related plugins
321 321
 			if (
322
-				strpos( $plugin, 'espresso' ) !== FALSE
323
-				|| strpos( $plugin, 'Espresso' ) !== FALSE
324
-				|| strpos( $plugin, 'ee4' ) !== FALSE
325
-				|| strpos( $plugin, 'EE4' ) !== FALSE
326
-				|| strpos( $plugin, 'calendar' ) !== false
322
+				strpos($plugin, 'espresso') !== FALSE
323
+				|| strpos($plugin, 'Espresso') !== FALSE
324
+				|| strpos($plugin, 'ee4') !== FALSE
325
+				|| strpos($plugin, 'EE4') !== FALSE
326
+				|| strpos($plugin, 'calendar') !== false
327 327
 			) {
328 328
 				// this is what we are looking for
329
-				$calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php';
329
+				$calendar_config = $plugin_path.DS.'EE_Calendar_Config.php';
330 330
 				// does it exist in this folder ?
331
-				if ( is_readable( $calendar_config )) {
331
+				if (is_readable($calendar_config)) {
332 332
 					// YEAH! let's load it
333
-					require_once( $calendar_config );
333
+					require_once($calendar_config);
334 334
 				}
335 335
 			}
336 336
 		}
@@ -346,21 +346,21 @@  discard block
 block discarded – undo
346 346
 	 * @param \EE_Config     $EE_Config
347 347
 	 * @return \stdClass
348 348
 	 */
349
-	public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) {
350
-		$convert_from_array = array( 'addons' );
349
+	public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) {
350
+		$convert_from_array = array('addons');
351 351
 		// in case old settings were saved as an array
352
-		if ( is_array( $settings ) && in_array( $config, $convert_from_array )) {
352
+		if (is_array($settings) && in_array($config, $convert_from_array)) {
353 353
 			// convert existing settings to an object
354 354
 			$config_array = $settings;
355 355
 			$settings = new stdClass();
356
-			foreach ( $config_array as $key => $value ){
357
-				if ( $key === 'calendar' && class_exists( 'EE_Calendar_Config' )) {
358
-					$EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value );
356
+			foreach ($config_array as $key => $value) {
357
+				if ($key === 'calendar' && class_exists('EE_Calendar_Config')) {
358
+					$EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value);
359 359
 				} else {
360 360
 					$settings->{$key} = $value;
361 361
 				}
362 362
 			}
363
-			add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' );
363
+			add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true');
364 364
 		}
365 365
 		return $settings;
366 366
 	}
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 	 */
377 377
 	public static function deactivate_event_espresso() {
378 378
 		// check permissions
379
-		if ( current_user_can( 'activate_plugins' )) {
380
-			deactivate_plugins( EE_PLUGIN_BASENAME, TRUE );
379
+		if (current_user_can('activate_plugins')) {
380
+			deactivate_plugins(EE_PLUGIN_BASENAME, TRUE);
381 381
 		}
382 382
 	}
383 383
 
@@ -399,25 +399,25 @@  discard block
 block discarded – undo
399 399
 		$critical_pages = array(
400 400
 			array(
401 401
 				'id' =>'reg_page_id',
402
-				'name' => __( 'Registration Checkout', 'event_espresso' ),
402
+				'name' => __('Registration Checkout', 'event_espresso'),
403 403
 				'post' => NULL,
404 404
 				'code' => 'ESPRESSO_CHECKOUT'
405 405
 			),
406 406
 			array(
407 407
 				'id' => 'txn_page_id',
408
-				'name' => __( 'Transactions', 'event_espresso' ),
408
+				'name' => __('Transactions', 'event_espresso'),
409 409
 				'post' => NULL,
410 410
 				'code' => 'ESPRESSO_TXN_PAGE'
411 411
 			),
412 412
 			array(
413 413
 				'id' => 'thank_you_page_id',
414
-				'name' => __( 'Thank You', 'event_espresso' ),
414
+				'name' => __('Thank You', 'event_espresso'),
415 415
 				'post' => NULL,
416 416
 				'code' => 'ESPRESSO_THANK_YOU'
417 417
 			),
418 418
 			array(
419 419
 				'id' => 'cancel_page_id',
420
-				'name' => __( 'Registration Cancelled', 'event_espresso' ),
420
+				'name' => __('Registration Cancelled', 'event_espresso'),
421 421
 				'post' => NULL,
422 422
 				'code' => 'ESPRESSO_CANCELLED'
423 423
 			),
@@ -425,62 +425,62 @@  discard block
 block discarded – undo
425 425
 
426 426
 		$EE_Core_Config = EE_Registry::instance()->CFG->core;
427 427
 
428
-		foreach ( $critical_pages as $critical_page ) {
428
+		foreach ($critical_pages as $critical_page) {
429 429
 			// is critical page ID set in config ?
430
-			if ( $EE_Core_Config->{$critical_page[ 'id' ]} !== FALSE ) {
430
+			if ($EE_Core_Config->{$critical_page['id']} !== FALSE) {
431 431
 				// attempt to find post by ID
432
-				$critical_page['post'] = get_post( $EE_Core_Config->{$critical_page[ 'id' ]} );
432
+				$critical_page['post'] = get_post($EE_Core_Config->{$critical_page['id']} );
433 433
 			}
434 434
 			// no dice?
435
-			if ( $critical_page['post'] === null ) {
435
+			if ($critical_page['post'] === null) {
436 436
 				// attempt to find post by title
437
-				$critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] );
437
+				$critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']);
438 438
 				// still nothing?
439
-				if ( $critical_page['post'] === null ) {
440
-					$critical_page = EEH_Activation::create_critical_page( $critical_page );
439
+				if ($critical_page['post'] === null) {
440
+					$critical_page = EEH_Activation::create_critical_page($critical_page);
441 441
 					// REALLY? Still nothing ??!?!?
442
-					if ( $critical_page['post'] === null ) {
443
-						$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
444
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
442
+					if ($critical_page['post'] === null) {
443
+						$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
444
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
445 445
 						break;
446 446
 					}
447 447
 				}
448 448
 			}
449 449
 			// track post_shortcodes
450
-			if ( $critical_page['post'] ) {
451
-				EEH_Activation::_track_critical_page_post_shortcodes( $critical_page );
450
+			if ($critical_page['post']) {
451
+				EEH_Activation::_track_critical_page_post_shortcodes($critical_page);
452 452
 			}
453 453
 			// check that Post ID matches critical page ID in config
454 454
 			if (
455
-				isset( $critical_page['post']->ID )
456
-				&& $critical_page['post']->ID !== $EE_Core_Config->{$critical_page[ 'id' ]}
455
+				isset($critical_page['post']->ID)
456
+				&& $critical_page['post']->ID !== $EE_Core_Config->{$critical_page['id']}
457 457
 			) {
458 458
 				//update Config with post ID
459
-				$EE_Core_Config->{$critical_page[ 'id' ]} = $critical_page['post']->ID;
460
-				if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) {
461
-					$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
462
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
459
+				$EE_Core_Config->{$critical_page['id']} = $critical_page['post']->ID;
460
+				if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
461
+					$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
462
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
463 463
 				}
464 464
 			}
465 465
 
466 466
 			$critical_page_problem =
467
-				! isset( $critical_page['post']->post_status )
467
+				! isset($critical_page['post']->post_status)
468 468
 				|| $critical_page['post']->post_status !== 'publish'
469
-				|| strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE
469
+				|| strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE
470 470
 					? TRUE
471 471
 					: $critical_page_problem;
472 472
 
473 473
 		}
474 474
 
475
-		if ( $critical_page_problem ) {
475
+		if ($critical_page_problem) {
476 476
 			$msg = sprintf(
477
-				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ),
478
-				'<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>'
477
+				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'),
478
+				'<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>'
479 479
 			);
480
-			EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg );
480
+			EE_Error::add_persistent_admin_notice('critical_page_problem', $msg);
481 481
 		}
482
-		if ( EE_Error::has_notices() ) {
483
-			EE_Error::get_notices( FALSE, TRUE, TRUE );
482
+		if (EE_Error::has_notices()) {
483
+			EE_Error::get_notices(FALSE, TRUE, TRUE);
484 484
 		}
485 485
 	}
486 486
 
@@ -492,13 +492,13 @@  discard block
 block discarded – undo
492 492
 	 * parameter to the shortcode
493 493
 	 * @return WP_Post or NULl
494 494
 	 */
495
-	public static function get_page_by_ee_shortcode($ee_shortcode){
495
+	public static function get_page_by_ee_shortcode($ee_shortcode) {
496 496
 		global $wpdb;
497 497
 		$shortcode_and_opening_bracket = '['.$ee_shortcode;
498 498
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
499
-		if($post_id){
499
+		if ($post_id) {
500 500
 			return get_post($post_id);
501
-		}else{
501
+		} else {
502 502
 			return NULL;
503 503
 		}
504 504
 
@@ -515,32 +515,32 @@  discard block
 block discarded – undo
515 515
 	 * @param array $critical_page
516 516
 	 * @return array
517 517
 	 */
518
-	public static function create_critical_page( $critical_page ) {
518
+	public static function create_critical_page($critical_page) {
519 519
 
520 520
 		$post_args = array(
521 521
 			'post_title' => $critical_page['name'],
522 522
 			'post_status' => 'publish',
523 523
 			'post_type' => 'page',
524 524
 			'comment_status' => 'closed',
525
-			'post_content' => '[' . $critical_page['code'] . ']'
525
+			'post_content' => '['.$critical_page['code'].']'
526 526
 		);
527 527
 
528
-		$post_id = wp_insert_post( $post_args );
529
-		if ( ! $post_id ) {
528
+		$post_id = wp_insert_post($post_args);
529
+		if ( ! $post_id) {
530 530
 			$msg = sprintf(
531
-				__( 'The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso' ),
531
+				__('The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso'),
532 532
 				$critical_page['name']
533 533
 			);
534
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
534
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
535 535
 			return $critical_page;
536 536
 		}
537 537
 		// get newly created post's details
538
-		if ( ! $critical_page['post'] = get_post( $post_id )) {
538
+		if ( ! $critical_page['post'] = get_post($post_id)) {
539 539
 			$msg = sprintf(
540
-				__( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ),
540
+				__('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'),
541 541
 				$critical_page['name']
542 542
 			);
543
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
543
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
544 544
 		}
545 545
 
546 546
 		return $critical_page;
@@ -559,35 +559,35 @@  discard block
 block discarded – undo
559 559
 	 * @param array $critical_page
560 560
 	 * @return void
561 561
 	 */
562
-	private static function _track_critical_page_post_shortcodes( $critical_page = array() ) {
562
+	private static function _track_critical_page_post_shortcodes($critical_page = array()) {
563 563
 		// check the goods
564
-		if ( ! $critical_page['post'] instanceof WP_Post ) {
564
+		if ( ! $critical_page['post'] instanceof WP_Post) {
565 565
 			$msg = sprintf(
566
-				__( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ),
566
+				__('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'),
567 567
 				$critical_page['name']
568 568
 			);
569
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
569
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
570 570
 			return;
571 571
 		}
572 572
 		$EE_Core_Config = EE_Registry::instance()->CFG->core;
573 573
 		// map shortcode to post
574
-		$EE_Core_Config->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID;
574
+		$EE_Core_Config->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID;
575 575
 		// and make sure it's NOT added to the WP "Posts Page"
576 576
 		// name of the WP Posts Page
577 577
 		$posts_page = EE_Config::get_page_for_posts();
578
-		if ( isset( $EE_Core_Config->post_shortcodes[ $posts_page ] )) {
579
-			unset( $EE_Core_Config->post_shortcodes[ $posts_page ][ $critical_page['code'] ] );
578
+		if (isset($EE_Core_Config->post_shortcodes[$posts_page])) {
579
+			unset($EE_Core_Config->post_shortcodes[$posts_page][$critical_page['code']]);
580 580
 		}
581
-		if ( $posts_page !== 'posts' && isset( $EE_Core_Config->post_shortcodes['posts'] )) {
582
-			unset( $EE_Core_Config->post_shortcodes['posts'][ $critical_page['code'] ] );
581
+		if ($posts_page !== 'posts' && isset($EE_Core_Config->post_shortcodes['posts'])) {
582
+			unset($EE_Core_Config->post_shortcodes['posts'][$critical_page['code']]);
583 583
 		}
584 584
 		// update post_shortcode CFG
585
-		if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) {
585
+		if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
586 586
 			$msg = sprintf(
587
-				__( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ),
587
+				__('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'),
588 588
 				$critical_page['name']
589 589
 			);
590
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
590
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
591 591
 		}
592 592
 	}
593 593
 
@@ -605,24 +605,24 @@  discard block
 block discarded – undo
605 605
 	public static function get_default_creator_id() {
606 606
 		global $wpdb;
607 607
 
608
-		if ( ! empty( self::$_default_creator_id ) ) {
608
+		if ( ! empty(self::$_default_creator_id)) {
609 609
 			return self::$_default_creator_id;
610 610
 		}/**/
611 611
 
612
-		$role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' );
612
+		$role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator');
613 613
 
614 614
 		//let's allow pre_filtering for early exits by alternative methods for getting id.  We check for truthy result and if so then exit early.
615
-		$pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check );
616
-		if ( $pre_filtered_id !== false ) {
615
+		$pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check);
616
+		if ($pre_filtered_id !== false) {
617 617
 			return (int) $pre_filtered_id;
618 618
 		}
619 619
 
620
-		$capabilities_key = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'capabilities' );
621
-		$query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' );
622
-		$user_id = $wpdb->get_var( $query );
623
-		 $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id );
624
-		 if ( $user_id && (int)$user_id ) {
625
-		 	self::$_default_creator_id = (int)$user_id;
620
+		$capabilities_key = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('capabilities');
621
+		$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%');
622
+		$user_id = $wpdb->get_var($query);
623
+		 $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id);
624
+		 if ($user_id && (int) $user_id) {
625
+		 	self::$_default_creator_id = (int) $user_id;
626 626
 		 	return self::$_default_creator_id;
627 627
 		 } else {
628 628
 		 	return NULL;
@@ -651,28 +651,28 @@  discard block
 block discarded – undo
651 651
 	 * 	@return void
652 652
 	 * @throws EE_Error if there are database errors
653 653
 	 */
654
-	public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) {
655
-		if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){
654
+	public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) {
655
+		if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) {
656 656
 			return;
657 657
 		}
658
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
659
-		if ( ! function_exists( 'dbDelta' )) {
660
-			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
658
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
659
+		if ( ! function_exists('dbDelta')) {
660
+			require_once(ABSPATH.'wp-admin/includes/upgrade.php');
661 661
 		}
662 662
 		$tableAnalysis = \EEH_Activation::getTableAnalysis();
663
-		$wp_table_name = $tableAnalysis->ensureTableNameHasPrefix( $table_name );
663
+		$wp_table_name = $tableAnalysis->ensureTableNameHasPrefix($table_name);
664 664
 		// do we need to first delete an existing version of this table ?
665
-		if ( $drop_pre_existing_table && $tableAnalysis->tableExists( $wp_table_name ) ){
665
+		if ($drop_pre_existing_table && $tableAnalysis->tableExists($wp_table_name)) {
666 666
 			// ok, delete the table... but ONLY if it's empty
667
-			$deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name );
667
+			$deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name);
668 668
 			// table is NOT empty, are you SURE you want to delete this table ???
669
-			if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
670
-				\EEH_Activation::getTableManager()->dropTable( $wp_table_name );
671
-			} else if ( ! $deleted_safely ) {
669
+			if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) {
670
+				\EEH_Activation::getTableManager()->dropTable($wp_table_name);
671
+			} else if ( ! $deleted_safely) {
672 672
 				// so we should be more cautious rather than just dropping tables so easily
673 673
 				EE_Error::add_persistent_admin_notice(
674
-						'bad_table_' . $wp_table_name . '_detected',
675
-						sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ),
674
+						'bad_table_'.$wp_table_name.'_detected',
675
+						sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'),
676 676
 								$wp_table_name,
677 677
 								"<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>",
678 678
 								'<b>wp-config.php</b>',
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 								TRUE );
681 681
 			}
682 682
 		}
683
-		$engine = str_replace( 'ENGINE=', '', $engine );
684
-		\EEH_Activation::getTableManager()->createTable( $table_name, $sql, $engine );
683
+		$engine = str_replace('ENGINE=', '', $engine);
684
+		\EEH_Activation::getTableManager()->createTable($table_name, $sql, $engine);
685 685
 	}
686 686
 
687 687
 
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
 	 *                            'VARCHAR(10)'
700 700
 	 * @return bool|int
701 701
 	 */
702
-	public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){
703
-		return \EEH_Activation::getTableManager()->addColumn( $table_name, $column_name, $column_info );
702
+	public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') {
703
+		return \EEH_Activation::getTableManager()->addColumn($table_name, $column_name, $column_info);
704 704
 	}
705 705
 
706 706
 
@@ -716,8 +716,8 @@  discard block
 block discarded – undo
716 716
 	 * @param string $table_name, without prefixed $wpdb->prefix
717 717
 	 * @return array of database column names
718 718
 	 */
719
-	public static function get_fields_on_table( $table_name = NULL ) {
720
-		return \EEH_Activation::getTableManager()->getTableColumns( $table_name );
719
+	public static function get_fields_on_table($table_name = NULL) {
720
+		return \EEH_Activation::getTableManager()->getTableColumns($table_name);
721 721
 	}
722 722
 
723 723
 
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
 	 * @param string $table_name
732 732
 	 * @return bool
733 733
 	 */
734
-	public static function db_table_is_empty( $table_name ) {
735
-		return \EEH_Activation::getTableAnalysis()->tableIsEmpty( $table_name );
734
+	public static function db_table_is_empty($table_name) {
735
+		return \EEH_Activation::getTableAnalysis()->tableIsEmpty($table_name);
736 736
 }
737 737
 
738 738
 
@@ -745,9 +745,9 @@  discard block
 block discarded – undo
745 745
 	 * @param string $table_name
746 746
 	 * @return bool | int
747 747
 	 */
748
-	public static function delete_db_table_if_empty( $table_name ) {
749
-		if ( \EEH_Activation::getTableAnalysis()->tableIsEmpty( $table_name ) ) {
750
-			return \EEH_Activation::getTableManager()->dropTable( $table_name );
748
+	public static function delete_db_table_if_empty($table_name) {
749
+		if (\EEH_Activation::getTableAnalysis()->tableIsEmpty($table_name)) {
750
+			return \EEH_Activation::getTableManager()->dropTable($table_name);
751 751
 		}
752 752
 		return false;
753 753
 	}
@@ -763,8 +763,8 @@  discard block
 block discarded – undo
763 763
 	 * @param string $table_name
764 764
 	 * @return bool | int
765 765
 	 */
766
-	public static function delete_unused_db_table( $table_name ) {
767
-		return \EEH_Activation::getTableManager()->dropTable( $table_name );
766
+	public static function delete_unused_db_table($table_name) {
767
+		return \EEH_Activation::getTableManager()->dropTable($table_name);
768 768
 	}
769 769
 
770 770
 
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
 	 * @param string $index_name
780 780
 	 * @return bool | int
781 781
 	 */
782
-	public static function drop_index( $table_name, $index_name ) {
783
-		return \EEH_Activation::getTableManager()->dropIndex( $table_name, $index_name );
782
+	public static function drop_index($table_name, $index_name) {
783
+		return \EEH_Activation::getTableManager()->dropIndex($table_name, $index_name);
784 784
 	}
785 785
 
786 786
 
@@ -794,27 +794,27 @@  discard block
 block discarded – undo
794 794
 	 * @return boolean success (whether database is setup properly or not)
795 795
 	 */
796 796
 	public static function create_database_tables() {
797
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
797
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
798 798
 		//find the migration script that sets the database to be compatible with the code
799 799
 		$dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms();
800
-		if( $dms_name ){
801
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name );
802
-			$current_data_migration_script->set_migrating( false );
800
+		if ($dms_name) {
801
+			$current_data_migration_script = EE_Registry::instance()->load_dms($dms_name);
802
+			$current_data_migration_script->set_migrating(false);
803 803
 			$current_data_migration_script->schema_changes_before_migration();
804 804
 			$current_data_migration_script->schema_changes_after_migration();
805
-			if( $current_data_migration_script->get_errors() ){
806
-				if( WP_DEBUG ){
807
-					foreach( $current_data_migration_script->get_errors() as $error ){
808
-						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
805
+			if ($current_data_migration_script->get_errors()) {
806
+				if (WP_DEBUG) {
807
+					foreach ($current_data_migration_script->get_errors() as $error) {
808
+						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
809 809
 					}
810
-				}else{
811
-					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
810
+				} else {
811
+					EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso'));
812 812
 				}
813 813
 				return false;
814 814
 			}
815 815
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
816
-		}else{
817
-			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
816
+		} else {
817
+			EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
818 818
 			return false;
819 819
 		}
820 820
 		return true;
@@ -834,27 +834,27 @@  discard block
 block discarded – undo
834 834
 	public static function initialize_system_questions() {
835 835
 		// QUESTION GROUPS
836 836
 		global $wpdb;
837
-		$table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question_group' );
837
+		$table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('esp_question_group');
838 838
 		$SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0";
839 839
 		// what we have
840
-		$question_groups = $wpdb->get_col( $SQL );
840
+		$question_groups = $wpdb->get_col($SQL);
841 841
 		// check the response
842
-		$question_groups = is_array( $question_groups ) ? $question_groups : array();
842
+		$question_groups = is_array($question_groups) ? $question_groups : array();
843 843
 		// what we should have
844
-		$QSG_systems = array( 1, 2 );
844
+		$QSG_systems = array(1, 2);
845 845
 		// loop thru what we should have and compare to what we have
846
-		foreach ( $QSG_systems as $QSG_system ) {
846
+		foreach ($QSG_systems as $QSG_system) {
847 847
 			// reset values array
848 848
 			$QSG_values = array();
849 849
 			// if we don't have what we should have (but use $QST_system as as string because that's what we got from the db)
850
-			if ( ! in_array( "$QSG_system", $question_groups )) {
850
+			if ( ! in_array("$QSG_system", $question_groups)) {
851 851
 				// add it
852
-				switch ( $QSG_system ) {
852
+				switch ($QSG_system) {
853 853
 
854 854
 					case 1:
855 855
 							$QSG_values = array(
856
-									'QSG_name' => __( 'Personal Information', 'event_espresso' ),
857
-									'QSG_identifier' => 'personal-information-' . time(),
856
+									'QSG_name' => __('Personal Information', 'event_espresso'),
857
+									'QSG_identifier' => 'personal-information-'.time(),
858 858
 									'QSG_desc' => '',
859 859
 									'QSG_order' => 1,
860 860
 									'QSG_show_group_name' => 1,
@@ -866,8 +866,8 @@  discard block
 block discarded – undo
866 866
 
867 867
 					case 2:
868 868
 							$QSG_values = array(
869
-									'QSG_name' => __( 'Address Information','event_espresso' ),
870
-									'QSG_identifier' => 'address-information-' . time(),
869
+									'QSG_name' => __('Address Information', 'event_espresso'),
870
+									'QSG_identifier' => 'address-information-'.time(),
871 871
 									'QSG_desc' => '',
872 872
 									'QSG_order' => 2,
873 873
 									'QSG_show_group_name' => 1,
@@ -879,14 +879,14 @@  discard block
 block discarded – undo
879 879
 
880 880
 				}
881 881
 				// make sure we have some values before inserting them
882
-				if ( ! empty( $QSG_values )) {
882
+				if ( ! empty($QSG_values)) {
883 883
 					// insert system question
884 884
 					$wpdb->insert(
885 885
 						$table_name,
886 886
 						$QSG_values,
887
-						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' )
887
+						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d')
888 888
 					);
889
-					$QSG_IDs[ $QSG_system ] = $wpdb->insert_id;
889
+					$QSG_IDs[$QSG_system] = $wpdb->insert_id;
890 890
 				}
891 891
 			}
892 892
 		}
@@ -895,10 +895,10 @@  discard block
 block discarded – undo
895 895
 
896 896
 		// QUESTIONS
897 897
 		global $wpdb;
898
-		$table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question' );
898
+		$table_name = \EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('esp_question');
899 899
 		$SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''";
900 900
 		// what we have
901
-		$questions = $wpdb->get_col( $SQL );
901
+		$questions = $wpdb->get_col($SQL);
902 902
 		// what we should have
903 903
 		$QST_systems = array(
904 904
 			'fname',
@@ -915,25 +915,25 @@  discard block
 block discarded – undo
915 915
 		$order_for_group_1 = 1;
916 916
 		$order_for_group_2 = 1;
917 917
 		// loop thru what we should have and compare to what we have
918
-		foreach ( $QST_systems as $QST_system ) {
918
+		foreach ($QST_systems as $QST_system) {
919 919
 			// reset values array
920 920
 			$QST_values = array();
921 921
 			// if we don't have what we should have
922
-			if ( ! in_array( $QST_system, $questions )) {
922
+			if ( ! in_array($QST_system, $questions)) {
923 923
 				// add it
924
-				switch ( $QST_system ) {
924
+				switch ($QST_system) {
925 925
 
926 926
 					case 'fname':
927 927
 							$QST_values = array(
928
-									'QST_display_text' => __( 'First Name', 'event_espresso' ),
929
-									'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ),
928
+									'QST_display_text' => __('First Name', 'event_espresso'),
929
+									'QST_admin_label' => __('First Name - System Question', 'event_espresso'),
930 930
 									'QST_system' => 'fname',
931 931
 									'QST_type' => 'TEXT',
932 932
 									'QST_required' => 1,
933
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
933
+									'QST_required_text' => __('This field is required', 'event_espresso'),
934 934
 									'QST_order' => 1,
935 935
 									'QST_admin_only' => 0,
936
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
936
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
937 937
 									'QST_wp_user' => self::get_default_creator_id(),
938 938
 									'QST_deleted' => 0
939 939
 								);
@@ -941,15 +941,15 @@  discard block
 block discarded – undo
941 941
 
942 942
 					case 'lname':
943 943
 							$QST_values = array(
944
-									'QST_display_text' => __( 'Last Name', 'event_espresso' ),
945
-									'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ),
944
+									'QST_display_text' => __('Last Name', 'event_espresso'),
945
+									'QST_admin_label' => __('Last Name - System Question', 'event_espresso'),
946 946
 									'QST_system' => 'lname',
947 947
 									'QST_type' => 'TEXT',
948 948
 									'QST_required' => 1,
949
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
949
+									'QST_required_text' => __('This field is required', 'event_espresso'),
950 950
 									'QST_order' => 2,
951 951
 									'QST_admin_only' => 0,
952
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
952
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
953 953
 									'QST_wp_user' => self::get_default_creator_id(),
954 954
 									'QST_deleted' => 0
955 955
 								);
@@ -957,15 +957,15 @@  discard block
 block discarded – undo
957 957
 
958 958
 					case 'email':
959 959
 							$QST_values = array(
960
-									'QST_display_text' => __( 'Email Address', 'event_espresso' ),
961
-									'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ),
960
+									'QST_display_text' => __('Email Address', 'event_espresso'),
961
+									'QST_admin_label' => __('Email Address - System Question', 'event_espresso'),
962 962
 									'QST_system' => 'email',
963 963
 									'QST_type' => 'EMAIL',
964 964
 									'QST_required' => 1,
965
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
965
+									'QST_required_text' => __('This field is required', 'event_espresso'),
966 966
 									'QST_order' => 3,
967 967
 									'QST_admin_only' => 0,
968
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
968
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
969 969
 									'QST_wp_user' => self::get_default_creator_id(),
970 970
 									'QST_deleted' => 0
971 971
 								);
@@ -973,15 +973,15 @@  discard block
 block discarded – undo
973 973
 
974 974
 					case 'address':
975 975
 							$QST_values = array(
976
-									'QST_display_text' => __( 'Address', 'event_espresso' ),
977
-									'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ),
976
+									'QST_display_text' => __('Address', 'event_espresso'),
977
+									'QST_admin_label' => __('Address - System Question', 'event_espresso'),
978 978
 									'QST_system' => 'address',
979 979
 									'QST_type' => 'TEXT',
980 980
 									'QST_required' => 0,
981
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
981
+									'QST_required_text' => __('This field is required', 'event_espresso'),
982 982
 									'QST_order' => 4,
983 983
 									'QST_admin_only' => 0,
984
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
984
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
985 985
 									'QST_wp_user' => self::get_default_creator_id(),
986 986
 									'QST_deleted' => 0
987 987
 								);
@@ -989,15 +989,15 @@  discard block
 block discarded – undo
989 989
 
990 990
 					case 'address2':
991 991
 							$QST_values = array(
992
-									'QST_display_text' => __( 'Address2', 'event_espresso' ),
993
-									'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ),
992
+									'QST_display_text' => __('Address2', 'event_espresso'),
993
+									'QST_admin_label' => __('Address2 - System Question', 'event_espresso'),
994 994
 									'QST_system' => 'address2',
995 995
 									'QST_type' => 'TEXT',
996 996
 									'QST_required' => 0,
997
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
997
+									'QST_required_text' => __('This field is required', 'event_espresso'),
998 998
 									'QST_order' => 5,
999 999
 									'QST_admin_only' => 0,
1000
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1000
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1001 1001
 									'QST_wp_user' => self::get_default_creator_id(),
1002 1002
 									'QST_deleted' => 0
1003 1003
 								);
@@ -1005,27 +1005,27 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
 					case 'city':
1007 1007
 							$QST_values = array(
1008
-									'QST_display_text' => __( 'City', 'event_espresso' ),
1009
-									'QST_admin_label' => __( 'City - System Question', 'event_espresso' ),
1008
+									'QST_display_text' => __('City', 'event_espresso'),
1009
+									'QST_admin_label' => __('City - System Question', 'event_espresso'),
1010 1010
 									'QST_system' => 'city',
1011 1011
 									'QST_type' => 'TEXT',
1012 1012
 									'QST_required' => 0,
1013
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1013
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1014 1014
 									'QST_order' => 6,
1015 1015
 									'QST_admin_only' => 0,
1016
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1016
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1017 1017
 									'QST_wp_user' => self::get_default_creator_id(),
1018 1018
 									'QST_deleted' => 0
1019 1019
 								);
1020 1020
 						break;
1021 1021
 					case 'country' :
1022 1022
 						$QST_values = array(
1023
-							'QST_display_text'  => __( 'Country', 'event_espresso' ),
1024
-							'QST_admin_label'   => __( 'Country - System Question', 'event_espresso' ),
1023
+							'QST_display_text'  => __('Country', 'event_espresso'),
1024
+							'QST_admin_label'   => __('Country - System Question', 'event_espresso'),
1025 1025
 							'QST_system'        => 'country',
1026 1026
 							'QST_type'          => 'COUNTRY',
1027 1027
 							'QST_required'      => 0,
1028
-							'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1028
+							'QST_required_text' => __('This field is required', 'event_espresso'),
1029 1029
 							'QST_order'         => 7,
1030 1030
 							'QST_admin_only'    => 0,
1031 1031
 							'QST_wp_user'       => self::get_default_creator_id(),
@@ -1035,12 +1035,12 @@  discard block
 block discarded – undo
1035 1035
 
1036 1036
 					case 'state':
1037 1037
 						$QST_values = array(
1038
-							'QST_display_text'  => __( 'State/Province', 'event_espresso' ),
1039
-							'QST_admin_label'   => __( 'State/Province - System Question', 'event_espresso' ),
1038
+							'QST_display_text'  => __('State/Province', 'event_espresso'),
1039
+							'QST_admin_label'   => __('State/Province - System Question', 'event_espresso'),
1040 1040
 							'QST_system'        => 'state',
1041 1041
 							'QST_type'          => 'STATE',
1042 1042
 							'QST_required'      => 0,
1043
-							'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1043
+							'QST_required_text' => __('This field is required', 'event_espresso'),
1044 1044
 							'QST_order'         => 8,
1045 1045
 							'QST_admin_only'    => 0,
1046 1046
 							'QST_wp_user'       => self::get_default_creator_id(),
@@ -1050,15 +1050,15 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 					case 'zip':
1052 1052
 							$QST_values = array(
1053
-									'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ),
1054
-									'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ),
1053
+									'QST_display_text' => __('Zip/Postal Code', 'event_espresso'),
1054
+									'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'),
1055 1055
 									'QST_system' => 'zip',
1056 1056
 									'QST_type' => 'TEXT',
1057 1057
 									'QST_required' => 0,
1058
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1058
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1059 1059
 									'QST_order' => 9,
1060 1060
 									'QST_admin_only' => 0,
1061
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1061
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1062 1062
 									'QST_wp_user' => self::get_default_creator_id(),
1063 1063
 									'QST_deleted' => 0
1064 1064
 								);
@@ -1066,49 +1066,49 @@  discard block
 block discarded – undo
1066 1066
 
1067 1067
 					case 'phone':
1068 1068
 							$QST_values = array(
1069
-									'QST_display_text' => __( 'Phone Number', 'event_espresso' ),
1070
-									'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ),
1069
+									'QST_display_text' => __('Phone Number', 'event_espresso'),
1070
+									'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'),
1071 1071
 									'QST_system' => 'phone',
1072 1072
 									'QST_type' => 'TEXT',
1073 1073
 									'QST_required' => 0,
1074
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1074
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1075 1075
 									'QST_order' => 10,
1076 1076
 									'QST_admin_only' => 0,
1077
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1077
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1078 1078
 									'QST_wp_user' => self::get_default_creator_id(),
1079 1079
 									'QST_deleted' => 0
1080 1080
 								);
1081 1081
 						break;
1082 1082
 
1083 1083
 				}
1084
-				if ( ! empty( $QST_values )) {
1084
+				if ( ! empty($QST_values)) {
1085 1085
 					// insert system question
1086 1086
 					$wpdb->insert(
1087 1087
 						$table_name,
1088 1088
 						$QST_values,
1089
-						array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' )
1089
+						array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d')
1090 1090
 					);
1091 1091
 					$QST_ID = $wpdb->insert_id;
1092 1092
 
1093 1093
 					// QUESTION GROUP QUESTIONS
1094
-					if(  in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) {
1094
+					if (in_array($QST_system, array('fname', 'lname', 'email'))) {
1095 1095
 						$system_question_we_want = EEM_Question_Group::system_personal;
1096 1096
 					} else {
1097 1097
 						$system_question_we_want = EEM_Question_Group::system_address;
1098 1098
 					}
1099
-					if( isset( $QSG_IDs[ $system_question_we_want ] ) ) {
1100
-						$QSG_ID = $QSG_IDs[ $system_question_we_want ];
1099
+					if (isset($QSG_IDs[$system_question_we_want])) {
1100
+						$QSG_ID = $QSG_IDs[$system_question_we_want];
1101 1101
 					} else {
1102
-						$id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) );
1103
-						if( is_array( $id_col ) ) {
1104
-							$QSG_ID = reset( $id_col );
1102
+						$id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want)));
1103
+						if (is_array($id_col)) {
1104
+							$QSG_ID = reset($id_col);
1105 1105
 						} else {
1106 1106
 							//ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method
1107 1107
                                                         EE_Log::instance()->log(
1108 1108
                                                                 __FILE__,
1109 1109
                                                                 __FUNCTION__,
1110 1110
                                                                 sprintf(
1111
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'),
1111
+                                                                        __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'),
1112 1112
                                                                         $QST_ID ),
1113 1113
                                                                 'error' );
1114 1114
                                                         continue;
@@ -1117,12 +1117,12 @@  discard block
 block discarded – undo
1117 1117
 
1118 1118
 					// add system questions to groups
1119 1119
 					$wpdb->insert(
1120
-						\EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix( 'esp_question_group_question' ),
1121
-						array( 'QSG_ID'    => $QSG_ID,
1120
+						\EEH_Activation::getTableAnalysis()->ensureTableNameHasPrefix('esp_question_group_question'),
1121
+						array('QSG_ID'    => $QSG_ID,
1122 1122
 						       'QST_ID'    => $QST_ID,
1123
-						       'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++
1123
+						       'QGQ_order' => ($QSG_ID === 1) ? $order_for_group_1++ : $order_for_group_2++
1124 1124
 						),
1125
-						array( '%d', '%d', '%d' )
1125
+						array('%d', '%d', '%d')
1126 1126
 					);
1127 1127
 				}
1128 1128
 			}
@@ -1138,11 +1138,11 @@  discard block
 block discarded – undo
1138 1138
 	 *
1139 1139
 	 * @throws \EE_Error
1140 1140
 	 */
1141
-	public static function insert_default_payment_methods(){
1142
-		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
1143
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
1144
-			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
1145
-		}else{
1141
+	public static function insert_default_payment_methods() {
1142
+		if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) {
1143
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
1144
+			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
1145
+		} else {
1146 1146
 			EEM_Payment_Method::instance()->verify_button_urls();
1147 1147
 		}
1148 1148
 	}
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 
1159 1159
 		global $wpdb;
1160 1160
 
1161
-		if ( \EEH_Activation::getTableAnalysis()->tableExists( EEM_Status::instance()->table() ) ) {
1161
+		if (\EEH_Activation::getTableAnalysis()->tableExists(EEM_Status::instance()->table())) {
1162 1162
 
1163 1163
 			$table_name = EEM_Status::instance()->table();
1164 1164
 
@@ -1234,33 +1234,33 @@  discard block
 block discarded – undo
1234 1234
 		$folders = array(
1235 1235
 				EVENT_ESPRESSO_TEMPLATE_DIR,
1236 1236
 				EVENT_ESPRESSO_GATEWAY_DIR,
1237
-				EVENT_ESPRESSO_UPLOAD_DIR . 'logs/',
1238
-				EVENT_ESPRESSO_UPLOAD_DIR . 'css/',
1239
-				EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/'
1237
+				EVENT_ESPRESSO_UPLOAD_DIR.'logs/',
1238
+				EVENT_ESPRESSO_UPLOAD_DIR.'css/',
1239
+				EVENT_ESPRESSO_UPLOAD_DIR.'tickets/'
1240 1240
 		);
1241
-		foreach ( $folders as $folder ) {
1241
+		foreach ($folders as $folder) {
1242 1242
 			try {
1243
-				EEH_File::ensure_folder_exists_and_is_writable( $folder );
1244
-				@ chmod( $folder, 0755 );
1245
-			} catch( EE_Error $e ){
1243
+				EEH_File::ensure_folder_exists_and_is_writable($folder);
1244
+				@ chmod($folder, 0755);
1245
+			} catch (EE_Error $e) {
1246 1246
 				EE_Error::add_error(
1247 1247
 					sprintf(
1248
-						__(  'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ),
1248
+						__('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'),
1249 1249
 						$folder,
1250
-						'<br />' . $e->getMessage()
1250
+						'<br />'.$e->getMessage()
1251 1251
 					),
1252 1252
 					__FILE__, __FUNCTION__, __LINE__
1253 1253
 				);
1254 1254
 				//indicate we'll need to fix this later
1255
-				update_option( EEH_Activation::upload_directories_incomplete_option_name, true );
1255
+				update_option(EEH_Activation::upload_directories_incomplete_option_name, true);
1256 1256
 				return FALSE;
1257 1257
 			}
1258 1258
 		}
1259 1259
 		//just add the .htaccess file to the logs directory to begin with. Even if logging
1260 1260
 		//is disabled, there might be activation errors recorded in there
1261
-		EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' );
1261
+		EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/');
1262 1262
 		//remember EE's folders are all good
1263
-		delete_option( EEH_Activation::upload_directories_incomplete_option_name );
1263
+		delete_option(EEH_Activation::upload_directories_incomplete_option_name);
1264 1264
 		return TRUE;
1265 1265
 	}
1266 1266
 
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
 	 * @return boolean
1274 1274
 	 */
1275 1275
 	public static function upload_directories_incomplete() {
1276
-		return get_option( EEH_Activation::upload_directories_incomplete_option_name, false );
1276
+		return get_option(EEH_Activation::upload_directories_incomplete_option_name, false);
1277 1277
 	}
1278 1278
 
1279 1279
 
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
 	 */
1291 1291
 	public static function generate_default_message_templates() {
1292 1292
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
1293
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
1293
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
1294 1294
 		/*
1295 1295
 		 * This first method is taking care of ensuring any default messengers
1296 1296
 		 * that should be made active and have templates generated are done.
@@ -1326,22 +1326,22 @@  discard block
 block discarded – undo
1326 1326
 		$active_messengers = $message_resource_manager->active_messengers();
1327 1327
 		$installed_message_types = $message_resource_manager->installed_message_types();
1328 1328
 		$templates_created = false;
1329
-		foreach ( $active_messengers as $active_messenger ) {
1329
+		foreach ($active_messengers as $active_messenger) {
1330 1330
 			$default_message_type_names_for_messenger = $active_messenger->get_default_message_types();
1331 1331
 			$default_message_type_names_to_activate = array();
1332 1332
 			// looping through each default message type reported by the messenger
1333 1333
 			// and setup the actual message types to activate.
1334
-			foreach ( $default_message_type_names_for_messenger as $default_message_type_name_for_messenger ) {
1334
+			foreach ($default_message_type_names_for_messenger as $default_message_type_name_for_messenger) {
1335 1335
 				// if already active or has already been activated before we skip
1336 1336
 				// (otherwise we might reactivate something user's intentionally deactivated.)
1337 1337
 				// we also skip if the message type is not installed.
1338 1338
 				if (
1339
-					$message_resource_manager->has_message_type_been_activated_for_messenger( $default_message_type_name_for_messenger, $active_messenger->name )
1339
+					$message_resource_manager->has_message_type_been_activated_for_messenger($default_message_type_name_for_messenger, $active_messenger->name)
1340 1340
 					|| $message_resource_manager->is_message_type_active_for_messenger(
1341 1341
 						$active_messenger->name,
1342 1342
 						$default_message_type_name_for_messenger
1343 1343
 					)
1344
-					|| ! isset( $installed_message_types[ $default_message_type_name_for_messenger ] )
1344
+					|| ! isset($installed_message_types[$default_message_type_name_for_messenger])
1345 1345
 				) {
1346 1346
 					continue;
1347 1347
 				}
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
 				false
1355 1355
 			);
1356 1356
 			//activate the templates for these message types
1357
-			if ( ! empty( $default_message_type_names_to_activate ) ) {
1357
+			if ( ! empty($default_message_type_names_to_activate)) {
1358 1358
 				$templates_created = EEH_MSG_Template::generate_new_templates(
1359 1359
 					$active_messenger->name,
1360 1360
 					$default_message_type_names_for_messenger,
@@ -1381,18 +1381,18 @@  discard block
 block discarded – undo
1381 1381
 		EE_Message_Resource_Manager $message_resource_manager
1382 1382
 	) {
1383 1383
 		/** @type EE_messenger[] $messengers_to_generate */
1384
-		$messengers_to_generate = self::_get_default_messengers_to_generate_on_activation( $message_resource_manager );
1384
+		$messengers_to_generate = self::_get_default_messengers_to_generate_on_activation($message_resource_manager);
1385 1385
 		$installed_message_types = $message_resource_manager->installed_message_types();
1386 1386
 		$templates_generated = false;
1387
-		foreach ( $messengers_to_generate as $messenger_to_generate ) {
1387
+		foreach ($messengers_to_generate as $messenger_to_generate) {
1388 1388
 			$default_message_type_names_for_messenger = $messenger_to_generate->get_default_message_types();
1389 1389
 			//verify the default message types match an installed message type.
1390
-			foreach ( $default_message_type_names_for_messenger as $key => $name ) {
1390
+			foreach ($default_message_type_names_for_messenger as $key => $name) {
1391 1391
 				if (
1392
-					! isset( $installed_message_types[ $name ] )
1393
-					|| $message_resource_manager->has_message_type_been_activated_for_messenger( $name, $messenger_to_generate->name )
1392
+					! isset($installed_message_types[$name])
1393
+					|| $message_resource_manager->has_message_type_been_activated_for_messenger($name, $messenger_to_generate->name)
1394 1394
 				) {
1395
-					unset( $default_message_type_names_for_messenger[ $key ] );
1395
+					unset($default_message_type_names_for_messenger[$key]);
1396 1396
 				}
1397 1397
 			}
1398 1398
 			// in previous iterations, the active_messengers option in the db
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
 				false
1407 1407
 			);
1408 1408
 			//create any templates needing created (or will reactivate templates already generated as necessary).
1409
-			if ( ! empty( $default_message_type_names_for_messenger ) ) {
1409
+			if ( ! empty($default_message_type_names_for_messenger)) {
1410 1410
 				$templates_generated = EEH_MSG_Template::generate_new_templates(
1411 1411
 					$messenger_to_generate->name,
1412 1412
 					$default_message_type_names_for_messenger,
@@ -1438,18 +1438,18 @@  discard block
 block discarded – undo
1438 1438
 		$has_activated = $message_resource_manager->get_has_activated_messengers_option();
1439 1439
 
1440 1440
 		$messengers_to_generate = array();
1441
-		foreach ( $installed_messengers as $installed_messenger ) {
1441
+		foreach ($installed_messengers as $installed_messenger) {
1442 1442
 			//if installed messenger is a messenger that should be activated on install
1443 1443
 			//and is not already active
1444 1444
 			//and has never been activated
1445 1445
 			if (
1446 1446
 				! $installed_messenger->activate_on_install
1447
-				|| isset( $active_messengers[ $installed_messenger->name ] )
1448
-				|| isset( $has_activated[ $installed_messenger->name ] )
1447
+				|| isset($active_messengers[$installed_messenger->name])
1448
+				|| isset($has_activated[$installed_messenger->name])
1449 1449
 			) {
1450 1450
 				continue;
1451 1451
 			}
1452
-			$messengers_to_generate[ $installed_messenger->name ] = $installed_messenger;
1452
+			$messengers_to_generate[$installed_messenger->name] = $installed_messenger;
1453 1453
 		}
1454 1454
 		return $messengers_to_generate;
1455 1455
 	}
@@ -1474,9 +1474,9 @@  discard block
 block discarded – undo
1474 1474
 	 */
1475 1475
 	public static function validate_messages_system() {
1476 1476
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
1477
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
1477
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
1478 1478
 		$message_resource_manager->validate_active_message_types_are_installed();
1479
-		do_action( 'AHEE__EEH_Activation__validate_messages_system' );
1479
+		do_action('AHEE__EEH_Activation__validate_messages_system');
1480 1480
 	}
1481 1481
 
1482 1482
 
@@ -1489,12 +1489,12 @@  discard block
 block discarded – undo
1489 1489
 	 * 	@static
1490 1490
 	 * 	@return void
1491 1491
 	 */
1492
-	public static function create_no_ticket_prices_array(){
1492
+	public static function create_no_ticket_prices_array() {
1493 1493
 		// this creates an array for tracking events that have no active ticket prices created
1494 1494
 		// this allows us to warn admins of the situation so that it can be corrected
1495
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE );
1496
-		if ( ! $espresso_no_ticket_prices ) {
1497
-			add_option( 'ee_no_ticket_prices', array(), '', FALSE );
1495
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE);
1496
+		if ( ! $espresso_no_ticket_prices) {
1497
+			add_option('ee_no_ticket_prices', array(), '', FALSE);
1498 1498
 		}
1499 1499
 	}
1500 1500
 
@@ -1519,24 +1519,24 @@  discard block
 block discarded – undo
1519 1519
 	 * @global wpdb $wpdb
1520 1520
 	 * @throws \EE_Error
1521 1521
 	 */
1522
-	public static function delete_all_espresso_cpt_data(){
1522
+	public static function delete_all_espresso_cpt_data() {
1523 1523
 		global $wpdb;
1524 1524
 		//get all the CPT post_types
1525 1525
 		$ee_post_types = array();
1526
-		foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){
1527
-			if ( method_exists( $model_name, 'instance' )) {
1528
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1529
-				if ( $model_obj instanceof EEM_CPT_Base ) {
1530
-					$ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type());
1526
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1527
+			if (method_exists($model_name, 'instance')) {
1528
+				$model_obj = call_user_func(array($model_name, 'instance'));
1529
+				if ($model_obj instanceof EEM_CPT_Base) {
1530
+					$ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type());
1531 1531
 				}
1532 1532
 			}
1533 1533
 		}
1534 1534
 		//get all our CPTs
1535
-		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")";
1535
+		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")";
1536 1536
 		$cpt_ids = $wpdb->get_col($query);
1537 1537
 		//delete each post meta and term relations too
1538
-		foreach($cpt_ids as $post_id){
1539
-			wp_delete_post($post_id,true);
1538
+		foreach ($cpt_ids as $post_id) {
1539
+			wp_delete_post($post_id, true);
1540 1540
 		}
1541 1541
 	}
1542 1542
 
@@ -1548,12 +1548,12 @@  discard block
 block discarded – undo
1548 1548
 	public static function drop_espresso_tables() {
1549 1549
 		$tables = array();
1550 1550
 		// load registry
1551
-		foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){
1552
-			if ( method_exists( $model_name, 'instance' )) {
1553
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1554
-				if ( $model_obj instanceof EEM_Base ) {
1555
-					foreach ( $model_obj->get_tables() as $table ) {
1556
-						if ( strpos( $table->get_table_name(), 'esp_' )
1551
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1552
+			if (method_exists($model_name, 'instance')) {
1553
+				$model_obj = call_user_func(array($model_name, 'instance'));
1554
+				if ($model_obj instanceof EEM_Base) {
1555
+					foreach ($model_obj->get_tables() as $table) {
1556
+						if (strpos($table->get_table_name(), 'esp_')
1557 1557
 							&& 
1558 1558
 							( 
1559 1559
 								is_main_site()//main site? nuke them all
@@ -1576,10 +1576,10 @@  discard block
 block discarded – undo
1576 1576
 			'esp_promotion_rule',
1577 1577
 			'esp_rule'
1578 1578
 		);
1579
-		foreach( $tables_without_models as $table ){
1579
+		foreach ($tables_without_models as $table) {
1580 1580
 			$tables[] = $table;
1581 1581
 		}
1582
-		return \EEH_Activation::getTableManager()->dropTables( $tables );
1582
+		return \EEH_Activation::getTableManager()->dropTables($tables);
1583 1583
 	}
1584 1584
 
1585 1585
 	/**
@@ -1591,8 +1591,8 @@  discard block
 block discarded – undo
1591 1591
 	 * @param array $table_names
1592 1592
 	 * @return array of table names which we deleted
1593 1593
 	 */
1594
-	public static function drop_tables( $table_names ) {
1595
-		return \EEH_Activation::getTableManager()->dropTables( $table_names );
1594
+	public static function drop_tables($table_names) {
1595
+		return \EEH_Activation::getTableManager()->dropTables($table_names);
1596 1596
 	}
1597 1597
 	/**
1598 1598
 	 * plugin_uninstall
@@ -1602,7 +1602,7 @@  discard block
 block discarded – undo
1602 1602
 	 * @param bool $remove_all
1603 1603
 	 * @return void
1604 1604
 	 */
1605
-	public static function delete_all_espresso_tables_and_data( $remove_all = true ) {
1605
+	public static function delete_all_espresso_tables_and_data($remove_all = true) {
1606 1606
 		global $wpdb;
1607 1607
 		self::drop_espresso_tables();
1608 1608
 
@@ -1640,50 +1640,50 @@  discard block
 block discarded – undo
1640 1640
 			'ee_job_parameters_' => false,
1641 1641
 			'ee_upload_directories_incomplete' => true,
1642 1642
 		);
1643
-		if( is_main_site() ) {
1644
-			$wp_options_to_delete[ 'ee_network_config' ] = true;
1643
+		if (is_main_site()) {
1644
+			$wp_options_to_delete['ee_network_config'] = true;
1645 1645
 		}
1646 1646
 
1647 1647
 		$undeleted_options = array();
1648
-		foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) {
1648
+		foreach ($wp_options_to_delete as $option_name => $no_wildcard) {
1649 1649
 
1650
-			if( $no_wildcard ){
1651
-				if( ! delete_option( $option_name ) ){
1650
+			if ($no_wildcard) {
1651
+				if ( ! delete_option($option_name)) {
1652 1652
 					$undeleted_options[] = $option_name;
1653 1653
 				}
1654
-			}else{
1655
-				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1656
-				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1657
-					if( ! delete_option( $option_name_from_wildcard ) ){
1654
+			} else {
1655
+				$option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'");
1656
+				foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) {
1657
+					if ( ! delete_option($option_name_from_wildcard)) {
1658 1658
 						$undeleted_options[] = $option_name_from_wildcard;
1659 1659
 					}
1660 1660
 				}
1661 1661
 			}
1662 1662
 		}
1663 1663
                 //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1664
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1664
+                remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10);
1665 1665
 
1666
-		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1666
+		if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) {
1667 1667
 			$db_update_sans_ee4 = array();
1668
-			foreach($espresso_db_update as $version => $times_activated){
1669
-				if( (string)$version[0] === '3'){//if its NON EE4
1668
+			foreach ($espresso_db_update as $version => $times_activated) {
1669
+				if ((string) $version[0] === '3') {//if its NON EE4
1670 1670
 					$db_update_sans_ee4[$version] = $times_activated;
1671 1671
 				}
1672 1672
 			}
1673
-			update_option( 'espresso_db_update', $db_update_sans_ee4 );
1673
+			update_option('espresso_db_update', $db_update_sans_ee4);
1674 1674
 		}
1675 1675
 
1676 1676
 		$errors = '';
1677
-		if ( ! empty( $undeleted_options )) {
1677
+		if ( ! empty($undeleted_options)) {
1678 1678
 			$errors .= sprintf(
1679
-				__( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ),
1679
+				__('The following wp-options could not be deleted: %s%s', 'event_espresso'),
1680 1680
 				'<br/>',
1681
-				implode( ',<br/>', $undeleted_options )
1681
+				implode(',<br/>', $undeleted_options)
1682 1682
 			);
1683 1683
 
1684 1684
 		}
1685
-		if ( ! empty( $errors ) ) {
1686
-			EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ );
1685
+		if ( ! empty($errors)) {
1686
+			EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__);
1687 1687
 		}
1688 1688
 	}
1689 1689
 
@@ -1693,10 +1693,10 @@  discard block
 block discarded – undo
1693 1693
 	 */
1694 1694
 	public static function last_wpdb_error_code() {
1695 1695
 		global $wpdb;
1696
-		if( $wpdb->use_mysqli ) {
1697
-			return mysqli_errno( $wpdb->dbh );
1696
+		if ($wpdb->use_mysqli) {
1697
+			return mysqli_errno($wpdb->dbh);
1698 1698
 		} else {
1699
-			return mysql_errno( $wpdb->dbh );
1699
+			return mysql_errno($wpdb->dbh);
1700 1700
 		}
1701 1701
 	}
1702 1702
 
@@ -1707,14 +1707,14 @@  discard block
 block discarded – undo
1707 1707
 	 * @param string $table_name with or without $wpdb->prefix
1708 1708
 	 * @return boolean
1709 1709
 	 */
1710
-	public static function table_exists( $table_name ){
1711
-		return \EEH_Activation::getTableAnalysis()->tableExists( $table_name );
1710
+	public static function table_exists($table_name) {
1711
+		return \EEH_Activation::getTableAnalysis()->tableExists($table_name);
1712 1712
 	}
1713 1713
 
1714 1714
 	/**
1715 1715
 	 * Resets the cache on EEH_Activation
1716 1716
 	 */
1717
-	public static function reset(){
1717
+	public static function reset() {
1718 1718
 		self::$_default_creator_id = NULL;
1719 1719
 		self::$_initialized_db_content_already_in_this_request = false;
1720 1720
 	}
Please login to merge, or discard this patch.
core/services/database/TableAnalysis.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 * @param string $table_name
25 25
 	 * @return string $tableName, having ensured it has the wpdb prefix on the front
26 26
 	 */
27
-	public function ensureTableNameHasPrefix( $table_name )
27
+	public function ensureTableNameHasPrefix($table_name)
28 28
 	{
29 29
 		global $wpdb;
30
-		return strpos( $table_name, $wpdb->base_prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name;
30
+		return strpos($table_name, $wpdb->base_prefix) === 0 ? $table_name : $wpdb->prefix.$table_name;
31 31
 	}
32 32
 
33 33
 
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 	 * @param $table_name
37 37
 	 * @return bool
38 38
 	 */
39
-	public function tableIsEmpty( $table_name )
39
+	public function tableIsEmpty($table_name)
40 40
 	{
41 41
 		global $wpdb;
42
-		$table_name = $this->ensureTableNameHasPrefix( $table_name );
43
-		if ( $this->tableExists( $table_name ) ) {
44
-			$count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" );
45
-			return absint( $count ) === 0 ? true : false;
42
+		$table_name = $this->ensureTableNameHasPrefix($table_name);
43
+		if ($this->tableExists($table_name)) {
44
+			$count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name");
45
+			return absint($count) === 0 ? true : false;
46 46
 		}
47 47
 		return false;
48 48
 	}
@@ -53,24 +53,24 @@  discard block
 block discarded – undo
53 53
 	 * @param $table_name
54 54
 	 * @return bool
55 55
 	 */
56
-	public function tableExists( $table_name )
56
+	public function tableExists($table_name)
57 57
 	{
58 58
 		global $wpdb, $EZSQL_ERROR;
59
-		$table_name = $this->ensureTableNameHasPrefix( $table_name );
59
+		$table_name = $this->ensureTableNameHasPrefix($table_name);
60 60
 		//ignore if this causes an sql error
61 61
 		$old_error = $wpdb->last_error;
62 62
 		$old_suppress_errors = $wpdb->suppress_errors();
63
-		$old_show_errors_value = $wpdb->show_errors( FALSE );
63
+		$old_show_errors_value = $wpdb->show_errors(FALSE);
64 64
 		$ezsql_error_cache = $EZSQL_ERROR;
65
-		$wpdb->get_results( "SELECT * from $table_name LIMIT 1");
66
-		$wpdb->show_errors( $old_show_errors_value );
67
-		$wpdb->suppress_errors( $old_suppress_errors );
65
+		$wpdb->get_results("SELECT * from $table_name LIMIT 1");
66
+		$wpdb->show_errors($old_show_errors_value);
67
+		$wpdb->suppress_errors($old_suppress_errors);
68 68
 		$new_error = $wpdb->last_error;
69 69
 		$wpdb->last_error = $old_error;
70 70
 		$EZSQL_ERROR = $ezsql_error_cache;
71 71
 		//if there was a table doesn't exist error
72
-		if( ! empty( $new_error ) ) {
73
-			if(
72
+		if ( ! empty($new_error)) {
73
+			if (
74 74
 				in_array(
75 75
 					\EEH_Activation::last_wpdb_error_code(),
76 76
 					array(
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 					)
81 81
 				)
82 82
 				||
83
-				preg_match( '~^Table .* doesn\'t exist~', $new_error ) //in case not using mysql and error codes aren't reliable, just check for this error string
83
+				preg_match('~^Table .* doesn\'t exist~', $new_error) //in case not using mysql and error codes aren't reliable, just check for this error string
84 84
 			) {
85 85
 				return false;
86 86
 			} else {
87 87
 				//log this because that's weird. Just use the normal PHP error log
88 88
 				error_log(
89 89
 					sprintf(
90
-						__( 'Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso' ),
90
+						__('Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso'),
91 91
 					$new_error
92 92
 					)
93 93
 				);
Please login to merge, or discard this patch.
core/libraries/messages/messenger/EE_Html_messenger.class.php 1 patch
Spacing   +61 added lines, -61 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
 
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 	public function __construct() {
44 44
 		//set properties
45 45
 		$this->name = 'html';
46
-		$this->description = __( 'This messenger outputs a message to a browser for display.', 'event_espresso' );
46
+		$this->description = __('This messenger outputs a message to a browser for display.', 'event_espresso');
47 47
 		$this->label = array(
48
-			'singular' => __( 'html', 'event_espresso' ),
49
-			'plural'   => __( 'html', 'event_espresso' ),
48
+			'singular' => __('html', 'event_espresso'),
49
+			'plural'   => __('html', 'event_espresso'),
50 50
 		);
51 51
 		$this->activate_on_install = true;
52 52
 		// add the "powered by EE" credit link to the HTML receipt and invoice
53 53
 		add_filter(
54 54
 			'FHEE__EE_Html_messenger___send_message__main_body',
55
-			array( $this, 'add_powered_by_credit_link_to_receipt_and_invoice' ),
55
+			array($this, 'add_powered_by_credit_link_to_receipt_and_invoice'),
56 56
 			10,
57 57
 			3
58 58
 		);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @see abstract declaration in EE_messenger for details.
92 92
 	 */
93 93
 	protected function _set_admin_pages() {
94
-		$this->admin_registered_pages = array( 'events_edit' => true );
94
+		$this->admin_registered_pages = array('events_edit' => true);
95 95
 	}
96 96
 
97 97
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	protected function _set_validator_config() {
112 112
 		$this->_validator_config = array(
113 113
 			'subject'                       => array(
114
-				'shortcodes' => array( 'organization', 'primary_registration_details', 'email', 'transaction' ),
114
+				'shortcodes' => array('organization', 'primary_registration_details', 'email', 'transaction'),
115 115
 			),
116 116
 			'content'                       => array(
117 117
 				'shortcodes' => array(
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 					'primary_registration_list',
138 138
 					'event_author',
139 139
 				),
140
-				'required'   => array( '[EVENT_LIST]' ),
140
+				'required'   => array('[EVENT_LIST]'),
141 141
 			),
142 142
 			'ticket_list'                   => array(
143 143
 				'shortcodes' => array(
@@ -148,39 +148,39 @@  discard block
 block discarded – undo
148 148
 					'line_item_list',
149 149
 					'venue',
150 150
 				),
151
-				'required'   => array( '[TICKET_LIST]' ),
151
+				'required'   => array('[TICKET_LIST]'),
152 152
 			),
153 153
 			'ticket_line_item_no_pms'       => array(
154
-				'shortcodes' => array( 'line_item', 'ticket' ),
155
-				'required'   => array( '[TICKET_LINE_ITEM_LIST]' ),
154
+				'shortcodes' => array('line_item', 'ticket'),
155
+				'required'   => array('[TICKET_LINE_ITEM_LIST]'),
156 156
 			),
157 157
 			'ticket_line_item_pms'          => array(
158
-				'shortcodes' => array( 'line_item', 'ticket', 'line_item_list' ),
159
-				'required'   => array( '[TICKET_LINE_ITEM_LIST]' ),
158
+				'shortcodes' => array('line_item', 'ticket', 'line_item_list'),
159
+				'required'   => array('[TICKET_LINE_ITEM_LIST]'),
160 160
 			),
161 161
 			'price_modifier_line_item_list' => array(
162
-				'shortcodes' => array( 'line_item' ),
163
-				'required'   => array( '[PRICE_MODIFIER_LINE_ITEM_LIST]' ),
162
+				'shortcodes' => array('line_item'),
163
+				'required'   => array('[PRICE_MODIFIER_LINE_ITEM_LIST]'),
164 164
 			),
165 165
 			'datetime_list'                 => array(
166
-				'shortcodes' => array( 'datetime' ),
167
-				'required'   => array( '[DATETIME_LIST]' ),
166
+				'shortcodes' => array('datetime'),
167
+				'required'   => array('[DATETIME_LIST]'),
168 168
 			),
169 169
 			'attendee_list'                 => array(
170
-				'shortcodes' => array( 'attendee' ),
171
-				'required'   => array( '[ATTENDEE_LIST]' ),
170
+				'shortcodes' => array('attendee'),
171
+				'required'   => array('[ATTENDEE_LIST]'),
172 172
 			),
173 173
 			'tax_line_item_list'            => array(
174
-				'shortcodes' => array( 'line_item' ),
175
-				'required'   => array( '[TAX_LINE_ITEM_LIST]' ),
174
+				'shortcodes' => array('line_item'),
175
+				'required'   => array('[TAX_LINE_ITEM_LIST]'),
176 176
 			),
177 177
 			'additional_line_item_list'     => array(
178
-				'shortcodes' => array( 'line_item' ),
179
-				'required'   => array( '[ADDITIONAL_LINE_ITEM_LIST]' ),
178
+				'shortcodes' => array('line_item'),
179
+				'required'   => array('[ADDITIONAL_LINE_ITEM_LIST]'),
180 180
 			),
181 181
 			'payment_list'                  => array(
182
-				'shortcodes' => array( 'payment' ),
183
-				'required'   => array( '[PAYMENT_LIST_*]' ),
182
+				'shortcodes' => array('payment'),
183
+				'required'   => array('[PAYMENT_LIST_*]'),
184 184
 			),
185 185
 		);
186 186
 	}
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 	 * @param string $sending_messenger_name the name of the sending messenger so we only set the hooks needed.
197 197
 	 * @return void
198 198
 	 */
199
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
200
-		if ( $sending_messenger_name = 'pdf' ) {
201
-			add_filter( 'EE_messenger__get_variation__variation', array( $this, 'add_html_css' ), 10, 8 );
199
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
200
+		if ($sending_messenger_name = 'pdf') {
201
+			add_filter('EE_messenger__get_variation__variation', array($this, 'add_html_css'), 10, 8);
202 202
 		}
203 203
 	}
204 204
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	public function enqueue_scripts_styles() {
249 249
 		parent::enqueue_scripts_styles();
250
-		do_action( 'AHEE__EE_Html_messenger__enqueue_scripts_styles' );
250
+		do_action('AHEE__EE_Html_messenger__enqueue_scripts_styles');
251 251
 	}
252 252
 
253 253
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		$this->_template_fields = array(
276 276
 			'subject' => array(
277 277
 				'input'      => 'text',
278
-				'label'      => __( 'Page Title', 'event_espresso' ),
278
+				'label'      => __('Page Title', 'event_espresso'),
279 279
 				'type'       => 'string',
280 280
 				'required'   => true,
281 281
 				'validation' => true,
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 				'content' => array(
289 289
 					'main'                          => array(
290 290
 						'input'      => 'wp_editor',
291
-						'label'      => __( 'Main Content', 'event_espresso' ),
291
+						'label'      => __('Main Content', 'event_espresso'),
292 292
 						'type'       => 'string',
293 293
 						'required'   => true,
294 294
 						'validation' => true,
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 						'validation'          => true,
304 304
 						'format'              => '%s',
305 305
 						'rows'                => '15',
306
-						'shortcodes_required' => array( '[EVENT_LIST]' ),
306
+						'shortcodes_required' => array('[EVENT_LIST]'),
307 307
 					),
308 308
 					'ticket_list'                   => array(
309 309
 						'input'               => 'textarea',
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
 						'format'              => '%s',
315 315
 						'css_class'           => 'large-text',
316 316
 						'rows'                => '10',
317
-						'shortcodes_required' => array( '[TICKET_LIST]' ),
317
+						'shortcodes_required' => array('[TICKET_LIST]'),
318 318
 					),
319 319
 					'ticket_line_item_no_pms'       => array(
320 320
 						'input'               => 'textarea',
321
-						'label'               => '[TICKET_LINE_ITEM_LIST] <br>' . __(
321
+						'label'               => '[TICKET_LINE_ITEM_LIST] <br>'.__(
322 322
 								'Ticket Line Item List with no Price Modifiers',
323 323
 								'event_espresso'
324 324
 							),
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
 						'format'              => '%s',
329 329
 						'css_class'           => 'large-text',
330 330
 						'rows'                => '5',
331
-						'shortcodes_required' => array( '[TICKET_LINE_ITEM_LIST]' ),
331
+						'shortcodes_required' => array('[TICKET_LINE_ITEM_LIST]'),
332 332
 					),
333 333
 					'ticket_line_item_pms'          => array(
334 334
 						'input'               => 'textarea',
335
-						'label'               => '[TICKET_LINE_ITEM_LIST] <br>' . __(
335
+						'label'               => '[TICKET_LINE_ITEM_LIST] <br>'.__(
336 336
 								'Ticket Line Item List with Price Modifiers',
337 337
 								'event_espresso'
338 338
 							),
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 						'format'              => '%s',
343 343
 						'css_class'           => 'large-text',
344 344
 						'rows'                => '5',
345
-						'shortcodes_required' => array( '[TICKET_LINE_ITEM_LIST]' ),
345
+						'shortcodes_required' => array('[TICKET_LINE_ITEM_LIST]'),
346 346
 					),
347 347
 					'price_modifier_line_item_list' => array(
348 348
 						'input'               => 'textarea',
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 						'format'              => '%s',
354 354
 						'css_class'           => 'large-text',
355 355
 						'rows'                => '5',
356
-						'shortcodes_required' => array( '[PRICE_MODIFIER_LINE_ITEM_LIST]' ),
356
+						'shortcodes_required' => array('[PRICE_MODIFIER_LINE_ITEM_LIST]'),
357 357
 					),
358 358
 					'datetime_list'                 => array(
359 359
 						'input'               => 'textarea',
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 						'format'              => '%s',
365 365
 						'css_class'           => 'large-text',
366 366
 						'rows'                => '5',
367
-						'shortcodes_required' => array( '[DATETIME_LIST]' ),
367
+						'shortcodes_required' => array('[DATETIME_LIST]'),
368 368
 					),
369 369
 					'attendee_list'                 => array(
370 370
 						'input'               => 'textarea',
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 						'format'              => '%s',
376 376
 						'css_class'           => 'large-text',
377 377
 						'rows'                => '5',
378
-						'shortcodes_required' => array( '[ATTENDEE_LIST]' ),
378
+						'shortcodes_required' => array('[ATTENDEE_LIST]'),
379 379
 					),
380 380
 					'tax_line_item_list'            => array(
381 381
 						'input'               => 'textarea',
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 						'format'              => '%s',
387 387
 						'css_class'           => 'large-text',
388 388
 						'rows'                => '5',
389
-						'shortcodes_required' => array( '[TAX_LINE_ITEM_LIST]' ),
389
+						'shortcodes_required' => array('[TAX_LINE_ITEM_LIST]'),
390 390
 					),
391 391
 					'additional_line_item_list'     => array(
392 392
 						'input'               => 'textarea',
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 						'format'              => '%s',
398 398
 						'css_class'           => 'large-text',
399 399
 						'rows'                => '5',
400
-						'shortcodes_required' => array( '[ADDITIONAL_LINE_ITEM_LIST]' ),
400
+						'shortcodes_required' => array('[ADDITIONAL_LINE_ITEM_LIST]'),
401 401
 					),
402 402
 					'payment_list'                  => array(
403 403
 						'input'               => 'textarea',
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 						'format'              => '%s',
409 409
 						'css_class'           => 'large-text',
410 410
 						'rows'                => '5',
411
-						'shortcodes_required' => array( '[PAYMENT_LIST_*]' ),
411
+						'shortcodes_required' => array('[PAYMENT_LIST_*]'),
412 412
 					),
413 413
 				),
414 414
 			),
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 * @since 4.5.0
423 423
 	 */
424 424
 	protected function _set_default_message_types() {
425
-		$this->_default_message_types = array( 'receipt', 'invoice' );
425
+		$this->_default_message_types = array('receipt', 'invoice');
426 426
 	}
427 427
 
428 428
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	 * @since 4.5.0
433 433
 	 */
434 434
 	protected function _set_valid_message_types() {
435
-		$this->_valid_message_types = array( 'receipt', 'invoice' );
435
+		$this->_valid_message_types = array('receipt', 'invoice');
436 436
 	}
437 437
 
438 438
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	protected function _send_message() {
447 447
 		$this->_template_args = array(
448
-			'page_title' => html_entity_decode( stripslashes( $this->_subject ), ENT_QUOTES, "UTF-8" ),
448
+			'page_title' => html_entity_decode(stripslashes($this->_subject), ENT_QUOTES, "UTF-8"),
449 449
 			'base_css'   => $this->get_variation(
450 450
 				$this->_tmp_pack,
451 451
 				$this->_incoming_message_type->name,
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 			),
484 484
 		);
485 485
 		$this->_deregister_wp_hooks();
486
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) );
486
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles'));
487 487
 		echo $this->_get_main_template();
488 488
 		exit();
489 489
 	}
@@ -499,16 +499,16 @@  discard block
 block discarded – undo
499 499
 	 * @return void
500 500
 	 */
501 501
 	protected function _deregister_wp_hooks() {
502
-		remove_all_actions( 'wp_head' );
503
-		remove_all_actions( 'wp_footer' );
504
-		remove_all_actions( 'wp_print_footer_scripts' );
505
-		remove_all_actions( 'wp_enqueue_scripts' );
502
+		remove_all_actions('wp_head');
503
+		remove_all_actions('wp_footer');
504
+		remove_all_actions('wp_print_footer_scripts');
505
+		remove_all_actions('wp_enqueue_scripts');
506 506
 		global $wp_scripts, $wp_styles;
507 507
 		$wp_scripts = $wp_styles = array();
508 508
 		//just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load.
509
-		add_action( 'wp_footer', 'wp_print_footer_scripts' );
510
-		add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
511
-		add_action( 'wp_head', 'wp_enqueue_scripts' );
509
+		add_action('wp_footer', 'wp_print_footer_scripts');
510
+		add_action('wp_print_footer_scripts', '_wp_footer_scripts');
511
+		add_action('wp_head', 'wp_enqueue_scripts');
512 512
 	}
513 513
 
514 514
 
@@ -520,11 +520,11 @@  discard block
 block discarded – undo
520 520
 	 * @param bool $preview
521 521
 	 * @return string
522 522
 	 */
523
-	protected function _get_main_template( $preview = false ) {
524
-		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, 'main' );
523
+	protected function _get_main_template($preview = false) {
524
+		$wrapper_template = $this->_tmp_pack->get_wrapper($this->name, 'main');
525 525
 		//include message type as a template arg
526 526
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
527
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, true );
527
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, true);
528 528
 	}
529 529
 
530 530
 
@@ -557,10 +557,10 @@  discard block
 block discarded – undo
557 557
 		EE_message_type $incoming_message_type
558 558
 	) {
559 559
 		if (
560
-			( $incoming_message_type->name === 'invoice' || $incoming_message_type->name === 'receipt' )
561
-			&& apply_filters( 'FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', true )
560
+			($incoming_message_type->name === 'invoice' || $incoming_message_type->name === 'receipt')
561
+			&& apply_filters('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', true)
562 562
 		) {
563
-			$content .= \EEH_Template::powered_by_event_espresso( 'aln-cntr' ) . EEH_HTML::div( EEH_HTML::p('&nbsp;') );
563
+			$content .= \EEH_Template::powered_by_event_espresso('aln-cntr').EEH_HTML::div(EEH_HTML::p('&nbsp;'));
564 564
 		}
565 565
 		return $content;
566 566
 	}
Please login to merge, or discard this patch.
modules/gateways/Invoice/lib/invoice_functions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@  discard block
 block discarded – undo
8 8
  * @param $class_file
9 9
  * @return array
10 10
  */
11
-function espresso_invoice_template_files( $class_file) {
11
+function espresso_invoice_template_files($class_file) {
12 12
 	// read our template dir and build an array of files
13
-	$dhandle = opendir(dirname($class_file) . '/lib/templates/css/'); //If the template files have been moved to the uploads folder
13
+	$dhandle = opendir(dirname($class_file).'/lib/templates/css/'); //If the template files have been moved to the uploads folder
14 14
 	//} else return FALSE;
15 15
 
16 16
 	$files = array();
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
  * @param string $selected
51 51
  * @return string
52 52
  */
53
-function espresso_invoice_is_selected( $input_item, $selected='') {
54
-	if ( $input_item === $selected ) {
53
+function espresso_invoice_is_selected($input_item, $selected = '') {
54
+	if ($input_item === $selected) {
55 55
 		return 'selected="selected"';
56 56
 	} else {
57 57
 		return '';
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_9_0.dms.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 //(all other times it gets resurrected from a wordpress option)
12 12
 $stages = glob(EE_CORE.'data_migration_scripts/4_9_0_stages/*');
13 13
 $class_to_filepath = array();
14
-foreach($stages as $filepath){
14
+foreach ($stages as $filepath) {
15 15
 	$matches = array();
16
-	preg_match('~4_9_0_stages/(.*).dmsstage.php~',$filepath,$matches);
16
+	preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches);
17 17
 	$class_to_filepath[$matches[1]] = $filepath;
18 18
 }
19 19
 //give addons a chance to autoload their stages too
20
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages',$class_to_filepath);
20
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath);
21 21
 EEH_Autoloader::register_autoloader($class_to_filepath);
22 22
 
23 23
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  * @since                4.6.0
34 34
  *
35 35
  */
36
-class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base{
36
+class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base {
37 37
 
38 38
 	/**
39 39
 	 * return EE_DMS_Core_4_9_0
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 	 * @param TableManager  $table_manager
42 42
 	 * @param TableAnalysis $table_analysis
43 43
 	 */
44
-	public function __construct( TableManager $table_manager = null, TableAnalysis $table_analysis = null ) {
44
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) {
45 45
 		$this->_pretty_name = __("Data Migration to Event Espresso 4.9.0.P", "event_espresso");
46 46
 		$this->_priority = 10;
47 47
 		$this->_migration_stages = array(
48 48
 			new EE_DMS_4_9_0_Email_System_Question(),
49 49
 			new EE_DMS_4_9_0_Answers_With_No_Registration(),
50 50
 		);
51
-		parent::__construct( $table_manager, $table_analysis );
51
+		parent::__construct($table_manager, $table_analysis);
52 52
 	}
53 53
 
54 54
 
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function can_migrate_from_version($version_array) {
62 62
 		$version_string = $version_array['Core'];
63
-		if( $version_string <= '4.9.0' && $version_string >= '4.8.0' ){
63
+		if ($version_string <= '4.9.0' && $version_string >= '4.8.0') {
64 64
 //			echo "$version_string can be migrated from";
65 65
 			return true;
66
-		} elseif( ! $version_string ){
66
+		} elseif ( ! $version_string) {
67 67
 //			echo "no version string provided: $version_string";
68 68
 			//no version string provided... this must be pre 4.3
69
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
70
-		}else{
69
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
70
+		} else {
71 71
 //			echo "$version_string doesnt apply";
72 72
 			return false;
73 73
 		}
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
 	 * @return bool
89 89
 	 */
90 90
 	public function schema_changes_before_migration() {
91
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
92
-		$now_in_mysql = current_time( 'mysql', true );
91
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
92
+		$now_in_mysql = current_time('mysql', true);
93 93
 
94
-		$table_name='esp_answer';
95
-		$sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
94
+		$table_name = 'esp_answer';
95
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
96 96
 					REG_ID int(10) unsigned NOT NULL,
97 97
 					QST_ID int(10) unsigned NOT NULL,
98 98
 					ANS_value text NOT NULL,
99 99
 					PRIMARY KEY  (ANS_ID),
100 100
 					KEY REG_ID (REG_ID),
101 101
 					KEY QST_ID (QST_ID)";
102
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
102
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
103 103
 
104 104
 		$table_name = 'esp_attendee_meta';
105 105
 		$sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				KEY ATT_fname (ATT_fname)";
122 122
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
123 123
 
124
-		$table_name='esp_checkin';
124
+		$table_name = 'esp_checkin';
125 125
 		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
126 126
 				REG_ID int(10) unsigned NOT NULL,
127 127
 				DTT_ID int(10) unsigned NOT NULL,
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 				CNT_is_EU tinyint(1) DEFAULT '0',
150 150
 				CNT_active tinyint(1) DEFAULT '0',
151 151
 				PRIMARY KEY  (CNT_ISO)";
152
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
152
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
153 153
 
154 154
 		$table_name = 'esp_currency';
155 155
 		$sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 				CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2',
160 160
 				CUR_active tinyint(1) DEFAULT '0',
161 161
 				PRIMARY KEY  (CUR_code)";
162
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
162
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
163 163
 
164 164
 
165 165
 		$table_name = 'esp_currency_payment_method';
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				KEY DTT_EVT_start (DTT_EVT_start),
188 188
 				KEY EVT_ID (EVT_ID),
189 189
 				KEY DTT_is_primary (DTT_is_primary)";
190
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
190
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
191 191
 
192 192
 		$table_name = "esp_datetime_ticket";
193 193
 		$sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 				PRIMARY KEY  (EMT_ID),
206 206
 				KEY EVT_ID (EVT_ID),
207 207
 				KEY GRP_ID (GRP_ID)";
208
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
208
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209 209
 
210 210
 		$table_name = 'esp_event_meta';
211 211
 		$sql = "EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 				EVT_donations tinyint(1) NULL,
224 224
 				PRIMARY KEY  (EVTM_ID),
225 225
 				KEY EVT_ID (EVT_ID)";
226
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
226
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
227 227
 
228
-		$table_name='esp_event_question_group';
228
+		$table_name = 'esp_event_question_group';
229 229
 		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
230 230
 				EVT_ID bigint(20) unsigned NOT NULL,
231 231
 				QSG_ID int(10) unsigned NOT NULL,
@@ -233,17 +233,17 @@  discard block
 block discarded – undo
233 233
 				PRIMARY KEY  (EQG_ID),
234 234
 				KEY EVT_ID (EVT_ID),
235 235
 				KEY QSG_ID (QSG_ID)";
236
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
236
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
237 237
 
238
-		$table_name='esp_event_venue';
238
+		$table_name = 'esp_event_venue';
239 239
 		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
240 240
 				EVT_ID bigint(20) unsigned NOT NULL,
241 241
 				VNU_ID bigint(20) unsigned NOT NULL,
242 242
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
243 243
 				PRIMARY KEY  (EVV_ID)";
244
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
244
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
245 245
 
246
-		$table_name='esp_extra_meta';
246
+		$table_name = 'esp_extra_meta';
247 247
 		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
248 248
 				OBJ_ID int(11) DEFAULT NULL,
249 249
 				EXM_type varchar(45) DEFAULT NULL,
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 				EXM_value text,
252 252
 				PRIMARY KEY  (EXM_ID),
253 253
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
254
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
254
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
255 255
 
256 256
 		$table_name = 'esp_extra_join';
257 257
 		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
265 265
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
266 266
 
267
-		$table_name='esp_line_item';
267
+		$table_name = 'esp_line_item';
268 268
 		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
269 269
 				LIN_code varchar(245) NOT NULL DEFAULT '',
270 270
 				TXN_ID int(11) DEFAULT NULL,
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 				PRIMARY KEY  (LIN_ID),
285 285
 				KEY LIN_code (LIN_code(191)),
286 286
 				KEY TXN_ID (TXN_ID)";
287
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB' );
287
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
288 288
 
289 289
 		$table_name = 'esp_log';
290 290
 		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 				KEY STS_ID (STS_ID),
334 334
 				KEY MSG_created (MSG_created),
335 335
 				KEY MSG_modified (MSG_modified)";
336
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
336
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
337 337
 
338 338
 		$table_name = 'esp_message_template';
339 339
 		$sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 				MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
359 359
 				PRIMARY KEY  (GRP_ID),
360 360
 				KEY MTP_user_id (MTP_user_id)";
361
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
361
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
362 362
 
363 363
 		$table_name = 'esp_payment';
364 364
 		$sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 				PRIMARY KEY  (TTM_ID)";
417 417
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
418 418
 
419
-		$table_name='esp_question';
419
+		$table_name = 'esp_question';
420 420
 		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
421 421
 				QST_display_text text NOT NULL,
422 422
 				QST_admin_label varchar(255) NOT NULL,
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
 				QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
432 432
 				PRIMARY KEY  (QST_ID),
433 433
 				KEY QST_order (QST_order)';
434
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
434
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
435 435
 
436
-		$table_name='esp_question_group_question';
436
+		$table_name = 'esp_question_group_question';
437 437
 		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
438 438
 				QSG_ID int(10) unsigned NOT NULL,
439 439
 				QST_ID int(10) unsigned NOT NULL,
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 				PRIMARY KEY  (QGQ_ID),
442 442
 				KEY QST_ID (QST_ID),
443 443
 				KEY QSG_ID_order (QSG_ID,QGQ_order)";
444
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
444
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
445 445
 
446
-		$table_name='esp_question_option';
446
+		$table_name = 'esp_question_option';
447 447
 		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
448 448
 				QSO_value varchar(255) NOT NULL,
449 449
 				QSO_desc text NOT NULL,
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 				PRIMARY KEY  (QSO_ID),
455 455
 				KEY QST_ID (QST_ID),
456 456
 				KEY QSO_order (QSO_order)";
457
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
457
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
458 458
 
459 459
 		$table_name = 'esp_registration';
460 460
 		$sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 				PRC_parent int(10) unsigned DEFAULT 0,
568 568
 				PRIMARY KEY  (PRC_ID),
569 569
 				KEY PRT_ID (PRT_ID)";
570
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
570
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
571 571
 
572 572
 		$table_name = "esp_price_type";
573 573
 		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 				TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
605 605
 				PRIMARY KEY  (TKT_ID),
606 606
 				KEY TKT_start_date (TKT_start_date)";
607
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
607
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
608 608
 
609 609
 		$table_name = 'esp_question_group';
610 610
 		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 				PRIMARY KEY  (QSG_ID),
621 621
 				UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
622 622
 				KEY QSG_order (QSG_order)';
623
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
623
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
624 624
 
625 625
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
626 626
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -654,5 +654,5 @@  discard block
 block discarded – undo
654 654
 		return true;
655 655
 	}
656 656
 
657
-	public function migration_page_hooks(){}
657
+	public function migration_page_hooks() {}
658 658
 }
659 659
\ No newline at end of file
Please login to merge, or discard this patch.