Completed
Branch FET-9998-unit-test-bootstrappi... (db3cac)
by
unknown
108:00 queued 97:50
created
core/db_classes/EE_Transaction.class.php 3 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -742,11 +742,11 @@
 block discarded – undo
742 742
 		$pm = $this->get_first_related('Payment_Method');
743 743
 		if( $pm instanceof EE_Payment_Method ){
744 744
 			return $pm;
745
-		}else{
745
+		} else{
746 746
 			$last_payment = $this->last_payment();
747 747
 			if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){
748 748
 				return $last_payment->payment_method();
749
-			}else{
749
+			} else{
750 750
 				return NULL;
751 751
 			}
752 752
 		}
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * Gets all the attendees for this transaction (handy for use with EE_Attendee's get_registrations_for_event function
413 413
 	 * for getting attendees and how many registrations they each have for an event)
414 414
 	 *
415
-	 * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT'
415
+	 * @return EE_Base_Class[] EE_Attendee[] by default, int if $output is set to 'COUNT'
416 416
 	 * @throws \EE_Error
417 417
 	 */
418 418
 	public function attendees() {
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 * Gets all the extra meta info on this payment
694 694
 	 *
695 695
 	 * @param array $query_params like EEM_Base::get_all
696
-	 * @return EE_Extra_Meta
696
+	 * @return EE_Base_Class[]
697 697
 	 * @throws \EE_Error
698 698
 	 */
699 699
 	public function extra_meta( $query_params = array() ) {
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 	 * Sets PMD_ID
871 871
 	 *
872 872
 	 * @param int $PMD_ID
873
-	 * @return boolean
873
+	 * @return boolean|null
874 874
 	 * @throws \EE_Error
875 875
 	 */
876 876
 	public function set_payment_method_ID($PMD_ID) {
Please login to merge, or discard this patch.
Spacing   +106 added lines, -106 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
  * EE_Transaction class
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 	 * @return EE_Transaction
26 26
 	 * @throws \EE_Error
27 27
 	 */
28
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
29
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
28
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
29
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
30 30
 		return $has_object
31 31
 			? $has_object
32
-			: new self( $props_n_values, false, $timezone, $date_formats );
32
+			: new self($props_n_values, false, $timezone, $date_formats);
33 33
 	}
34 34
 
35 35
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 * @return EE_Transaction
42 42
 	 * @throws \EE_Error
43 43
 	 */
44
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
45
-		return new self( $props_n_values, TRUE, $timezone );
44
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
45
+		return new self($props_n_values, TRUE, $timezone);
46 46
 	}
47 47
 
48 48
 
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function lock() {
60 60
 		// attempt to set lock, but if that fails...
61
-		if ( ! $this->add_extra_meta( 'lock', time(), true )  ) {
61
+		if ( ! $this->add_extra_meta('lock', time(), true)) {
62 62
 			// then attempt to remove the lock in case it is expired
63
-			if ( $this->_remove_expired_lock() ) {
63
+			if ($this->_remove_expired_lock()) {
64 64
 				// if removal was successful, then try setting lock again
65 65
 				$this->lock();
66 66
 			} else {
67 67
 				// but if the lock can not be removed, then throw an exception
68 68
 				throw new EE_Error(
69 69
 					sprintf(
70
-						__( 'Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso' ),
70
+						__('Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso'),
71 71
 						$this->ID()
72 72
 					)
73 73
 				);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @throws \EE_Error
87 87
 	 */
88 88
 	public function unlock() {
89
-		return $this->delete_extra_meta( 'lock' );
89
+		return $this->delete_extra_meta('lock');
90 90
 	}
91 91
 
92 92
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function is_locked() {
109 109
 		// if TXN is not locked, then return false immediately
110
-		if ( ! $this->_get_lock() ) {
110
+		if ( ! $this->_get_lock()) {
111 111
 			return false;
112 112
 		}
113 113
 		// if not, then let's try and remove the lock in case it's expired...
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @throws \EE_Error
129 129
 	 */
130 130
 	protected function _get_lock() {
131
-		return (int)$this->get_extra_meta( 'lock', true, 0 );
131
+		return (int) $this->get_extra_meta('lock', true, 0);
132 132
 	}
133 133
 
134 134
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	protected function _remove_expired_lock() {
145 145
 		$locked = $this->_get_lock();
146
-		if ( $locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked ) {
146
+		if ($locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked) {
147 147
 			return $this->unlock();
148 148
 		}
149 149
 		return 0;
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * @param        float $total total value of transaction
159 159
 	 * @throws \EE_Error
160 160
 	 */
161
-	public function set_total( $total = 0.00 ) {
162
-		$this->set( 'TXN_total', (float)$total );
161
+	public function set_total($total = 0.00) {
162
+		$this->set('TXN_total', (float) $total);
163 163
 	}
164 164
 
165 165
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @param        float $total_paid total amount paid to date (sum of all payments)
172 172
 	 * @throws \EE_Error
173 173
 	 */
174
-	public function set_paid( $total_paid = 0.00 ) {
175
-		$this->set( 'TXN_paid', (float)$total_paid );
174
+	public function set_paid($total_paid = 0.00) {
175
+		$this->set('TXN_paid', (float) $total_paid);
176 176
 	}
177 177
 
178 178
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 	 * @param        string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set
185 185
 	 * @throws \EE_Error
186 186
 	 */
187
-	public function set_status( $status = '' ) {
188
-		$this->set( 'STS_ID', $status );
187
+	public function set_status($status = '') {
188
+		$this->set('STS_ID', $status);
189 189
 	}
190 190
 
191 191
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 	 * @param        string $hash_salt required for some payment gateways
198 198
 	 * @throws \EE_Error
199 199
 	 */
200
-	public function set_hash_salt( $hash_salt = '' ) {
201
-		$this->set( 'TXN_hash_salt', $hash_salt );
200
+	public function set_hash_salt($hash_salt = '') {
201
+		$this->set('TXN_hash_salt', $hash_salt);
202 202
 	}
203 203
 
204 204
 
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 	 * @param array $txn_reg_steps
210 210
 	 * @throws \EE_Error
211 211
 	 */
212
-	public function set_reg_steps( array $txn_reg_steps ) {
213
-		$this->set( 'TXN_reg_steps', $txn_reg_steps );
212
+	public function set_reg_steps(array $txn_reg_steps) {
213
+		$this->set('TXN_reg_steps', $txn_reg_steps);
214 214
 	}
215 215
 
216 216
 
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 	 * @throws \EE_Error
223 223
 	 */
224 224
 	public function reg_steps() {
225
-		$TXN_reg_steps = $this->get( 'TXN_reg_steps' );
226
-		return is_array( $TXN_reg_steps ) ? (array)$TXN_reg_steps : array();
225
+		$TXN_reg_steps = $this->get('TXN_reg_steps');
226
+		return is_array($TXN_reg_steps) ? (array) $TXN_reg_steps : array();
227 227
 	}
228 228
 
229 229
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 * @throws \EE_Error
234 234
 	 */
235 235
 	public function pretty_total() {
236
-		return $this->get_pretty( 'TXN_total' );
236
+		return $this->get_pretty('TXN_total');
237 237
 	}
238 238
 
239 239
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @throws \EE_Error
246 246
 	 */
247 247
 	public function pretty_paid() {
248
-		return $this->get_pretty( 'TXN_paid' );
248
+		return $this->get_pretty('TXN_paid');
249 249
 	}
250 250
 
251 251
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 * @throws \EE_Error
259 259
 	 */
260 260
 	public function remaining() {
261
-		return (float)( $this->total() - $this->paid() );
261
+		return (float) ($this->total() - $this->paid());
262 262
 	}
263 263
 
264 264
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @throws \EE_Error
272 272
 	 */
273 273
 	public function total() {
274
-		return (float)$this->get( 'TXN_total' );
274
+		return (float) $this->get('TXN_total');
275 275
 	}
276 276
 
277 277
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 * @throws \EE_Error
285 285
 	 */
286 286
 	public function paid() {
287
-		return (float)$this->get( 'TXN_paid' );
287
+		return (float) $this->get('TXN_paid');
288 288
 	}
289 289
 
290 290
 
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
 	 * @throws \EE_Error
297 297
 	 */
298 298
 	public function get_cart_session() {
299
-		$session_data = (array)$this->get( 'TXN_session_data' );
300
-		return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart
301
-			? $session_data[ 'cart' ]
299
+		$session_data = (array) $this->get('TXN_session_data');
300
+		return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart
301
+			? $session_data['cart']
302 302
 			: null;
303 303
 	}
304 304
 
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
 	 * @throws \EE_Error
312 312
 	 */
313 313
 	public function session_data() {
314
-		$session_data = $this->get( 'TXN_session_data' );
315
-		if ( empty( $session_data ) ) {
314
+		$session_data = $this->get('TXN_session_data');
315
+		if (empty($session_data)) {
316 316
 			$session_data = array(
317 317
 				'id'            => null,
318 318
 				'user_id'       => null,
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 	 * @param        EE_Session|array $session_data
336 336
 	 * @throws \EE_Error
337 337
 	 */
338
-	public function set_txn_session_data( $session_data ) {
339
-		if ( $session_data instanceof EE_Session ) {
340
-			$this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE ));
338
+	public function set_txn_session_data($session_data) {
339
+		if ($session_data instanceof EE_Session) {
340
+			$this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE));
341 341
 		} else {
342
-			$this->set( 'TXN_session_data', $session_data );
342
+			$this->set('TXN_session_data', $session_data);
343 343
 		}
344 344
 	}
345 345
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 * @throws \EE_Error
353 353
 	 */
354 354
 	public function hash_salt_() {
355
-		return $this->get( 'TXN_hash_salt' );
355
+		return $this->get('TXN_hash_salt');
356 356
 	}
357 357
 
358 358
 
@@ -372,13 +372,13 @@  discard block
 block discarded – undo
372 372
 	 * @return    string | int
373 373
 	 * @throws \EE_Error
374 374
 	 */
375
-	public function datetime( $format = FALSE, $gmt = FALSE ) {
376
-		if ( $format ) {
377
-			return $this->get_pretty( 'TXN_timestamp' );
378
-		} else if ( $gmt ) {
379
-			return $this->get_raw( 'TXN_timestamp' );
375
+	public function datetime($format = FALSE, $gmt = FALSE) {
376
+		if ($format) {
377
+			return $this->get_pretty('TXN_timestamp');
378
+		} else if ($gmt) {
379
+			return $this->get_raw('TXN_timestamp');
380 380
 		} else {
381
-			return $this->get( 'TXN_timestamp' );
381
+			return $this->get('TXN_timestamp');
382 382
 		}
383 383
 	}
384 384
 
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 	 * @return EE_Registration[]
393 393
 	 * @throws \EE_Error
394 394
 	 */
395
-	public function registrations( $query_params = array(), $get_cached = FALSE ) {
396
-		$query_params = ( empty( $query_params ) || ! is_array( $query_params ) )
395
+	public function registrations($query_params = array(), $get_cached = FALSE) {
396
+		$query_params = (empty($query_params) || ! is_array($query_params))
397 397
 			? array(
398 398
 				'order_by' => array(
399 399
 					'Event.EVT_name' => 'ASC',
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 			)
404 404
 			: $query_params;
405 405
 		$query_params = $get_cached ? array() : $query_params;
406
-		return $this->get_many_related( 'Registration', $query_params );
406
+		return $this->get_many_related('Registration', $query_params);
407 407
 	}
408 408
 
409 409
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 * @throws \EE_Error
417 417
 	 */
418 418
 	public function attendees() {
419
-		return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) );
419
+		return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID())));
420 420
 	}
421 421
 
422 422
 
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 	 * @return EE_Payment[]
429 429
 	 * @throws \EE_Error
430 430
 	 */
431
-	public function payments( $query_params = array() ) {
432
-		return $this->get_many_related( 'Payment', $query_params );
431
+	public function payments($query_params = array()) {
432
+		return $this->get_many_related('Payment', $query_params);
433 433
 	}
434 434
 
435 435
 
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 	 * @throws \EE_Error
442 442
 	 */
443 443
 	public function approved_payments() {
444
-		EE_Registry::instance()->load_model( 'Payment' );
445
-		return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) );
444
+		EE_Registry::instance()->load_model('Payment');
445
+		return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC')));
446 446
 	}
447 447
 
448 448
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 * @return string
455 455
 	 * @throws \EE_Error
456 456
 	 */
457
-	public function e_pretty_status( $show_icons = FALSE ) {
458
-		echo $this->pretty_status( $show_icons );
457
+	public function e_pretty_status($show_icons = FALSE) {
458
+		echo $this->pretty_status($show_icons);
459 459
 	}
460 460
 
461 461
 
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
 	 * @return string
468 468
 	 * @throws \EE_Error
469 469
 	 */
470
-	public function pretty_status( $show_icons = FALSE ) {
471
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
470
+	public function pretty_status($show_icons = FALSE) {
471
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
472 472
 		$icon = '';
473
-		switch ( $this->status_ID() ) {
473
+		switch ($this->status_ID()) {
474 474
 			case EEM_Transaction::complete_status_code:
475 475
 				$icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : '';
476 476
 				break;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 				$icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : '';
488 488
 				break;
489 489
 		}
490
-		return $icon . $status[ $this->status_ID() ];
490
+		return $icon.$status[$this->status_ID()];
491 491
 	}
492 492
 
493 493
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	 * @throws \EE_Error
500 500
 	 */
501 501
 	public function status_ID() {
502
-		return $this->get( 'STS_ID' );
502
+		return $this->get('STS_ID');
503 503
 	}
504 504
 
505 505
 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	 * @throws \EE_Error
512 512
 	 */
513 513
 	public function is_free() {
514
-		return EEH_Money::compare_floats( $this->get( 'TXN_total' ), 0, '==' );
514
+		return EEH_Money::compare_floats($this->get('TXN_total'), 0, '==');
515 515
 	}
516 516
 
517 517
 
@@ -591,12 +591,12 @@  discard block
 block discarded – undo
591 591
 	 * @return string
592 592
 	 * @throws \EE_Error
593 593
 	 */
594
-	public function invoice_url( $type = 'html' ) {
594
+	public function invoice_url($type = 'html') {
595 595
 		$REG = $this->primary_registration();
596
-		if ( ! $REG instanceof EE_Registration ) {
596
+		if ( ! $REG instanceof EE_Registration) {
597 597
 			return '';
598 598
 		}
599
-		return $REG->invoice_url( $type );
599
+		return $REG->invoice_url($type);
600 600
 	}
601 601
 
602 602
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 * @throws \EE_Error
609 609
 	 */
610 610
 	public function primary_registration() {
611
-		return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) );
611
+		return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
612 612
 	}
613 613
 
614 614
 
@@ -620,12 +620,12 @@  discard block
 block discarded – undo
620 620
 	 * @return string
621 621
 	 * @throws \EE_Error
622 622
 	 */
623
-	public function receipt_url( $type = 'html' ) {
623
+	public function receipt_url($type = 'html') {
624 624
 		$REG = $this->primary_registration();
625
-		if ( ! $REG instanceof EE_Registration ) {
625
+		if ( ! $REG instanceof EE_Registration) {
626 626
 			return '';
627 627
 		}
628
-		return $REG->receipt_url( $type );
628
+		return $REG->receipt_url($type);
629 629
 	}
630 630
 
631 631
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 * @throws \EE_Error
651 651
 	 */
652 652
 	public function gateway_response_on_transaction() {
653
-		$payment = $this->get_first_related( 'Payment' );
653
+		$payment = $this->get_first_related('Payment');
654 654
 		return $payment instanceof EE_Payment ? $payment->gateway_response() : '';
655 655
 	}
656 656
 
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 * @throws \EE_Error
664 664
 	 */
665 665
 	public function status_obj() {
666
-		return $this->get_first_related( 'Status' );
666
+		return $this->get_first_related('Status');
667 667
 	}
668 668
 
669 669
 
@@ -675,8 +675,8 @@  discard block
 block discarded – undo
675 675
 	 * @return EE_Extra_Meta
676 676
 	 * @throws \EE_Error
677 677
 	 */
678
-	public function extra_meta( $query_params = array() ) {
679
-		return $this->get_many_related( 'Extra_Meta', $query_params );
678
+	public function extra_meta($query_params = array()) {
679
+		return $this->get_many_related('Extra_Meta', $query_params);
680 680
 	}
681 681
 
682 682
 
@@ -688,8 +688,8 @@  discard block
 block discarded – undo
688 688
 	 * @return EE_Base_Class the relation was added to
689 689
 	 * @throws \EE_Error
690 690
 	 */
691
-	public function add_registration( EE_Registration $registration ) {
692
-		return $this->_add_relation_to( $registration, 'Registration' );
691
+	public function add_registration(EE_Registration $registration) {
692
+		return $this->_add_relation_to($registration, 'Registration');
693 693
 	}
694 694
 
695 695
 
@@ -702,8 +702,8 @@  discard block
 block discarded – undo
702 702
 	 * @return EE_Base_Class that was removed from being related
703 703
 	 * @throws \EE_Error
704 704
 	 */
705
-	public function remove_registration_with_id( $registration_or_id ) {
706
-		return $this->_remove_relation_to( $registration_or_id, 'Registration' );
705
+	public function remove_registration_with_id($registration_or_id) {
706
+		return $this->_remove_relation_to($registration_or_id, 'Registration');
707 707
 	}
708 708
 
709 709
 
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 	 * @throws \EE_Error
716 716
 	 */
717 717
 	public function items_purchased() {
718
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) );
718
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item)));
719 719
 	}
720 720
 
721 721
 
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
 	 * @return EE_Base_Class the relation was added to
728 728
 	 * @throws \EE_Error
729 729
 	 */
730
-	public function add_line_item( EE_Line_Item $line_item ) {
731
-		return $this->_add_relation_to( $line_item, 'Line_Item' );
730
+	public function add_line_item(EE_Line_Item $line_item) {
731
+		return $this->_add_relation_to($line_item, 'Line_Item');
732 732
 	}
733 733
 
734 734
 
@@ -740,8 +740,8 @@  discard block
 block discarded – undo
740 740
 	 * @return EE_Line_Item[]
741 741
 	 * @throws \EE_Error
742 742
 	 */
743
-	public function line_items( $query_params = array() ) {
744
-		return $this->get_many_related( 'Line_Item', $query_params );
743
+	public function line_items($query_params = array()) {
744
+		return $this->get_many_related('Line_Item', $query_params);
745 745
 	}
746 746
 
747 747
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 	 * @throws \EE_Error
754 754
 	 */
755 755
 	public function tax_items() {
756
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) );
756
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax)));
757 757
 	}
758 758
 
759 759
 
@@ -766,9 +766,9 @@  discard block
 block discarded – undo
766 766
 	 * @throws \EE_Error
767 767
 	 */
768 768
 	public function total_line_item() {
769
-		$item =  $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) );
770
-		if( ! $item ){
771
-			$item = EEH_Line_Item::create_total_line_item( $this );
769
+		$item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total)));
770
+		if ( ! $item) {
771
+			$item = EEH_Line_Item::create_total_line_item($this);
772 772
 		}
773 773
 		return $item;
774 774
 	}
@@ -784,10 +784,10 @@  discard block
 block discarded – undo
784 784
 	 */
785 785
 	public function tax_total() {
786 786
 		$tax_line_item = $this->tax_total_line_item();
787
-		if ( $tax_line_item ) {
788
-			return (float)$tax_line_item->total();
787
+		if ($tax_line_item) {
788
+			return (float) $tax_line_item->total();
789 789
 		} else {
790
-			return (float)0;
790
+			return (float) 0;
791 791
 		}
792 792
 	}
793 793
 
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 	 * @throws \EE_Error
801 801
 	 */
802 802
 	public function tax_total_line_item() {
803
-		return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() );
803
+		return EEH_Line_Item::get_taxes_subtotal($this->total_line_item());
804 804
 	}
805 805
 
806 806
 
@@ -811,20 +811,20 @@  discard block
 block discarded – undo
811 811
 	 * @return EE_Form_Section_Proper
812 812
 	 * @throws \EE_Error
813 813
 	 */
814
-	public function billing_info(){
814
+	public function billing_info() {
815 815
 		$payment_method = $this->payment_method();
816
-		if ( !$payment_method){
816
+		if ( ! $payment_method) {
817 817
 			EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
818 818
 			return false;
819 819
 		}
820 820
 		$primary_reg = $this->primary_registration();
821
-		if ( ! $primary_reg ) {
822
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
821
+		if ( ! $primary_reg) {
822
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
823 823
 			return FALSE;
824 824
 		}
825 825
 		$attendee = $primary_reg->attendee();
826
-		if ( ! $attendee ) {
827
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
826
+		if ( ! $attendee) {
827
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
828 828
 			return FALSE;
829 829
 		}
830 830
 		return $attendee->billing_info_for_payment_method($payment_method);
@@ -865,15 +865,15 @@  discard block
 block discarded – undo
865 865
 	 * @return EE_Payment_Method
866 866
 	 * @throws \EE_Error
867 867
 	 */
868
-	public function payment_method(){
868
+	public function payment_method() {
869 869
 		$pm = $this->get_first_related('Payment_Method');
870
-		if( $pm instanceof EE_Payment_Method ){
870
+		if ($pm instanceof EE_Payment_Method) {
871 871
 			return $pm;
872
-		}else{
872
+		} else {
873 873
 			$last_payment = $this->last_payment();
874
-			if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){
874
+			if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) {
875 875
 				return $last_payment->payment_method();
876
-			}else{
876
+			} else {
877 877
 				return NULL;
878 878
 			}
879 879
 		}
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 	 * @throws \EE_Error
889 889
 	 */
890 890
 	public function last_payment() {
891
-		return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) );
891
+		return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc')));
892 892
 	}
893 893
 
894 894
 
@@ -899,8 +899,8 @@  discard block
 block discarded – undo
899 899
 	 * @return EE_Line_Item[]
900 900
 	 * @throws \EE_Error
901 901
 	 */
902
-	public function non_ticket_line_items(){
903
-		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() );
902
+	public function non_ticket_line_items() {
903
+		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID());
904 904
 	}
905 905
 
906 906
 
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
 	public function update_based_on_payments()
949 949
 	{
950 950
 		EE_Error::doing_it_wrong(
951
-			__CLASS__ . '::' . __FUNCTION__,
951
+			__CLASS__.'::'.__FUNCTION__,
952 952
 			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
953 953
 				'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
954 954
 			'4.6.0'
Please login to merge, or discard this patch.
core/db_models/EEM_Attendee.model.php 4 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 
106 106
 
107 107
 	/**
108
-	*		retrieve  a single attendee from db via their ID
109
-	*
110
-	* 		@access		public
111
-	* 		@param		$ATT_ID
112
-	*		@return 		mixed		array on success, FALSE on fail
108
+	 *		retrieve  a single attendee from db via their ID
109
+	 *
110
+	 * 		@access		public
111
+	 * 		@param		$ATT_ID
112
+	 *		@return 		mixed		array on success, FALSE on fail
113 113
 	 * 		@deprecated
114
-	*/
114
+	 */
115 115
 	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
116 116
 		// retrieve a particular EE_Attendee
117 117
 		return $this->get_one_by_ID( $ATT_ID );
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 
122 122
 
123 123
 	/**
124
-	*		retrieve  a single attendee from db via their ID
125
-	*
126
-	* 		@access		public
127
-	* 		@param		array $where_cols_n_values
128
-	*		@return 		mixed		array on success, FALSE on fail
129
-	*/
124
+	 *		retrieve  a single attendee from db via their ID
125
+	 *
126
+	 * 		@access		public
127
+	 * 		@param		array $where_cols_n_values
128
+	 *		@return 		mixed		array on success, FALSE on fail
129
+	 */
130 130
 	public function get_attendee( $where_cols_n_values = array() ) {
131 131
 
132 132
 		if ( empty( $where_cols_n_values )) {
@@ -174,20 +174,20 @@  discard block
 block discarded – undo
174 174
 
175 175
 
176 176
 	/**
177
-             * Takes an incoming array of EE_Registration ids and sends back a list of corresponding non duplicate
178
-             * EE_Attendee objects.
179
-             *
180
-             * @since    4.3.0
181
-             * @param  array $ids array of EE_Registration ids
182
-             * @return  EE_Attendee[]
183
-             */
184
-            public function get_array_of_contacts_from_reg_ids( $ids ) {
185
-                $ids = (array) $ids;
186
-                $_where = array(
187
-                    'Registration.REG_ID' => array( 'in', $ids )
188
-                    );
189
-                return $this->get_all( array( $_where ) );
190
-            }
177
+	 * Takes an incoming array of EE_Registration ids and sends back a list of corresponding non duplicate
178
+	 * EE_Attendee objects.
179
+	 *
180
+	 * @since    4.3.0
181
+	 * @param  array $ids array of EE_Registration ids
182
+	 * @return  EE_Attendee[]
183
+	 */
184
+			public function get_array_of_contacts_from_reg_ids( $ids ) {
185
+				$ids = (array) $ids;
186
+				$_where = array(
187
+					'Registration.REG_ID' => array( 'in', $ids )
188
+					);
189
+				return $this->get_all( array( $_where ) );
190
+			}
191 191
 
192 192
 
193 193
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 require_once ( EE_MODELS . 'EEM_Base.model.php' );
3 5
 
4 6
 /**
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
 	*
198 198
 	* 		@access		public
199 199
 	* 		@param		$ATT_ID
200
-	*		@return 		mixed		array on success, FALSE on fail
200
+	*		@return 		EE_Base_Class|null		array on success, FALSE on fail
201 201
 	 * 		@deprecated
202 202
 	*/
203 203
 	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
2
+require_once (EE_MODELS.'EEM_Base.model.php');
3 3
 
4 4
 /**
5 5
  *
@@ -21,60 +21,60 @@  discard block
 block discarded – undo
21 21
 	 * Please instead use the EEM_Attendee::system_question_* constants
22 22
 	 * @deprecated
23 23
 	 */
24
-	const fname_question_id=1;
24
+	const fname_question_id = 1;
25 25
 
26 26
 	/**
27 27
 	 * @deprecated
28 28
 	 */
29
-	const lname_question_id=2;
29
+	const lname_question_id = 2;
30 30
 
31 31
 
32 32
 	/**
33 33
 	 * @deprecated
34 34
 	 */
35
-	const email_question_id=3;
35
+	const email_question_id = 3;
36 36
 
37 37
 
38 38
 	/**
39 39
 	 * @deprecated
40 40
 	 */
41
-	const address_question_id=4;
41
+	const address_question_id = 4;
42 42
 
43 43
 
44 44
 	/**
45 45
 	 * @deprecated
46 46
 	 */
47
-	const address2_question_id=5;
47
+	const address2_question_id = 5;
48 48
 
49 49
 
50 50
 	/**
51 51
 	 * @deprecated
52 52
 	 */
53
-	const city_question_id=6;
53
+	const city_question_id = 6;
54 54
 
55 55
 
56 56
 	/**
57 57
 	 * @deprecated
58 58
 	 */
59
-	const state_question_id=7;
59
+	const state_question_id = 7;
60 60
 
61 61
 
62 62
 	/**
63 63
 	 * @deprecated
64 64
 	 */
65
-	const country_question_id=8;
65
+	const country_question_id = 8;
66 66
 
67 67
 
68 68
 	/**
69 69
 	 * @deprecated
70 70
 	 */
71
-	const zip_question_id=9;
71
+	const zip_question_id = 9;
72 72
 
73 73
 
74 74
 	/**
75 75
 	 * @deprecated
76 76
 	 */
77
-	const phone_question_id=10;
77
+	const phone_question_id = 10;
78 78
 
79 79
 	/**
80 80
 	 * When looking for questions that correspond to attendee fields,
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 	 * @access protected
120 120
 	 * @param null $timezone
121 121
 	 */
122
-	protected function __construct( $timezone = NULL ) {
123
-		$this->singular_item = __('Attendee','event_espresso');
124
-		$this->plural_item = __('Attendees','event_espresso');
122
+	protected function __construct($timezone = NULL) {
123
+		$this->singular_item = __('Attendee', 'event_espresso');
124
+		$this->plural_item = __('Attendees', 'event_espresso');
125 125
 		$this->_tables = array(
126 126
 			'Attendee_CPT'=> new EE_Primary_Table('posts', 'ID'),
127 127
 			'Attendee_Meta'=>new EE_Secondary_Table('esp_attendee_meta', 'ATTM_ID', 'ATT_ID')
@@ -135,35 +135,35 @@  discard block
 block discarded – undo
135 135
 				'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, time()),
136 136
 				'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")),
137 137
 				'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, time()),
138
-				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ),
138
+				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false),
139 139
 				'ATT_parent'=>new EE_DB_Only_Int_Field('post_parent', __("Parent Attendee (unused)", "event_espresso"), false, 0),
140
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'),// EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'),
140
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'), // EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'),
141 141
 				'status' => new EE_WP_Post_Status_Field('post_status', __('Attendee Status', 'event_espresso'), false, 'publish')
142 142
 			),
143 143
 			'Attendee_Meta'=>array(
144
-				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID','event_espresso'), false),
144
+				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID', 'event_espresso'), false),
145 145
 				'ATT_ID_fk'=>new EE_DB_Only_Int_Field('ATT_ID', __("Foreign Key to Attendee in Post Table", "event_espresso"), false),
146
-				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name','event_espresso'), true, ''),
147
-				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name','event_espresso'), true, ''),
148
-				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1','event_espresso'), true, ''),
149
-				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2','event_espresso'), true, ''),
150
-				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City','event_espresso'), true, ''),
151
-				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State','event_espresso'), true,0,'State'),
152
-				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country','event_espresso'), true,'','Country'),
153
-				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code','event_espresso'), true, ''),
154
-				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address','event_espresso'), true, ''),
155
-				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone','event_espresso'), true, '')
146
+				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name', 'event_espresso'), true, ''),
147
+				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name', 'event_espresso'), true, ''),
148
+				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1', 'event_espresso'), true, ''),
149
+				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2', 'event_espresso'), true, ''),
150
+				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City', 'event_espresso'), true, ''),
151
+				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State', 'event_espresso'), true, 0, 'State'),
152
+				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country', 'event_espresso'), true, '', 'Country'),
153
+				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code', 'event_espresso'), true, ''),
154
+				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address', 'event_espresso'), true, ''),
155
+				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone', 'event_espresso'), true, '')
156 156
 			));
157 157
 		$this->_model_relations = array(
158 158
 			'Registration'=>new EE_Has_Many_Relation(),
159 159
 			'State'=>new EE_Belongs_To_Relation(),
160 160
 			'Country'=>new EE_Belongs_To_Relation(),
161
-			'Event'=>new EE_HABTM_Relation('Registration', FALSE ),
161
+			'Event'=>new EE_HABTM_Relation('Registration', FALSE),
162 162
 			'WP_User' => new EE_Belongs_To_Relation(),
163
-			'Message' => new EE_Has_Many_Any_Relation( false ) //allow deletion of attendees even if they have messages in the queue for them.
163
+			'Message' => new EE_Has_Many_Any_Relation(false) //allow deletion of attendees even if they have messages in the queue for them.
164 164
 		);
165 165
 		$this->_caps_slug = 'contacts';
166
-		parent::__construct( $timezone );
166
+		parent::__construct($timezone);
167 167
 
168 168
 	}
169 169
 
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @param string $system_question_string
174 174
 	 * @return string|null if not found
175 175
 	 */
176
-	public function get_attendee_field_for_system_question( $system_question_string ) {
177
-		return isset( $this->_system_question_to_attendee_field_name[ $system_question_string ] ) ? $this->_system_question_to_attendee_field_name[ $system_question_string ] : null;
176
+	public function get_attendee_field_for_system_question($system_question_string) {
177
+		return isset($this->_system_question_to_attendee_field_name[$system_question_string]) ? $this->_system_question_to_attendee_field_name[$system_question_string] : null;
178 178
 	}
179 179
 
180 180
 
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 	 * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID
186 186
 	 * @return EE_Attendee[]
187 187
 	 */
188
-	public function get_attendees_for_transaction( $transaction_id_or_obj ){
189
-		return $this->get_all( array( array(
188
+	public function get_attendees_for_transaction($transaction_id_or_obj) {
189
+		return $this->get_all(array(array(
190 190
 			  'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj
191 191
 		  )));
192 192
 	}
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 	*		@return 		mixed		array on success, FALSE on fail
202 202
 	 * 		@deprecated
203 203
 	*/
204
-	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
204
+	public function get_attendee_by_ID($ATT_ID = FALSE) {
205 205
 		// retrieve a particular EE_Attendee
206
-		return $this->get_one_by_ID( $ATT_ID );
206
+		return $this->get_one_by_ID($ATT_ID);
207 207
 	}
208 208
 
209 209
 
@@ -216,14 +216,14 @@  discard block
 block discarded – undo
216 216
 	* 		@param		array $where_cols_n_values
217 217
 	*		@return 		mixed		array on success, FALSE on fail
218 218
 	*/
219
-	public function get_attendee( $where_cols_n_values = array() ) {
219
+	public function get_attendee($where_cols_n_values = array()) {
220 220
 
221
-		if ( empty( $where_cols_n_values )) {
221
+		if (empty($where_cols_n_values)) {
222 222
 			return FALSE;
223 223
 		}
224
-		$attendee = $this->get_all( array($where_cols_n_values ));
225
-		if ( ! empty( $attendee )) {
226
-			return array_shift( $attendee );
224
+		$attendee = $this->get_all(array($where_cols_n_values));
225
+		if ( ! empty($attendee)) {
226
+			return array_shift($attendee);
227 227
 		} else {
228 228
 			return FALSE;
229 229
 		}
@@ -239,20 +239,20 @@  discard block
 block discarded – undo
239 239
 	 * @param array $where_cols_n_values
240 240
 	 * @return bool|mixed
241 241
 	 */
242
-	public function find_existing_attendee( $where_cols_n_values = NULL ) {
242
+	public function find_existing_attendee($where_cols_n_values = NULL) {
243 243
 		// search by combo of first and last names plus the email address
244
-		$attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email );
244
+		$attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email);
245 245
 		// no search params means attendee object already exists.
246
-		$where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys;
246
+		$where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys;
247 247
 		$valid_data = TRUE;
248 248
 		// check for required values
249
-		$valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE;
250
-		$valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE;
251
-		$valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE;
249
+		$valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE;
250
+		$valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE;
251
+		$valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE;
252 252
 
253
-		if ( $valid_data ) {
254
-			$attendee = $this->get_attendee( $where_cols_n_values );
255
-			if ( $attendee instanceof EE_Attendee ) {
253
+		if ($valid_data) {
254
+			$attendee = $this->get_attendee($where_cols_n_values);
255
+			if ($attendee instanceof EE_Attendee) {
256 256
 				return $attendee;
257 257
 			}
258 258
 		}
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
              * @param  array $ids array of EE_Registration ids
271 271
              * @return  EE_Attendee[]
272 272
              */
273
-            public function get_array_of_contacts_from_reg_ids( $ids ) {
273
+            public function get_array_of_contacts_from_reg_ids($ids) {
274 274
                 $ids = (array) $ids;
275 275
                 $_where = array(
276
-                    'Registration.REG_ID' => array( 'in', $ids )
276
+                    'Registration.REG_ID' => array('in', $ids)
277 277
                     );
278
-                return $this->get_all( array( $_where ) );
278
+                return $this->get_all(array($_where));
279 279
             }
280 280
 
281 281
 
Please login to merge, or discard this patch.
core/db_models/EEM_CPT_Base.model.php 2 patches
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		$field = $this->get_a_field_of_type('EE_WP_Post_Status_Field');
119 119
 		if($field){
120 120
 			return $field->get_name();
121
-		}else{
121
+		} else{
122 122
 			throw new EE_Error(sprintf(__('We are trying to find the post status flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this)));
123 123
 		}
124 124
 	}
@@ -193,14 +193,16 @@  discard block
 block discarded – undo
193 193
 	public function get_meta_table_fields( $all = FALSE ) {
194 194
 		$all_fields = $fields_to_return = array();
195 195
 		foreach ( $this->_tables as $alias => $table_obj ) {
196
-			if ( $table_obj instanceof EE_Secondary_Table )
197
-				$all_fields = array_merge( $this->_get_fields_for_table($alias), $all_fields );
196
+			if ( $table_obj instanceof EE_Secondary_Table ) {
197
+							$all_fields = array_merge( $this->_get_fields_for_table($alias), $all_fields );
198
+			}
198 199
 		}
199 200
 
200 201
 		if ( !$all ) {
201 202
 			foreach ( $all_fields as $name => $obj ) {
202
-				if ( $obj instanceof EE_DB_Only_Field_Base )
203
-					continue;
203
+				if ( $obj instanceof EE_DB_Only_Field_Base ) {
204
+									continue;
205
+				}
204 206
 				$fields_to_return[] = $name;
205 207
 			}
206 208
 		} else {
@@ -248,7 +250,7 @@  discard block
 block discarded – undo
248 250
 				'parent'=>$parent_term_taxonomy_id
249 251
 			));
250 252
 			$term_taxonomy->save();
251
-		}else{
253
+		} else{
252 254
 			$term_taxonomy->set_count($term_taxonomy->count() + 1);
253 255
 			$term_taxonomy->save();
254 256
 		}
@@ -366,7 +368,7 @@  discard block
 block discarded – undo
366 368
 		if( ! $has_all_necessary_fields_for_table){
367 369
 
368 370
 			return $this->get_one_by_ID($post['ID']);
369
-		}else{
371
+		} else{
370 372
 			return $this->instantiate_class_from_array_or_object($post);
371 373
 		}
372 374
 	}
Please login to merge, or discard this patch.
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-define('EE_Event_Category_Taxonomy','espresso_event_category');
2
+define('EE_Event_Category_Taxonomy', 'espresso_event_category');
3 3
 /**
4 4
  *
5 5
  * EEM_CPT_Base
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @author 				Mike Nelson
17 17
  *
18 18
  */
19
-abstract class EEM_CPT_Base extends EEM_Soft_Delete_Base{
19
+abstract class EEM_CPT_Base extends EEM_Soft_Delete_Base {
20 20
 
21 21
 	/**
22 22
 	 * @var string post_status_publish - the wp post status for published cpts
@@ -69,55 +69,55 @@  discard block
 block discarded – undo
69 69
 	 * @param string $timezone
70 70
 	 * @throws \EE_Error
71 71
 	 */
72
-	protected function __construct( $timezone = NULL ){
72
+	protected function __construct($timezone = NULL) {
73 73
 
74 74
 		//adds a relationship to Term_Taxonomy for all these models. For this to work
75 75
 		//Term_Relationship must have a relation to each model subclassing EE_CPT_Base explicitly
76 76
 		//eg, in EEM_Term_Relationship, inside the _model_relations array, there must be an entry
77 77
 		//with key equalling the subclassing model's model name (eg 'Event' or 'Venue'), and the value
78 78
 		//must also be new EE_HABTM_Relation('Term_Relationship');
79
-		$this->_model_relations['Term_Taxonomy'] =new EE_HABTM_Relation('Term_Relationship');
79
+		$this->_model_relations['Term_Taxonomy'] = new EE_HABTM_Relation('Term_Relationship');
80 80
 		$primary_table_name = NULL;
81 81
 		//add  the common _status field to all CPT primary tables.
82
-		foreach ( $this->_tables as $alias => $table_obj ) {
83
-			if ( $table_obj instanceof EE_Primary_Table ) {
82
+		foreach ($this->_tables as $alias => $table_obj) {
83
+			if ($table_obj instanceof EE_Primary_Table) {
84 84
 				$primary_table_name = $alias;
85 85
 			}
86 86
 		}
87 87
 		//set default wp post statuses if child has not already set.
88
-		if ( ! isset( $this->_fields[$primary_table_name]['status'] )) {
88
+		if ( ! isset($this->_fields[$primary_table_name]['status'])) {
89 89
 			$this->_fields[$primary_table_name]['status'] = new EE_WP_Post_Status_Field('post_status', __("Event Status", "event_espresso"), false, 'draft');
90 90
 		}
91
-		if( ! isset( $this->_fields[$primary_table_name]['to_ping'])){
92
-			$this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __( 'To Ping', 'event_espresso' ), FALSE, '');
91
+		if ( ! isset($this->_fields[$primary_table_name]['to_ping'])) {
92
+			$this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __('To Ping', 'event_espresso'), FALSE, '');
93 93
 		}
94
-		if( ! isset( $this->_fields[$primary_table_name]['pinged'])){
95
-			$this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __( 'Pinged', 'event_espresso' ), FALSE, '');
94
+		if ( ! isset($this->_fields[$primary_table_name]['pinged'])) {
95
+			$this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __('Pinged', 'event_espresso'), FALSE, '');
96 96
 		}
97 97
 
98
-		if( ! isset( $this->_fields[$primary_table_name]['comment_status'])){
99
-			$this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso' ), FALSE, 'open');
98
+		if ( ! isset($this->_fields[$primary_table_name]['comment_status'])) {
99
+			$this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso'), FALSE, 'open');
100 100
 		}
101 101
 
102
-		if( ! isset( $this->_fields[$primary_table_name]['ping_status'])){
102
+		if ( ! isset($this->_fields[$primary_table_name]['ping_status'])) {
103 103
 			$this->_fields[$primary_table_name]['ping_status'] = new EE_Plain_Text_Field('ping_status', __('Ping Status', 'event_espresso'), FALSE, 'open');
104 104
 		}
105 105
 
106
-		if( ! isset( $this->_fields[$primary_table_name]['post_content_filtered'])){
107
-			$this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __( 'Post Content Filtered', 'event_espresso' ), FALSE, '');
106
+		if ( ! isset($this->_fields[$primary_table_name]['post_content_filtered'])) {
107
+			$this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __('Post Content Filtered', 'event_espresso'), FALSE, '');
108 108
 		}
109
-		if( ! isset( $this->_model_relations[ 'Post_Meta' ] ) ) {
109
+		if ( ! isset($this->_model_relations['Post_Meta'])) {
110 110
 			//don't block deletes though because we want to maintain the current behaviour
111
-			$this->_model_relations[ 'Post_Meta' ] = new EE_Has_Many_Relation( false );
111
+			$this->_model_relations['Post_Meta'] = new EE_Has_Many_Relation(false);
112 112
 		}
113
-		if( ! $this->_minimum_where_conditions_strategy instanceof EE_Default_Where_Conditions ){
113
+		if ( ! $this->_minimum_where_conditions_strategy instanceof EE_Default_Where_Conditions) {
114 114
 			//nothing was set during child constructor, so set default
115
-			$this->_minimum_where_conditions_strategy = new EE_CPT_Minimum_Where_Conditions( $this->post_type() );
115
+			$this->_minimum_where_conditions_strategy = new EE_CPT_Minimum_Where_Conditions($this->post_type());
116 116
 		}
117
-		if( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions ) {
117
+		if ( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions) {
118 118
 			//nothing was set during child constructor, so set default
119 119
 			//it's ok for child classes to specify this, but generally this is more DRY
120
-			$this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions( $this->post_type() );
120
+			$this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions($this->post_type());
121 121
 		}
122 122
 		parent::__construct($timezone);
123 123
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	public function public_event_stati() {
132 132
 		// @see wp-includes/post.php
133
-		return get_post_stati( array( 'public' => TRUE ));
133
+		return get_post_stati(array('public' => TRUE));
134 134
 	}
135 135
 
136 136
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return string
142 142
 	 * @throws EE_Error
143 143
 	 */
144
-	public function deleted_field_name(){
144
+	public function deleted_field_name() {
145 145
 		throw new EE_Error(sprintf(__("EEM_CPT_Base should nto call deleted_field_name! It should instead use post_status_field_name", "event_espresso")));
146 146
 	}
147 147
 
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
 	 * @return string
153 153
 	 * @throws EE_Error
154 154
 	 */
155
-	public function post_status_field_name(){
155
+	public function post_status_field_name() {
156 156
 		$field = $this->get_a_field_of_type('EE_WP_Post_Status_Field');
157
-		if($field){
157
+		if ($field) {
158 158
 			return $field->get_name();
159
-		}else{
160
-			throw new EE_Error(sprintf(__('We are trying to find the post status flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this)));
159
+		} else {
160
+			throw new EE_Error(sprintf(__('We are trying to find the post status flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this)));
161 161
 		}
162 162
 	}
163 163
 
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
 	 * @param array $query_params like EEM_Base::get_all's $query_params
169 169
 	 * @return array like EEM_Base::get_all's $query_params
170 170
 	 */
171
-	protected function _alter_query_params_so_only_trashed_items_included($query_params){
172
-		$post_status_field_name=$this->post_status_field_name();
173
-		$query_params[0][$post_status_field_name]=self::post_status_trashed;
171
+	protected function _alter_query_params_so_only_trashed_items_included($query_params) {
172
+		$post_status_field_name = $this->post_status_field_name();
173
+		$query_params[0][$post_status_field_name] = self::post_status_trashed;
174 174
 		return $query_params;
175 175
 	}
176 176
 
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 * @param array $query_params
182 182
 	 * @return array
183 183
 	 */
184
-	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params){
185
-		$query_params[ 'default_where_conditions' ] = 'minimum';
184
+	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params) {
185
+		$query_params['default_where_conditions'] = 'minimum';
186 186
 		return $query_params;
187 187
 	}
188 188
 
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
 	 * @param array $query_params like EEM_Base::get_all
195 195
 	 * @return boolean success
196 196
 	 */
197
-	function delete_or_restore($delete=true,$query_params = array()){
198
-		$post_status_field_name=$this->post_status_field_name();
197
+	function delete_or_restore($delete = true, $query_params = array()) {
198
+		$post_status_field_name = $this->post_status_field_name();
199 199
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
200 200
 		$new_status = $delete ? self::post_status_trashed : 'draft';
201
-		if ( $this->update (array($post_status_field_name=>$new_status), $query_params )) {
201
+		if ($this->update(array($post_status_field_name=>$new_status), $query_params)) {
202 202
 			return TRUE;
203 203
 		} else {
204 204
 			return FALSE;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function meta_table() {
217 217
 		$meta_table = $this->_get_other_tables();
218
-		$meta_table = reset( $meta_table );
218
+		$meta_table = reset($meta_table);
219 219
 		return $meta_table instanceof EE_Secondary_Table ? $meta_table->get_table_name() : NULL;
220 220
 	}
221 221
 
@@ -227,16 +227,16 @@  discard block
 block discarded – undo
227 227
 	 * @param  bool $all triggers whether we include DB_Only fields or JUST non DB_Only fields.  Defaults to false (no db only fields)
228 228
 	 * @return array
229 229
 	 */
230
-	public function get_meta_table_fields( $all = FALSE ) {
230
+	public function get_meta_table_fields($all = FALSE) {
231 231
 		$all_fields = $fields_to_return = array();
232
-		foreach ( $this->_tables as $alias => $table_obj ) {
233
-			if ( $table_obj instanceof EE_Secondary_Table )
234
-				$all_fields = array_merge( $this->_get_fields_for_table($alias), $all_fields );
232
+		foreach ($this->_tables as $alias => $table_obj) {
233
+			if ($table_obj instanceof EE_Secondary_Table)
234
+				$all_fields = array_merge($this->_get_fields_for_table($alias), $all_fields);
235 235
 		}
236 236
 
237
-		if ( !$all ) {
238
-			foreach ( $all_fields as $name => $obj ) {
239
-				if ( $obj instanceof EE_DB_Only_Field_Base )
237
+		if ( ! $all) {
238
+			foreach ($all_fields as $name => $obj) {
239
+				if ($obj instanceof EE_DB_Only_Field_Base)
240 240
 					continue;
241 241
 				$fields_to_return[] = $name;
242 242
 			}
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 	 * @param int $parent_term_taxonomy_id
260 260
 	 * @return EE_Term_Taxonomy
261 261
 	 */
262
-	function add_event_category(EE_CPT_Base $cpt_model_object, $category_name, $category_description ='',$parent_term_taxonomy_id = null){
262
+	function add_event_category(EE_CPT_Base $cpt_model_object, $category_name, $category_description = '', $parent_term_taxonomy_id = null) {
263 263
 		//create term
264
-		require_once( EE_MODELS . 'EEM_Term.model.php');
264
+		require_once(EE_MODELS.'EEM_Term.model.php');
265 265
 		//first, check for a term by the same name or slug
266 266
 		$category_slug = sanitize_title($category_name);
267
-		$term = EEM_Term::instance()->get_one(array(array('OR'=>array('name'=>$category_name,'slug'=>$category_slug))));
268
-		if( ! $term ){
267
+		$term = EEM_Term::instance()->get_one(array(array('OR'=>array('name'=>$category_name, 'slug'=>$category_slug))));
268
+		if ( ! $term) {
269 269
 			$term = EE_Term::new_instance(array(
270 270
 				'name'=>$category_name,
271 271
 				'slug'=>$category_slug
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 			$term->save();
274 274
 		}
275 275
 		//make sure there's a term-taxonomy entry too
276
-		require_once( EE_MODELS . 'EEM_Term_Taxonomy.model.php');
277
-		$term_taxonomy = EEM_Term_Taxonomy::instance()->get_one(array(array('term_id'=>$term->ID(),'taxonomy'=>EE_Event_Category_Taxonomy)));
276
+		require_once(EE_MODELS.'EEM_Term_Taxonomy.model.php');
277
+		$term_taxonomy = EEM_Term_Taxonomy::instance()->get_one(array(array('term_id'=>$term->ID(), 'taxonomy'=>EE_Event_Category_Taxonomy)));
278 278
 		/** @var $term_taxonomy EE_Term_Taxonomy */
279
-		if( ! $term_taxonomy ){
279
+		if ( ! $term_taxonomy) {
280 280
 			$term_taxonomy = EE_Term_Taxonomy::new_instance(array(
281 281
 				'term_id'=>$term->ID(),
282 282
 				'taxonomy'=>EE_Event_Category_Taxonomy,
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 				'parent'=>$parent_term_taxonomy_id
286 286
 			));
287 287
 			$term_taxonomy->save();
288
-		}else{
288
+		} else {
289 289
 			$term_taxonomy->set_count($term_taxonomy->count() + 1);
290 290
 			$term_taxonomy->save();
291 291
 		}
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
 	 * @param string $category_name name of the event category (term)
301 301
 	 * @return bool
302 302
 	 */
303
-	function remove_event_category(EE_CPT_Base $cpt_model_object_event, $category_name){
303
+	function remove_event_category(EE_CPT_Base $cpt_model_object_event, $category_name) {
304 304
 		//find the term_taxonomy by that name
305
-		$term_taxonomy = $this->get_first_related($cpt_model_object_event, 'Term_Taxonomy', array(array('Term.name'=>$category_name,'taxonomy'=>EE_Event_Category_Taxonomy)));
305
+		$term_taxonomy = $this->get_first_related($cpt_model_object_event, 'Term_Taxonomy', array(array('Term.name'=>$category_name, 'taxonomy'=>EE_Event_Category_Taxonomy)));
306 306
 		/** @var $term_taxonomy EE_Term_Taxonomy */
307
-		if( $term_taxonomy ){
307
+		if ($term_taxonomy) {
308 308
 			$term_taxonomy->set_count($term_taxonomy->count() - 1);
309 309
 			$term_taxonomy->save();
310 310
 		}
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 	 * @param string|array $attr Optional. Query string or array of attributes.
325 325
 	 * @return string HTML image element
326 326
 	 */
327
-	public function get_feature_image( $id, $size = 'thumbnail', $attr = '' ) {
328
-		return get_the_post_thumbnail( $id, $size, $attr );
327
+	public function get_feature_image($id, $size = 'thumbnail', $attr = '') {
328
+		return get_the_post_thumbnail($id, $size, $attr);
329 329
 	}
330 330
 
331 331
 
@@ -338,10 +338,10 @@  discard block
 block discarded – undo
338 338
 	 * @global array $wp_post_statuses set in wp core for storing all the post stati
339 339
 	 * @return array
340 340
 	 */
341
-	public function get_post_statuses(){
341
+	public function get_post_statuses() {
342 342
 		global $wp_post_statuses;
343 343
 		$statuses = array();
344
-		foreach($wp_post_statuses as $post_status => $args_object){
344
+		foreach ($wp_post_statuses as $post_status => $args_object) {
345 345
 			$statuses[$post_status] = $args_object->label;
346 346
 		}
347 347
 		return $statuses;
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 	public function get_status_array() {
357 357
 		$statuses = $this->get_post_statuses();
358 358
 		//first the global filter
359
-		$statuses = apply_filters( 'FHEE_EEM_CPT_Base__get_status_array', $statuses );
359
+		$statuses = apply_filters('FHEE_EEM_CPT_Base__get_status_array', $statuses);
360 360
 		//now the class specific filter
361
-		$statuses = apply_filters( 'FHEE_EEM_' . get_class($this) . '__get_status_array', $statuses );
361
+		$statuses = apply_filters('FHEE_EEM_'.get_class($this).'__get_status_array', $statuses);
362 362
 		return $statuses;
363 363
 	}
364 364
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	 */
371 371
 	public function get_custom_post_statuses() {
372 372
 		$new_stati = array();
373
-		foreach ( $this->_custom_stati as $status => $props ) {
373
+		foreach ($this->_custom_stati as $status => $props) {
374 374
 			$new_stati[$status] = $props['label'];
375 375
 		}
376 376
 		return $new_stati;
@@ -386,24 +386,24 @@  discard block
 block discarded – undo
386 386
 	 * @param WP_Post|array $post
387 387
 	 * @return EE_CPT_Base
388 388
 	 */
389
-	public function instantiate_class_from_post_object_orig($post){
390
-		$post = (array)$post;
389
+	public function instantiate_class_from_post_object_orig($post) {
390
+		$post = (array) $post;
391 391
 		$has_all_necessary_fields_for_table = true;
392 392
 		//check if the post has fields on the meta table already
393
-		foreach($this->_get_other_tables() as $table_obj){
393
+		foreach ($this->_get_other_tables() as $table_obj) {
394 394
 			$fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias());
395
-			foreach($fields_for_that_table as $field_obj){
396
-				if( ! isset($post[$field_obj->get_table_column()])
397
-					&& ! isset($post[$field_obj->get_qualified_column()])){
395
+			foreach ($fields_for_that_table as $field_obj) {
396
+				if ( ! isset($post[$field_obj->get_table_column()])
397
+					&& ! isset($post[$field_obj->get_qualified_column()])) {
398 398
 					$has_all_necessary_fields_for_table = false;
399 399
 				}
400 400
 			}
401 401
 		}
402 402
 		//if we don't have all the fields we need, then just fetch the proper model from the DB
403
-		if( ! $has_all_necessary_fields_for_table){
403
+		if ( ! $has_all_necessary_fields_for_table) {
404 404
 
405 405
 			return $this->get_one_by_ID($post['ID']);
406
-		}else{
406
+		} else {
407 407
 			return $this->instantiate_class_from_array_or_object($post);
408 408
 		}
409 409
 	}
@@ -414,30 +414,30 @@  discard block
 block discarded – undo
414 414
 	 * @param null $post
415 415
 	 * @return EE_Base_Class|EE_Soft_Delete_Base_Class
416 416
 	 */
417
-	public function instantiate_class_from_post_object( $post = NULL ){
418
-		if ( empty( $post )) {
417
+	public function instantiate_class_from_post_object($post = NULL) {
418
+		if (empty($post)) {
419 419
 			global $post;
420 420
 		}
421
-		$post = (array)$post;
421
+		$post = (array) $post;
422 422
 		$tables_needing_to_be_queried = array();
423 423
 		//check if the post has fields on the meta table already
424
-		foreach($this->get_tables() as $table_obj){
424
+		foreach ($this->get_tables() as $table_obj) {
425 425
 			$fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias());
426
-			foreach($fields_for_that_table as $field_obj){
427
-				if( ! isset($post[$field_obj->get_table_column()])
428
-					&& ! isset($post[$field_obj->get_qualified_column()])){
426
+			foreach ($fields_for_that_table as $field_obj) {
427
+				if ( ! isset($post[$field_obj->get_table_column()])
428
+					&& ! isset($post[$field_obj->get_qualified_column()])) {
429 429
 					$tables_needing_to_be_queried[$table_obj->get_table_alias()] = $table_obj;
430 430
 				}
431 431
 			}
432 432
 		}
433 433
 		//if we don't have all the fields we need, then just fetch the proper model from the DB
434
-		if( $tables_needing_to_be_queried){
435
-			if(count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table){
434
+		if ($tables_needing_to_be_queried) {
435
+			if (count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table) {
436 436
 				//so we're only missing data from a secondary table. Well that's not too hard to query for
437 437
 				$table_to_query = reset($tables_needing_to_be_queried);
438
-				$missing_data = $this->_do_wpdb_query( 'get_row', array( 'SELECT * FROM ' . $table_to_query->get_table_name() . ' WHERE ' . $table_to_query->get_fk_on_table() . ' = ' . $post['ID'], ARRAY_A ));
439
-				if ( ! empty( $missing_data )) {
440
-					$post = array_merge( $post, $missing_data );
438
+				$missing_data = $this->_do_wpdb_query('get_row', array('SELECT * FROM '.$table_to_query->get_table_name().' WHERE '.$table_to_query->get_fk_on_table().' = '.$post['ID'], ARRAY_A));
439
+				if ( ! empty($missing_data)) {
440
+					$post = array_merge($post, $missing_data);
441 441
 				}
442 442
 			} else {
443 443
 				return $this->get_one_by_ID($post['ID']);
@@ -454,15 +454,15 @@  discard block
 block discarded – undo
454 454
 	 * @throws EE_Error
455 455
 	 * @return string
456 456
 	 */
457
-	public function post_type(){
457
+	public function post_type() {
458 458
 		$post_type_field = NULL;
459
-		foreach($this->field_settings(true) as $field_obj){
460
-			if($field_obj instanceof EE_WP_Post_Type_Field){
461
-				$post_type_field = $field_obj;break;
459
+		foreach ($this->field_settings(true) as $field_obj) {
460
+			if ($field_obj instanceof EE_WP_Post_Type_Field) {
461
+				$post_type_field = $field_obj; break;
462 462
 			}
463 463
 		}
464
-		if($post_type_field == NULL){
465
-			throw new EE_Error(sprintf(__("CPT Model %s should have a field of type EE_WP_Post_Type, but doesnt", "event_espresso"),get_class($this)));
464
+		if ($post_type_field == NULL) {
465
+			throw new EE_Error(sprintf(__("CPT Model %s should have a field of type EE_WP_Post_Type, but doesnt", "event_espresso"), get_class($this)));
466 466
 		}
467 467
 		return $post_type_field->get_default_value();
468 468
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Checkin.model.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * ------------------------------------------------------------------------
25 25
  */
26
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
27
-require_once ( EE_CLASSES . 'EE_Checkin.class.php' );
26
+require_once (EE_MODELS.'EEM_Base.model.php');
27
+require_once (EE_CLASSES.'EE_Checkin.class.php');
28 28
 
29 29
 class EEM_Checkin extends EEM_Base {
30 30
 
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 	 * 		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
41 41
 	 * 		@return void
42 42
 	 */
43
-	protected function __construct( $timezone = NULL ) {
44
-		$this->singular_item = __('Check-In','event_espresso');
45
-		$this->plural_item = __('Check-Ins','event_espresso');
43
+	protected function __construct($timezone = NULL) {
44
+		$this->singular_item = __('Check-In', 'event_espresso');
45
+		$this->plural_item = __('Check-Ins', 'event_espresso');
46 46
 
47 47
 		$this->_tables = array(
48
-			'Checkin'=>new EE_Primary_Table('esp_checkin','CHK_ID')
48
+			'Checkin'=>new EE_Primary_Table('esp_checkin', 'CHK_ID')
49 49
 		);
50 50
 		$this->_fields = array(
51 51
 			'Checkin'=> array(
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', 'Registration Id', false, 0, 'Registration'),
54 54
 				'DTT_ID'=>new EE_Foreign_Key_Int_Field('DTT_ID', 'Datetime Id', false, 0, 'Datetime'),
55 55
 				'CHK_in'=>new EE_Boolean_Field('CHK_in', 'Whether a person has checked in or checked out', false, true),
56
-				'CHK_timestamp'=>new EE_Datetime_Field('CHK_timestamp', __('When the row was modified','event_espresso'), false, time(), $timezone )
56
+				'CHK_timestamp'=>new EE_Datetime_Field('CHK_timestamp', __('When the row was modified', 'event_espresso'), false, time(), $timezone)
57 57
 			)
58 58
 		);
59 59
 		$this->_model_relations = array(
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			'Datetime'=>new EE_Belongs_To_Relation()
62 62
 		);
63 63
 		$this->_model_chain_to_wp_user = 'Registration.Event';
64
-		parent::__construct( $timezone );
64
+		parent::__construct($timezone);
65 65
 
66 66
 	}
67 67
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Country.model.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 
84 84
 
85 85
 	/**
86
-	*		_get_countries
87
-	*
88
-	* 		@access		public
89
-	*		@return 		array
90
-	*/
86
+	 *		_get_countries
87
+	 *
88
+	 * 		@access		public
89
+	 *		@return 		array
90
+	 */
91 91
 	public function get_all_countries() {
92 92
 		if ( ! self::$_all_countries ) {
93 93
 			self::$_all_countries = $this->get_all( array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 	/**
99
-	*		_get_countries
100
-	*		Gets and caches the list of active countries. If you know the list of active countries
101
-	*		has changed during this request, first use EEM_Country::reset() to flush the cache
102
-	* 		@access		public
103
-	*		@return 		array
104
-	*/
99
+	 *		_get_countries
100
+	 *		Gets and caches the list of active countries. If you know the list of active countries
101
+	 *		has changed during this request, first use EEM_Country::reset() to flush the cache
102
+	 * 		@access		public
103
+	 *		@return 		array
104
+	 */
105 105
 	public function get_all_active_countries() {
106 106
 		if ( ! self::$_active_countries ) {
107 107
 			self::$_active_countries =  $this->get_all( array( array( 'CNT_active' => TRUE ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  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')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -122,7 +124,7 @@  discard block
 block discarded – undo
122 124
 		$names = $this->get_col( array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name' );
123 125
 		if( is_array( $names ) && ! empty( $names ) ){
124 126
 			return reset( $names );
125
-		}else{
127
+		} else{
126 128
 			return '';
127 129
 		}
128 130
 	}
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
 	 * @param null $timezone
39 39
 	 * @return \EEM_Country
40 40
 	 */
41
-	public static function reset( $timezone = NULL ){
41
+	public static function reset($timezone = NULL) {
42 42
 		self::$_active_countries = NULL;
43 43
 		self::$_all_countries = NULL;
44
-		return parent::reset( $timezone );
44
+		return parent::reset($timezone);
45 45
 	}
46 46
 
47 47
 
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @param null $timezone
53 53
 	 */
54
-	protected function __construct( $timezone = NULL ){
55
-		$this->singular_item = __('Country','event_espresso');
56
-		$this->plural_item = __('Countries','event_espresso');
54
+	protected function __construct($timezone = NULL) {
55
+		$this->singular_item = __('Country', 'event_espresso');
56
+		$this->plural_item = __('Countries', 'event_espresso');
57 57
 
58 58
 
59 59
 		$this->_tables = array(
@@ -61,21 +61,21 @@  discard block
 block discarded – undo
61 61
 		);
62 62
 		$this->_fields = array(
63 63
 			'Country'=>array(
64
-				'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists','event_espresso'), false, true),
65
-				'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code','event_espresso')),
66
-				'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code','event_espresso'), false,''),
67
-				'RGN_ID'=>new EE_Integer_Field('RGN_ID', __('Region ID','event_espresso'), false,0),//should be a foreign key, but no region table exists yet
68
-				'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name','event_espresso'), false,''),
69
-				'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code','event_espresso'), false),
70
-				'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular','event_espresso'), false),
71
-				'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural','event_espresso'), false),
72
-				'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign','event_espresso'), false),
73
-				'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number','event_espresso'), false, true),
74
-				'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2),
75
-				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark','event_espresso'), false, '.'),
76
-				'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator','event_espresso'), false, ','),
77
-				'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code','event_espresso'), false, ''),
78
-				'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU','event_espresso'), false, false)
64
+				'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true),
65
+				'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code', 'event_espresso')),
66
+				'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code', 'event_espresso'), false, ''),
67
+				'RGN_ID'=>new EE_Integer_Field('RGN_ID', __('Region ID', 'event_espresso'), false, 0), //should be a foreign key, but no region table exists yet
68
+				'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name', 'event_espresso'), false, ''),
69
+				'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code', 'event_espresso'), false),
70
+				'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular', 'event_espresso'), false),
71
+				'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural', 'event_espresso'), false),
72
+				'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign', 'event_espresso'), false),
73
+				'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number', 'event_espresso'), false, true),
74
+				'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2),
75
+				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark', 'event_espresso'), false, '.'),
76
+				'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator', 'event_espresso'), false, ','),
77
+				'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code', 'event_espresso'), false, ''),
78
+				'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU', 'event_espresso'), false, false)
79 79
 			));
80 80
 		$this->_model_relations = array(
81 81
 			'Attendee'=>new EE_Has_Many_Relation(),
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 			'Venue'=>new EE_Has_Many_Relation(),
84 84
 		);
85 85
 		//only anyone to view, but only those with the default role can do anything
86
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
86
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
87 87
 
88
-		parent::__construct( $timezone );
88
+		parent::__construct($timezone);
89 89
 	}
90 90
 
91 91
 
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	*		@return 		array
99 99
 	*/
100 100
 	public function get_all_countries() {
101
-		if ( ! self::$_all_countries ) {
102
-			self::$_all_countries = $this->get_all( array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
101
+		if ( ! self::$_all_countries) {
102
+			self::$_all_countries = $this->get_all(array('order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array(0, 99999)));
103 103
 		}
104 104
 		return self::$_all_countries;
105 105
 	}
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	*		@return 		array
113 113
 	*/
114 114
 	public function get_all_active_countries() {
115
-		if ( ! self::$_active_countries ) {
116
-			self::$_active_countries =  $this->get_all( array( array( 'CNT_active' => TRUE ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
115
+		if ( ! self::$_active_countries) {
116
+			self::$_active_countries = $this->get_all(array(array('CNT_active' => TRUE), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array(0, 99999)));
117 117
 		}
118 118
 		return self::$_active_countries;
119 119
 	}
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
 	 * @param string $country_ISO
124 124
 	 * @return string
125 125
 	 */
126
-	public function get_country_name_by_ISO( $country_ISO ){
127
-		if( isset( self::$_all_countries[ $country_ISO ] ) &&
128
-				self::$_all_countries[ $country_ISO ] instanceof EE_Country ){
129
-			return self::$_all_countries[ $country_ISO ]->name();
126
+	public function get_country_name_by_ISO($country_ISO) {
127
+		if (isset(self::$_all_countries[$country_ISO]) &&
128
+				self::$_all_countries[$country_ISO] instanceof EE_Country) {
129
+			return self::$_all_countries[$country_ISO]->name();
130 130
 		}
131
-		$names = $this->get_col( array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name' );
132
-		if( is_array( $names ) && ! empty( $names ) ){
133
-			return reset( $names );
134
-		}else{
131
+		$names = $this->get_col(array(array('CNT_ISO' => $country_ISO), 'limit' => 1), 'CNT_name');
132
+		if (is_array($names) && ! empty($names)) {
133
+			return reset($names);
134
+		} else {
135 135
 			return '';
136 136
 		}
137 137
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Currency.model.php 2 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -75,12 +76,12 @@  discard block
 block discarded – undo
75 76
 		if($payment_method_type instanceof EE_PMT_Base &&
76 77
 				$payment_method_type->get_gateway()){
77 78
 			$currencies_supported = $payment_method_type->get_gateway()->currencies_supported();
78
-		}else{
79
+		} else{
79 80
 			$currencies_supported = EE_Gateway::all_currencies_supported;
80 81
 		}
81 82
 		if($currencies_supported == EE_Gateway::all_currencies_supported || empty( $currencies_supported ) ) {
82 83
 			$currencies = $this->get_all_active();
83
-		}else{
84
+		} else{
84 85
 			$currencies = $this->get_all_active(array(array('CUR_code'=>array('IN',$currencies_supported))));
85 86
 		}
86 87
 		return $currencies;
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEM_Currency extends EEM_Base{
28
+class EEM_Currency extends EEM_Base {
29 29
 
30 30
 	// private instance of the EEM_Currency object
31 31
 	protected static $_instance = null;
@@ -37,28 +37,28 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param null $timezone
39 39
 	 */
40
-	protected function __construct( $timezone = NULL ) {
41
-		$this->singular_item = __('Currency','event_espresso');
42
-		$this->plural_item = __('Currencies','event_espresso');
40
+	protected function __construct($timezone = NULL) {
41
+		$this->singular_item = __('Currency', 'event_espresso');
42
+		$this->plural_item = __('Currencies', 'event_espresso');
43 43
 		$this->_tables = array(
44 44
 			'Currency'=> new EE_Primary_Table('esp_currency', 'CUR_code')
45 45
 		);
46 46
 		$this->_fields = array(
47 47
 			'Currency'=>array(
48
-				'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency Code','event_espresso')),
49
-				'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular','event_espresso'), false),
50
-				'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural','event_espresso'), false),
51
-				'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign','event_espresso'), false),
52
-				'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2),
53
-				'CUR_active'=>new EE_Boolean_Field('CUR_active', __('Active?', 'event_espresso'), false,true),
48
+				'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency Code', 'event_espresso')),
49
+				'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular', 'event_espresso'), false),
50
+				'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural', 'event_espresso'), false),
51
+				'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign', 'event_espresso'), false),
52
+				'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2),
53
+				'CUR_active'=>new EE_Boolean_Field('CUR_active', __('Active?', 'event_espresso'), false, true),
54 54
 			));
55 55
 		$this->_model_relations = array(
56 56
 			'Payment_Method'=>new EE_HABTM_Relation('Currency_Payment_Method'),
57 57
 		);
58 58
 		//this model is generally available for reading
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
59
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
60 60
 
61
-		parent::__construct( $timezone );
61
+		parent::__construct($timezone);
62 62
 	}
63 63
 
64 64
 
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 	 * @param array $query_params see EEM_Base::get_all
69 69
 	 * @return EE_Currency[]
70 70
 	 */
71
-	public function get_all_active($query_params = array()){
71
+	public function get_all_active($query_params = array()) {
72 72
 		$query_params[0]['CUR_active'] = true;
73
-		if( ! isset($query_params['order_by'])){
74
-			$query_params['order_by'] = array('CUR_code'=>'ASC','CUR_single'=>'ASC');
73
+		if ( ! isset($query_params['order_by'])) {
74
+			$query_params['order_by'] = array('CUR_code'=>'ASC', 'CUR_single'=>'ASC');
75 75
 		}
76 76
 		return $this->get_all($query_params);
77 77
 	}
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
 	 * @param EE_PMT_Base $payment_method_type
84 84
 	 * @return EE_Currency[]
85 85
 	 */
86
-	public function get_all_currencies_usable_by($payment_method_type){
87
-		if($payment_method_type instanceof EE_PMT_Base &&
88
-				$payment_method_type->get_gateway()){
86
+	public function get_all_currencies_usable_by($payment_method_type) {
87
+		if ($payment_method_type instanceof EE_PMT_Base &&
88
+				$payment_method_type->get_gateway()) {
89 89
 			$currencies_supported = $payment_method_type->get_gateway()->currencies_supported();
90
-		}else{
90
+		} else {
91 91
 			$currencies_supported = EE_Gateway::all_currencies_supported;
92 92
 		}
93
-		if($currencies_supported == EE_Gateway::all_currencies_supported || empty( $currencies_supported ) ) {
93
+		if ($currencies_supported == EE_Gateway::all_currencies_supported || empty($currencies_supported)) {
94 94
 			$currencies = $this->get_all_active();
95
-		}else{
96
-			$currencies = $this->get_all_active(array(array('CUR_code'=>array('IN',$currencies_supported))));
95
+		} else {
96
+			$currencies = $this->get_all_active(array(array('CUR_code'=>array('IN', $currencies_supported))));
97 97
 		}
98 98
 		return $currencies;
99 99
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Currency_Payment_Method.model.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,22 +25,22 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEM_Currency_Payment_Method extends EEM_Base{
28
+class EEM_Currency_Payment_Method extends EEM_Base {
29 29
 	// private instance of the Attendee object
30 30
 	protected static $_instance = NULL;
31 31
 
32 32
 
33
-	protected function __construct( $timezone = NULL ) {
34
-		$this->singular_item = __('Currency Usable by Payment Method','event_espresso');
35
-		$this->plural_item = __('Currencies Usable by Payment Methods','event_espresso');
33
+	protected function __construct($timezone = NULL) {
34
+		$this->singular_item = __('Currency Usable by Payment Method', 'event_espresso');
35
+		$this->plural_item = __('Currencies Usable by Payment Methods', 'event_espresso');
36 36
 		$this->_tables = array(
37
-			'Currency_Payment_Method'=>new EE_Primary_Table('esp_currency_payment_method','CPM_ID')
37
+			'Currency_Payment_Method'=>new EE_Primary_Table('esp_currency_payment_method', 'CPM_ID')
38 38
 		);
39 39
 		$this->_fields = array(
40 40
 			'Currency_Payment_Method'=>array(
41
-				'CPM_ID'=>new EE_Primary_Key_Int_Field('CPM_ID', __('Currency to Payment Method LInk ID','event_espresso')),
42
-				'CUR_code'=>new EE_Foreign_Key_String_Field('CUR_code', __('Currency Code','event_espresso'), false, 0, 'Currency'),
43
-				'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __('Paymetn Method ID','event_espresso'), false, 0, 'Payment_Method')
41
+				'CPM_ID'=>new EE_Primary_Key_Int_Field('CPM_ID', __('Currency to Payment Method LInk ID', 'event_espresso')),
42
+				'CUR_code'=>new EE_Foreign_Key_String_Field('CUR_code', __('Currency Code', 'event_espresso'), false, 0, 'Currency'),
43
+				'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __('Paymetn Method ID', 'event_espresso'), false, 0, 'Payment_Method')
44 44
 			)
45 45
 		);
46 46
 		$this->_model_relations = array(
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 			'Payment_Method'=>new EE_Belongs_To_Relation()
49 49
 		);
50 50
 		//this model is generally available for reading
51
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
51
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
52 52
 		$this->_caps_slug = 'payment_methods';
53
-		parent::__construct( $timezone );
53
+		parent::__construct($timezone);
54 54
 	}
55 55
 }
56 56
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime_Ticket.model.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Datetime_Ticket.class.php' );
24
+require_once (EE_MODELS.'EEM_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Datetime_Ticket.class.php');
26 26
 
27 27
 class EEM_Datetime_Ticket extends EEM_Base {
28 28
 
@@ -37,28 +37,28 @@  discard block
 block discarded – undo
37 37
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
38 38
 	 *		@return void
39 39
 	 */
40
-	protected function __construct( $timezone ) {
41
-		$this->singular_item = __('Datetime Ticket','event_espresso');
42
-		$this->plural_item = __('Datetime Tickets','event_espresso');
40
+	protected function __construct($timezone) {
41
+		$this->singular_item = __('Datetime Ticket', 'event_espresso');
42
+		$this->plural_item = __('Datetime Tickets', 'event_espresso');
43 43
 
44 44
 		$this->_tables = array(
45 45
 			'Datetime_Ticket'=> new EE_Primary_Table('esp_datetime_ticket', 'DTK_ID')
46 46
 		);
47 47
 		$this->_fields = array(
48 48
 			'Datetime_Ticket'=>array(
49
-				'DTK_ID'=>new EE_Primary_Key_Int_Field('DTK_ID', __('Datetime Ticket ID','event_espresso')),
50
-				'DTT_ID'=>new EE_Foreign_Key_Int_Field('DTT_ID', __('The ID to the Datetime','event_espresso'), false, 0, 'Datetime' ),
51
-				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('The ID to the Ticket','event_espresso'), false, 0, 'Ticket' )
49
+				'DTK_ID'=>new EE_Primary_Key_Int_Field('DTK_ID', __('Datetime Ticket ID', 'event_espresso')),
50
+				'DTT_ID'=>new EE_Foreign_Key_Int_Field('DTT_ID', __('The ID to the Datetime', 'event_espresso'), false, 0, 'Datetime'),
51
+				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('The ID to the Ticket', 'event_espresso'), false, 0, 'Ticket')
52 52
 			));
53 53
 		$this->_model_relations = array(
54 54
 			'Ticket'=>new EE_Belongs_To_Relation(),
55 55
 			'Datetime'=>new EE_Belongs_To_Relation()
56 56
 		);
57 57
 		//this model is generally available for reading
58
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Datetime.Event' );
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Datetime.Event' );
60
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Datetime.Event' );
61
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Datetime.Event', EEM_Base::caps_edit );
62
-		parent::__construct( $timezone );
58
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Datetime.Event');
59
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Datetime.Event');
60
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Datetime.Event');
61
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Datetime.Event', EEM_Base::caps_edit);
62
+		parent::__construct($timezone);
63 63
 	}
64 64
 } //end EEM_Datetime_Ticket class
65 65
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Event.model.php 3 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  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')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 require_once( EE_MODELS . 'EEM_CPT_Base.model.php');
3 5
 /**
4 6
  *
@@ -349,8 +351,9 @@  discard block
 block discarded – undo
349 351
 			 	$questions[ $qg->ID() ] = $qg->model_field_array();
350 352
 			 	$questions[ $qg->ID() ]['QSG_questions'] = array();
351 353
 			 	foreach ( $qsts as $qst ) {
352
-			 		if ( $qst->is_system_question() )
353
-			 			continue;
354
+			 		if ( $qst->is_system_question() ) {
355
+			 					 			continue;
356
+			 		}
354 357
 			 		$answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID() ) ) );
355 358
 			 		$answer = $answer instanceof EE_Answer ? $answer : EEM_Answer::instance()->create_default_object();
356 359
 			 		$qst_name = $qstn_id = $qst->ID();
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 
180 180
 
181 181
 	/**
182
-	*		get_question_groups
183
-	*
184
-	* 		@access		public
185
-	*		@return 		array
186
-	*/
182
+	 *		get_question_groups
183
+	 *
184
+	 * 		@access		public
185
+	 *		@return 		array
186
+	 */
187 187
 	public function get_all_question_groups() {
188 188
 		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
189 189
 			array( 'QSG_deleted' => FALSE ),
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 
198 198
 
199 199
 	/**
200
-	*		get_question_groups
201
-	*
202
-	* 		@access		public
203
-	* 		@param		int $EVT_ID
204
-	*		@return 		array
205
-	*/
200
+	 *		get_question_groups
201
+	 *
202
+	 * 		@access		public
203
+	 * 		@param		int $EVT_ID
204
+	 *		@return 		array
205
+	 */
206 206
 	public function get_all_event_question_groups( $EVT_ID = 0 ) {
207 207
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
208 208
 			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
@@ -218,13 +218,13 @@  discard block
 block discarded – undo
218 218
 
219 219
 
220 220
 	/**
221
-	*		get_question_groups
222
-	*
223
-	* 		@access		public
224
-	* 		@param		int $EVT_ID
225
-	* 		@param		boolean	$for_primary_attendee
226
-	*		@return 		array
227
-	*/
221
+	 *		get_question_groups
222
+	 *
223
+	 * 		@access		public
224
+	 * 		@param		int $EVT_ID
225
+	 * 		@param		boolean	$for_primary_attendee
226
+	 *		@return 		array
227
+	 */
228 228
 	public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) {
229 229
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
230 230
 			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 
242 242
 
243 243
 	/**
244
-	*		get_question_groups
245
-	*
246
-	* 		@access		public
247
-	* 		@param		int $EVT_ID
248
-	* 		@param		EE_Registration 	$registration
249
-	*		@return 		array
250
-	*/
244
+	 *		get_question_groups
245
+	 *
246
+	 * 		@access		public
247
+	 * 		@param		int $EVT_ID
248
+	 * 		@param		EE_Registration 	$registration
249
+	 *		@return 		array
250
+	 */
251 251
 	public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) {
252 252
 
253 253
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
 
276 276
 
277 277
 	/**
278
-	*		get_question_target_db_column
279
-	*
280
-	* 		@access		public
281
-	* 		@param		string		$QSG_IDs  csv list of $QSG IDs
282
-	*		@return 		array
283
-	*/
278
+	 *		get_question_target_db_column
279
+	 *
280
+	 * 		@access		public
281
+	 * 		@param		string		$QSG_IDs  csv list of $QSG IDs
282
+	 *		@return 		array
283
+	 */
284 284
 	public function get_questions_in_groups( $QSG_IDs = '' ) {
285 285
 
286 286
 		if ( empty( $QSG_IDs )) {
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 
307 307
 
308 308
 	/**
309
-	*		get_options_for_question
310
-	*
311
-	* 		@access		public
312
-	* 		@param		string		$QST_IDs  csv list of $QST IDs
313
-	*		@return 		array
314
-	*/
309
+	 *		get_options_for_question
310
+	 *
311
+	 * 		@access		public
312
+	 * 		@param		string		$QST_IDs  csv list of $QST IDs
313
+	 *		@return 		array
314
+	 */
315 315
 	public function get_options_for_question( $QST_IDs ) {
316 316
 
317 317
 		if ( empty( $QST_IDs )) {
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
 
397 397
 
398 398
 	/**
399
-	*		_get_question_target_db_column
400
-	*
401
-	* 		@access		private
402
-	* 		@param		$QST
403
-	*		@return 		string		string
404
-	*/
399
+	 *		_get_question_target_db_column
400
+	 *
401
+	 * 		@access		private
402
+	 * 		@param		$QST
403
+	 *		@return 		string		string
404
+	 */
405 405
 	private function _generate_question_input_name( $QST ) {
406 406
 
407 407
 		if ( $QST->QST_system ) {
Please login to merge, or discard this patch.
Spacing   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once( EE_MODELS . 'EEM_CPT_Base.model.php');
2
+require_once(EE_MODELS.'EEM_CPT_Base.model.php');
3 3
 /**
4 4
  *
5 5
  * EEM_Event Model
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author				Michael Nelson, Brent Christensen
12 12
  *
13 13
  */
14
-class EEM_Event  extends EEM_CPT_Base{
14
+class EEM_Event  extends EEM_CPT_Base {
15 15
 
16 16
 	/**
17 17
 	 * constant used by status(), indicating that no more tickets can be purchased for any of the datetimes for the event
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
 	 * @param string $timezone
52 52
 	 * @return EEM_Event
53 53
 	 */
54
-	public static function instance( $timezone = NULL ){
54
+	public static function instance($timezone = NULL) {
55 55
 
56 56
 		// check if instance of EEM_Event already exists
57
-		if ( ! self::$_instance instanceof EEM_Event ) {
57
+		if ( ! self::$_instance instanceof EEM_Event) {
58 58
 			// instantiate Espresso_model
59
-			self::$_instance = new self( $timezone );
59
+			self::$_instance = new self($timezone);
60 60
 		}
61 61
 		//we might have a timezone set, let set_timezone decide what to do with it
62
-		self::$_instance->set_timezone( $timezone );
62
+		self::$_instance->set_timezone($timezone);
63 63
 		// EEM_Event object
64 64
 		return self::$_instance;
65 65
 	}
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 	 * @param string $timezone
71 71
 	 * @return EEM_Event
72 72
 	 */
73
-	protected function __construct($timezone = null){
73
+	protected function __construct($timezone = null) {
74 74
 
75
-		$this->singular_item = __('Event','event_espresso');
76
-		$this->plural_item = __('Events','event_espresso');
75
+		$this->singular_item = __('Event', 'event_espresso');
76
+		$this->plural_item = __('Events', 'event_espresso');
77 77
 
78 78
 		// to remove Cancelled events from the frontend, copy the following filter to your functions.php file
79 79
 		// add_filter( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', '__return_false' );
@@ -87,53 +87,53 @@  discard block
 block discarded – undo
87 87
 			array(
88 88
 				EEM_Event::cancelled => array(
89 89
 					'label' => __('Cancelled', 'event_espresso'),
90
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE )
90
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE)
91 91
 				),
92 92
 				EEM_Event::postponed => array(
93 93
 					'label' => __('Postponed', 'event_espresso'),
94
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE )
94
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE)
95 95
 				),
96 96
 				EEM_Event::sold_out => array(
97 97
 					'label' => __('Sold Out', 'event_espresso'),
98
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE )
98
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE)
99 99
 				)
100 100
 			)
101 101
 		);
102 102
 
103 103
 		$this->_tables = array(
104
-			'Event_CPT'=>new EE_Primary_Table( 'posts','ID' ),
105
-			'Event_Meta'=> new EE_Secondary_Table( 'esp_event_meta', 'EVTM_ID', 'EVT_ID' )
104
+			'Event_CPT'=>new EE_Primary_Table('posts', 'ID'),
105
+			'Event_Meta'=> new EE_Secondary_Table('esp_event_meta', 'EVTM_ID', 'EVT_ID')
106 106
 		);
107 107
 
108 108
 		$this->_fields = array(
109 109
 			'Event_CPT'=>array(
110
-				'EVT_ID'=>new EE_Primary_Key_Int_Field( 'ID', __( 'Post ID for Event','event_espresso' )),
111
-				'EVT_name'=>new EE_Plain_Text_Field( 'post_title', __( 'Event Name','event_espresso' ), FALSE, '' ),
112
-				'EVT_desc'=>new EE_Post_Content_Field( 'post_content', __( 'Event Description', 'event_espresso' ), FALSE, '' ),
113
-				'EVT_slug'=>new EE_Slug_Field( 'post_name', __( 'Event Slug', 'event_espresso' ), FALSE, '' ),
114
-				'EVT_created'=>new EE_Datetime_Field( 'post_date', __( 'Date/Time Event Created', 'event_espresso' ), FALSE, time()),
115
-				'EVT_short_desc'=>new EE_Simple_HTML_Field( 'post_excerpt', __( 'Event Short Description', 'event_espresso' ), FALSE,'' ),
116
-				'EVT_modified'=>new EE_Datetime_Field( 'post_modified', __( 'Date/Time Event Modified', 'event_espresso' ), FALSE, time()),
117
-				'EVT_wp_user'=>new EE_WP_User_Field( 'post_author', __( 'Event Creator ID', 'event_espresso'), FALSE),
118
-				'parent'=>new EE_Integer_Field( 'post_parent', __( 'Event Parent ID', 'event_espresso' ), FALSE, 0 ),
119
-				'EVT_order'=>new EE_Integer_Field( 'menu_order', __( 'Event Menu Order', 'event_espresso' ), FALSE, 1 ),
120
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_events'),// EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ),
121
-				'status' => new EE_WP_Post_Status_Field( 'post_status', __( 'Event Status', 'event_espresso' ), FALSE, 'draft', $this->_custom_stati )
110
+				'EVT_ID'=>new EE_Primary_Key_Int_Field('ID', __('Post ID for Event', 'event_espresso')),
111
+				'EVT_name'=>new EE_Plain_Text_Field('post_title', __('Event Name', 'event_espresso'), FALSE, ''),
112
+				'EVT_desc'=>new EE_Post_Content_Field('post_content', __('Event Description', 'event_espresso'), FALSE, ''),
113
+				'EVT_slug'=>new EE_Slug_Field('post_name', __('Event Slug', 'event_espresso'), FALSE, ''),
114
+				'EVT_created'=>new EE_Datetime_Field('post_date', __('Date/Time Event Created', 'event_espresso'), FALSE, time()),
115
+				'EVT_short_desc'=>new EE_Simple_HTML_Field('post_excerpt', __('Event Short Description', 'event_espresso'), FALSE, ''),
116
+				'EVT_modified'=>new EE_Datetime_Field('post_modified', __('Date/Time Event Modified', 'event_espresso'), FALSE, time()),
117
+				'EVT_wp_user'=>new EE_WP_User_Field('post_author', __('Event Creator ID', 'event_espresso'), FALSE),
118
+				'parent'=>new EE_Integer_Field('post_parent', __('Event Parent ID', 'event_espresso'), FALSE, 0),
119
+				'EVT_order'=>new EE_Integer_Field('menu_order', __('Event Menu Order', 'event_espresso'), FALSE, 1),
120
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_events'), // EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ),
121
+				'status' => new EE_WP_Post_Status_Field('post_status', __('Event Status', 'event_espresso'), FALSE, 'draft', $this->_custom_stati)
122 122
 			),
123 123
 			'Event_Meta'=>array(
124
-				'EVTM_ID'=> new EE_DB_Only_Float_Field( 'EVTM_ID', __( 'Event Meta Row ID','event_espresso' ), FALSE ),
125
-				'EVT_ID_fk'=>new EE_DB_Only_Int_Field( 'EVT_ID', __( 'Foreign key to Event ID from Event Meta table', 'event_espresso' ), FALSE ),
126
-				'EVT_display_desc'=>new EE_Boolean_Field( 'EVT_display_desc', __( 'Display Description Flag', 'event_espresso' ), FALSE, 1 ),
127
-				'EVT_display_ticket_selector'=>new EE_Boolean_Field( 'EVT_display_ticket_selector', __( 'Display Ticket Selector Flag', 'event_espresso' ), FALSE, 1 ),
128
-				'EVT_visible_on'=>new EE_Datetime_Field( 'EVT_visible_on', __( 'Event Visible Date', 'event_espresso' ), TRUE, time()),
129
-				'EVT_additional_limit'=>new EE_Integer_Field( 'EVT_additional_limit', __( 'Limit of Additional Registrations on Same Transaction', 'event_espresso' ), TRUE, 10 ),
130
-				'EVT_default_registration_status'=>new EE_Enum_Text_Field('EVT_default_registration_status', __( 'Default Registration Status on this Event', 'event_espresso' ), FALSE, '', array() ),
131
-				'EVT_member_only'=>new EE_Boolean_Field( 'EVT_member_only', __( 'Member-Only Event Flag', 'event_espresso' ), FALSE, FALSE ),
132
-				'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __( 'Event Phone Number', 'event_espresso' ), FALSE ),
133
-				'EVT_allow_overflow'=>new EE_Boolean_Field(  'EVT_allow_overflow', __( 'Allow Overflow on Event', 'event_espresso' ), FALSE, FALSE ),
134
-				'EVT_timezone_string'=>new EE_Plain_Text_Field( 'EVT_timezone_string', __( 'Timezone (name) for Event times', 'event_espresso' ), FALSE ),
135
-				'EVT_external_URL'=>new EE_Plain_Text_Field( 'EVT_external_URL', __( 'URL of Event Page if hosted elsewhere', 'event_espresso' ), TRUE ),
136
-				'EVT_donations'=>new EE_Boolean_Field( 'EVT_donations', __( 'Accept Donations?', 'event_espresso' ), FALSE, FALSE )
124
+				'EVTM_ID'=> new EE_DB_Only_Float_Field('EVTM_ID', __('Event Meta Row ID', 'event_espresso'), FALSE),
125
+				'EVT_ID_fk'=>new EE_DB_Only_Int_Field('EVT_ID', __('Foreign key to Event ID from Event Meta table', 'event_espresso'), FALSE),
126
+				'EVT_display_desc'=>new EE_Boolean_Field('EVT_display_desc', __('Display Description Flag', 'event_espresso'), FALSE, 1),
127
+				'EVT_display_ticket_selector'=>new EE_Boolean_Field('EVT_display_ticket_selector', __('Display Ticket Selector Flag', 'event_espresso'), FALSE, 1),
128
+				'EVT_visible_on'=>new EE_Datetime_Field('EVT_visible_on', __('Event Visible Date', 'event_espresso'), TRUE, time()),
129
+				'EVT_additional_limit'=>new EE_Integer_Field('EVT_additional_limit', __('Limit of Additional Registrations on Same Transaction', 'event_espresso'), TRUE, 10),
130
+				'EVT_default_registration_status'=>new EE_Enum_Text_Field('EVT_default_registration_status', __('Default Registration Status on this Event', 'event_espresso'), FALSE, '', array()),
131
+				'EVT_member_only'=>new EE_Boolean_Field('EVT_member_only', __('Member-Only Event Flag', 'event_espresso'), FALSE, FALSE),
132
+				'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __('Event Phone Number', 'event_espresso'), FALSE),
133
+				'EVT_allow_overflow'=>new EE_Boolean_Field('EVT_allow_overflow', __('Allow Overflow on Event', 'event_espresso'), FALSE, FALSE),
134
+				'EVT_timezone_string'=>new EE_Plain_Text_Field('EVT_timezone_string', __('Timezone (name) for Event times', 'event_espresso'), FALSE),
135
+				'EVT_external_URL'=>new EE_Plain_Text_Field('EVT_external_URL', __('URL of Event Page if hosted elsewhere', 'event_espresso'), TRUE),
136
+				'EVT_donations'=>new EE_Boolean_Field('EVT_donations', __('Accept Donations?', 'event_espresso'), FALSE, FALSE)
137 137
 
138 138
 			));
139 139
 
@@ -148,19 +148,19 @@  discard block
 block discarded – undo
148 148
 			'WP_User' => new EE_Belongs_To_Relation(),
149 149
 		);
150 150
 		//this model is generally available for reading
151
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
152
-		parent::__construct( $timezone );
151
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
152
+		parent::__construct($timezone);
153 153
 
154 154
 		// add default data only AFTER the database has been populated with default data
155
-		if ( ! did_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ) ) {
155
+		if ( ! did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations')) {
156 156
 			add_action(
157 157
 				'AHEE__EE_System__perform_activations_upgrades_and_migrations',
158
-				array( $this, 'set_allowed_enum_values_for_default_registration_status' ),
158
+				array($this, 'set_allowed_enum_values_for_default_registration_status'),
159 159
 				998
160 160
 			);
161 161
 			add_action(
162 162
 				'AHEE__EE_System__perform_activations_upgrades_and_migrations',
163
-				array( $this, 'set_default_registration_status' ),
163
+				array($this, 'set_default_registration_status'),
164 164
 				999
165 165
 			);
166 166
 		} else {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 		}
170 170
 		add_action(
171 171
 			'AHEE__EE_Registration_Config__set_default_reg_STS_ID__new_default_reg_STS_ID',
172
-			array( $this, 'set_default_registration_status' )
172
+			array($this, 'set_default_registration_status')
173 173
 		);
174 174
 	}
175 175
 
@@ -178,18 +178,18 @@  discard block
 block discarded – undo
178 178
 	/**
179 179
 	 * @param string $default_reg_status
180 180
 	 */
181
-	public function set_default_registration_status( $default_reg_status = null ) {
181
+	public function set_default_registration_status($default_reg_status = null) {
182 182
 		// first make sure that self::$_default_reg_status isn't null
183
-		self::$_default_reg_status = ! empty( self::$_default_reg_status )
183
+		self::$_default_reg_status = ! empty(self::$_default_reg_status)
184 184
 			? self::$_default_reg_status
185 185
 			: EE_Registry::instance()->CFG->registration->default_STS_ID;
186 186
 		// now potentially replace with incoming value, if one exists
187
-		self::$_default_reg_status = ! empty( $default_reg_status )
187
+		self::$_default_reg_status = ! empty($default_reg_status)
188 188
 			? $default_reg_status
189 189
 			: self::$_default_reg_status;
190 190
 		/** @var EE_Enum_Text_Field $field_settings */
191
-		$field_settings = $this->field_settings_for( 'EVT_default_registration_status' );
192
-		$field_settings->set_default_value( self::$_default_reg_status );
191
+		$field_settings = $this->field_settings_for('EVT_default_registration_status');
192
+		$field_settings->set_default_value(self::$_default_reg_status);
193 193
 	}
194 194
 
195 195
 
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	public function set_allowed_enum_values_for_default_registration_status() {
202 202
 		/** @var EE_Enum_Text_Field $field_settings */
203
-		$field_settings = $this->field_settings_for( 'EVT_default_registration_status' );
204
-		$field_settings->set_allowed_enum_values( EEM_Registration::reg_status_array() );
203
+		$field_settings = $this->field_settings_for('EVT_default_registration_status');
204
+		$field_settings->set_allowed_enum_values(EEM_Registration::reg_status_array());
205 205
 	}
206 206
 
207 207
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @deprecated since 4.9.10
211 211
 	 * @param string $default_reg_status
212 212
 	 */
213
-	public static function set_default_reg_status( $default_reg_status ) {
213
+	public static function set_default_reg_status($default_reg_status) {
214 214
 		EE_Error::doing_it_wrong(
215 215
 			__METHOD__,
216 216
 			__(
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 			),
220 220
 			'4.9.10.rc.000'
221 221
 		);
222
-		EEM_Event::instance()->set_default_registration_status( $default_reg_status );
222
+		EEM_Event::instance()->set_default_registration_status($default_reg_status);
223 223
 	}
224 224
 
225 225
 
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
 	*		@return 		array
232 232
 	*/
233 233
 	public function get_all_question_groups() {
234
-		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
235
-			array( 'QSG_deleted' => FALSE ),
236
-			'order_by' => array( 'QSG_order' => 'ASC' )
234
+		return EE_Registry::instance()->load_model('Question_Group')->get_all(array(
235
+			array('QSG_deleted' => FALSE),
236
+			'order_by' => array('QSG_order' => 'ASC')
237 237
 		));
238 238
 	}
239 239
 
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
 	* 		@param		int $EVT_ID
250 250
 	*		@return 		array
251 251
 	*/
252
-	public function get_all_event_question_groups( $EVT_ID = 0 ) {
253
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
254
-			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
252
+	public function get_all_event_question_groups($EVT_ID = 0) {
253
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
254
+			EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
255 255
 			return FALSE;
256 256
 		}
257
-		return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array(
258
-			array( 'EVT_ID' => $EVT_ID )
257
+		return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array(
258
+			array('EVT_ID' => $EVT_ID)
259 259
 		));
260 260
 	}
261 261
 
@@ -271,13 +271,13 @@  discard block
 block discarded – undo
271 271
 	* 		@param		boolean	$for_primary_attendee
272 272
 	*		@return 		array
273 273
 	*/
274
-	public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) {
275
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
276
-			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
274
+	public function get_event_question_groups($EVT_ID = 0, $for_primary_attendee = TRUE) {
275
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
276
+			EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
277 277
 			return FALSE;
278 278
 		}
279
-		return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array(
280
-			array( 'EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee )
279
+		return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array(
280
+			array('EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee)
281 281
 		));
282 282
 	}
283 283
 
@@ -294,10 +294,10 @@  discard block
 block discarded – undo
294 294
 	* 		@param		EE_Registration 	$registration
295 295
 	*		@return 		array
296 296
 	*/
297
-	public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) {
297
+	public function get_question_groups_for_event($EVT_ID = 0, EE_Registration $registration) {
298 298
 
299
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
300
-			EE_Error::add_error( __( 'An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
299
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
300
+			EE_Error::add_error(__('An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
301 301
 			return FALSE;
302 302
 		}
303 303
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 			'QSG_deleted' => FALSE
308 308
 		);
309 309
 
310
-		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
310
+		return EE_Registry::instance()->load_model('Question_Group')->get_all(array(
311 311
 			$where_params,
312 312
 			'order_by' => array('QSG_order' => 'ASC')
313 313
 		));
@@ -327,16 +327,16 @@  discard block
 block discarded – undo
327 327
 	* 		@param		string		$QSG_IDs  csv list of $QSG IDs
328 328
 	*		@return 		array
329 329
 	*/
330
-	public function get_questions_in_groups( $QSG_IDs = '' ) {
330
+	public function get_questions_in_groups($QSG_IDs = '') {
331 331
 
332
-		if ( empty( $QSG_IDs )) {
333
-			EE_Error::add_error( __( 'An error occurred. No Question Group IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
332
+		if (empty($QSG_IDs)) {
333
+			EE_Error::add_error(__('An error occurred. No Question Group IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
334 334
 			return FALSE;
335 335
 		}
336 336
 
337
-		return EE_Registry::instance()->load_model( 'Question' )->get_all( array(
337
+		return EE_Registry::instance()->load_model('Question')->get_all(array(
338 338
 			array(
339
-				'Question_Group.QSG_ID' => array( 'IN', $QSG_IDs ),
339
+				'Question_Group.QSG_ID' => array('IN', $QSG_IDs),
340 340
 				'QST_deleted' => FALSE,
341 341
 				'QST_admin_only' => is_admin()
342 342
 			),
@@ -358,16 +358,16 @@  discard block
 block discarded – undo
358 358
 	* 		@param		string		$QST_IDs  csv list of $QST IDs
359 359
 	*		@return 		array
360 360
 	*/
361
-	public function get_options_for_question( $QST_IDs ) {
361
+	public function get_options_for_question($QST_IDs) {
362 362
 
363
-		if ( empty( $QST_IDs )) {
364
-			EE_Error::add_error( __( 'An error occurred. No Question IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
363
+		if (empty($QST_IDs)) {
364
+			EE_Error::add_error(__('An error occurred. No Question IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
365 365
 			return FALSE;
366 366
 		}
367 367
 
368
-		return EE_Registry::instance()->load_model( 'Question_Option' )->get_all( array(
368
+		return EE_Registry::instance()->load_model('Question_Option')->get_all(array(
369 369
 			array(
370
-				'Question.QST_ID' => array( 'IN', $QST_IDs ),
370
+				'Question.QST_ID' => array('IN', $QST_IDs),
371 371
 				'QSO_deleted' => FALSE
372 372
 			),
373 373
 			'order_by' => 'QSO_ID'
@@ -387,46 +387,46 @@  discard block
 block discarded – undo
387 387
 	 * @throws EE_Error
388 388
 	 * @return 	array
389 389
 	 */
390
-	public function assemble_array_of_groups_questions_and_options( EE_Registration $registration, $EVT_ID = 0 ) {
390
+	public function assemble_array_of_groups_questions_and_options(EE_Registration $registration, $EVT_ID = 0) {
391 391
 
392
-		if ( empty( $EVT_ID ) ) {
393
-			throw new EE_Error( __( 'An error occurred. No EVT_ID is included.  Needed to know which question groups to retrieve.', 'event_espresso' ) );
392
+		if (empty($EVT_ID)) {
393
+			throw new EE_Error(__('An error occurred. No EVT_ID is included.  Needed to know which question groups to retrieve.', 'event_espresso'));
394 394
 		}
395 395
 
396 396
 		$questions = array();
397 397
 
398 398
 		// get all question groups for event
399
-		$qgs = $this->get_question_groups_for_event( $EVT_ID, $registration );
400
-		if ( !empty( $qgs ) ) {
401
-			foreach ( $qgs as $qg ) {
399
+		$qgs = $this->get_question_groups_for_event($EVT_ID, $registration);
400
+		if ( ! empty($qgs)) {
401
+			foreach ($qgs as $qg) {
402 402
 			 	$qsts = $qg->questions();
403
-			 	$questions[ $qg->ID() ] = $qg->model_field_array();
404
-			 	$questions[ $qg->ID() ]['QSG_questions'] = array();
405
-			 	foreach ( $qsts as $qst ) {
406
-			 		if ( $qst->is_system_question() )
403
+			 	$questions[$qg->ID()] = $qg->model_field_array();
404
+			 	$questions[$qg->ID()]['QSG_questions'] = array();
405
+			 	foreach ($qsts as $qst) {
406
+			 		if ($qst->is_system_question())
407 407
 			 			continue;
408
-			 		$answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID() ) ) );
408
+			 		$answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID())));
409 409
 			 		$answer = $answer instanceof EE_Answer ? $answer : EEM_Answer::instance()->create_default_object();
410 410
 			 		$qst_name = $qstn_id = $qst->ID();
411 411
 			 		$ans_id = $answer->ID();
412
-			 		$qst_name = !empty( $ans_id ) ?  '[' . $qst_name . '][' . $ans_id . ']' : '[' . $qst_name . ']';
412
+			 		$qst_name = ! empty($ans_id) ? '['.$qst_name.']['.$ans_id.']' : '['.$qst_name.']';
413 413
 			 		$input_name = '';
414
-			 		$input_id = sanitize_key( $qst->display_text() );
414
+			 		$input_id = sanitize_key($qst->display_text());
415 415
 			 		$input_class = '';
416 416
 			 		$questions[$qg->ID()]['QSG_questions'][$qst->ID()] = $qst->model_field_array();
417
-		 			$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_name'] = 'qstn' . $input_name . $qst_name;
418
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_id'] = $input_id . '-' . $qstn_id;
419
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_class'] = $input_class;
420
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'] = array();
421
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['qst_obj'] = $qst;
422
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['ans_obj'] = $answer;
417
+		 			$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_name'] = 'qstn'.$input_name.$qst_name;
418
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_id'] = $input_id.'-'.$qstn_id;
419
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_class'] = $input_class;
420
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'] = array();
421
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['qst_obj'] = $qst;
422
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['ans_obj'] = $answer;
423 423
 					//leave responses as-is, don't convert stuff into html entities please!
424
-					$questions[ $qg->ID() ][ 'QSG_questions'][ $qst->ID() ][ 'htmlentities' ] = false;
425
-					if ( $qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN' ) {
426
-						$QSOs = $qst->options(TRUE,$answer->value());
427
-						if ( is_array( $QSOs ) ) {
428
-							foreach ( $QSOs as $QSO_ID => $QSO ) {
429
-								$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'][ $QSO_ID ] = $QSO->model_field_array();
424
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['htmlentities'] = false;
425
+					if ($qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN') {
426
+						$QSOs = $qst->options(TRUE, $answer->value());
427
+						if (is_array($QSOs)) {
428
+							foreach ($QSOs as $QSO_ID => $QSO) {
429
+								$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'][$QSO_ID] = $QSO->model_field_array();
430 430
 							}
431 431
 						}
432 432
 					}
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
 	* 		@param		$QST
451 451
 	*		@return 		string		string
452 452
 	*/
453
-	private function _generate_question_input_name( $QST ) {
453
+	private function _generate_question_input_name($QST) {
454 454
 
455
-		if ( $QST->QST_system ) {
455
+		if ($QST->QST_system) {
456 456
 			$qst_name = $QST->QST_system;
457 457
 /*			switch( $QST->QST_system ) {
458 458
 
@@ -519,36 +519,36 @@  discard block
 block discarded – undo
519 519
 	 * @param bool    $count whether to return the count or not (default FALSE)
520 520
 	 * @return array 	EE_Event objects
521 521
 	 */
522
-	public function get_active_events( $query_params, $count = FALSE ) {
523
-		if ( array_key_exists( 0, $query_params ) ) {
522
+	public function get_active_events($query_params, $count = FALSE) {
523
+		if (array_key_exists(0, $query_params)) {
524 524
 			$where_params = $query_params[0];
525
-			unset( $query_params[0] );
525
+			unset($query_params[0]);
526 526
 		} else {
527 527
 			$where_params = array();
528 528
 		}
529 529
 
530 530
 		//if we have count make sure we don't include group by
531
-		if ( $count && isset( $query_params['group_by'] ) ) {
532
-			unset( $query_params['group_by'] );
531
+		if ($count && isset($query_params['group_by'])) {
532
+			unset($query_params['group_by']);
533 533
 		}
534 534
 
535 535
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
536 536
 		$where_params['status'] = 'publish';
537 537
 		//if already have where params for DTT_EVT_start or DTT_EVT_end then append these conditions
538
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
539
-			$where_params['Datetime.DTT_EVT_start******'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
538
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
539
+			$where_params['Datetime.DTT_EVT_start******'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
540 540
 		} else {
541
-			$where_params['Datetime.DTT_EVT_start'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
541
+			$where_params['Datetime.DTT_EVT_start'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
542 542
 		}
543 543
 
544
-		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
545
-			$where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
544
+		if (isset($where_params['Datetime.DTT_EVT_end'])) {
545
+			$where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
546 546
 		} else {
547
-			$where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
547
+			$where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
548 548
 		}
549 549
 		$query_params[0] = $where_params;
550 550
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY"
551
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
551
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
552 552
 	}
553 553
 
554 554
 
@@ -563,30 +563,30 @@  discard block
 block discarded – undo
563 563
 	 * @param bool    $count whether to return the count or not (default FALSE)
564 564
 	 * @return array               EE_Event objects
565 565
 	 */
566
-	public function get_upcoming_events( $query_params, $count = FALSE ) {
567
-		if ( array_key_exists( 0, $query_params ) ) {
566
+	public function get_upcoming_events($query_params, $count = FALSE) {
567
+		if (array_key_exists(0, $query_params)) {
568 568
 			$where_params = $query_params[0];
569
-			unset( $query_params[0] );
569
+			unset($query_params[0]);
570 570
 		} else {
571 571
 			$where_params = array();
572 572
 		}
573 573
 
574 574
 		//if we have count make sure we don't include group by
575
-		if ( $count && isset( $query_params['group_by'] ) ) {
576
-			unset( $query_params['group_by'] );
575
+		if ($count && isset($query_params['group_by'])) {
576
+			unset($query_params['group_by']);
577 577
 		}
578 578
 
579 579
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
580 580
 		$where_params['status'] = 'publish';
581 581
 		//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
582
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
583
-			$where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
582
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
583
+			$where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
584 584
 		} else {
585
-			$where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
585
+			$where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
586 586
 		}
587 587
 		$query_params[0] = $where_params;
588 588
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY"
589
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
589
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
590 590
 	}
591 591
 
592 592
 
@@ -598,54 +598,54 @@  discard block
 block discarded – undo
598 598
 	 * @param bool    $count whether to return the count or not (default FALSE)
599 599
 	 * @return array 	EE_Event objects
600 600
 	 */
601
-	public function get_expired_events( $query_params, $count = FALSE ) {
601
+	public function get_expired_events($query_params, $count = FALSE) {
602 602
 
603
-		$where_params = isset( $query_params[0] ) ? $query_params[0] : array();
603
+		$where_params = isset($query_params[0]) ? $query_params[0] : array();
604 604
 
605 605
 		//if we have count make sure we don't include group by
606
-		if ( $count && isset( $query_params['group_by'] ) ) {
607
-			unset( $query_params['group_by'] );
606
+		if ($count && isset($query_params['group_by'])) {
607
+			unset($query_params['group_by']);
608 608
 		}
609 609
 
610 610
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
611
-		if ( isset( $where_params['status'] ) ) {
612
-			unset( $where_params['status'] );
611
+		if (isset($where_params['status'])) {
612
+			unset($where_params['status']);
613 613
 		}
614 614
 		$exclude_query = $query_params;
615
-		if ( isset( $exclude_query[0] ) ) {
616
-			unset( $exclude_query[0] );
615
+		if (isset($exclude_query[0])) {
616
+			unset($exclude_query[0]);
617 617
 		}
618
-		$exclude_query[0] = array( 'Datetime.DTT_EVT_end' => array( '>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) );
618
+		$exclude_query[0] = array('Datetime.DTT_EVT_end' => array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')));
619 619
 		//first get all events that have datetimes where its not expired.
620
-		$event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Event_CPT.ID' );
621
-		$event_ids = array_keys( $event_ids );
620
+		$event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Event_CPT.ID');
621
+		$event_ids = array_keys($event_ids);
622 622
 
623 623
 		//if we have any additional query_params, let's add them to the 'AND' condition
624 624
 		$and_condition = array(
625
-			'Datetime.DTT_EVT_end' => array( '<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ),
626
-			'EVT_ID' =>  array( 'NOT IN', $event_ids )
625
+			'Datetime.DTT_EVT_end' => array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')),
626
+			'EVT_ID' =>  array('NOT IN', $event_ids)
627 627
 			);
628 628
 
629
-		if ( isset( $where_params['OR'] ) ) {
629
+		if (isset($where_params['OR'])) {
630 630
 			$and_condition['OR'] = $where_params['OR'];
631
-			unset( $where_params['OR'] );
631
+			unset($where_params['OR']);
632 632
 		}
633 633
 
634
-		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
634
+		if (isset($where_params['Datetime.DTT_EVT_end'])) {
635 635
 			$and_condition['Datetime.DTT_EVT_end****'] = $where_params['Datetime.DTT_EVT_end'];
636
-			unset( $where_params['Datetime.DTT_EVT_end'] );
636
+			unset($where_params['Datetime.DTT_EVT_end']);
637 637
 		}
638 638
 
639
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
639
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
640 640
 			$and_condition['Datetime.DTT_EVT_start'] = $where_params['Datetime.DTT_EVT_start'];
641
-			unset( $where_params['Datetime.DTT_EVT_start'] );
641
+			unset($where_params['Datetime.DTT_EVT_start']);
642 642
 		}
643 643
 
644 644
 		//merge remaining $where params with the and conditions.
645
-		$where_params['AND'] = array_merge( $and_condition, $where_params );
645
+		$where_params['AND'] = array_merge($and_condition, $where_params);
646 646
 		$query_params[0] = $where_params;
647 647
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY"
648
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
648
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
649 649
 	}
650 650
 
651 651
 
@@ -656,40 +656,40 @@  discard block
 block discarded – undo
656 656
 	 * @param  boolean $count        whether to return the count or not (default FALSE)
657 657
 	 * @return EE_Event[]            array of EE_Event objects
658 658
 	 */
659
-	public function get_inactive_events( $query_params, $count = FALSE ) {
660
-		$where_params = isset( $query_params[0] ) ? $query_params[0] : array();
659
+	public function get_inactive_events($query_params, $count = FALSE) {
660
+		$where_params = isset($query_params[0]) ? $query_params[0] : array();
661 661
 
662 662
 		//let's add in specific query_params for inactive events.
663
-		if ( isset( $where_params['status'] ) ) {
664
-			unset( $where_params['status'] );
663
+		if (isset($where_params['status'])) {
664
+			unset($where_params['status']);
665 665
 		}
666 666
 
667 667
 		//if we have count make sure we don't include group by
668
-		if ( $count && isset( $query_params['group_by'] ) ) {
669
-			unset( $query_params['group_by'] );
668
+		if ($count && isset($query_params['group_by'])) {
669
+			unset($query_params['group_by']);
670 670
 		}
671 671
 
672 672
 		//if we have any additional query_params, let's add them to the 'AND' condition
673
-		$where_params['AND']['status'] = array( '!=', 'publish' );
673
+		$where_params['AND']['status'] = array('!=', 'publish');
674 674
 
675
-		if ( isset( $where_params['OR'] ) ) {
675
+		if (isset($where_params['OR'])) {
676 676
 			$where_params['AND']['OR'] = $where_params['OR'];
677
-			unset( $where_params['OR'] );
677
+			unset($where_params['OR']);
678 678
 		}
679 679
 
680
-		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
680
+		if (isset($where_params['Datetime.DTT_EVT_end'])) {
681 681
 			$where_params['AND']['Datetime.DTT_EVT_end****'] = $where_params['Datetime.DTT_EVT_end'];
682
-			unset( $where_params['Datetime.DTT_EVT_end'] );
682
+			unset($where_params['Datetime.DTT_EVT_end']);
683 683
 		}
684 684
 
685
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
685
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
686 686
 			$where_params['AND']['Datetime.DTT_EVT_start'] = $where_params['Datetime.DTT_EVT_start'];
687
-			unset( $where_params['Datetime.DTT_EVT_start'] );
687
+			unset($where_params['Datetime.DTT_EVT_start']);
688 688
 		}
689 689
 
690 690
 		$query_params[0] = $where_params;
691 691
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY"
692
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
692
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
693 693
 	}
694 694
 
695 695
 
@@ -697,13 +697,13 @@  discard block
 block discarded – undo
697 697
 	 * This is just injecting into the parent add_relationship_to so we do special handling on price relationships because we don't want to override any existing global default prices but instead insert NEW prices that get attached to the event.
698 698
 	 * See parent for param descriptions
699 699
 	 */
700
-	public function add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query = array()){
700
+	public function add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query = array()) {
701 701
 
702
-		if ( $relationName == 'Price' ) {
702
+		if ($relationName == 'Price') {
703 703
 			//let's get the PRC object for the given ID to make sure that we aren't dealing with a default
704 704
 			$prc_chk = $this->get_related_model_obj($relationName)->ensure_is_obj($other_model_id_or_obj);
705 705
 			//if EVT_ID = 0, then this is a default
706
-			if ( $prc_chk->get('EVT_ID') == 0 ) {
706
+			if ($prc_chk->get('EVT_ID') == 0) {
707 707
 				//let's set the prc_id as 0 so we force an insert on the add_relation_to carried out by relation
708 708
 				$prc_chk->set('PRC_ID', 0);
709 709
 			}
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 		}
714 714
 
715 715
 		//otherwise carry on as normal
716
-		return parent::add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query);
716
+		return parent::add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query);
717 717
 	}
718 718
 
719 719
 
Please login to merge, or discard this patch.