Completed
Branch FET-7988-evertec-needs (20e248)
by
unknown
824:36 queued 813:30
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   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	/**
210 210
 	 *        get Transaction Total
211 211
 	 * @access        public
212
-	 * @return float
212
+	 * @return boolean
213 213
 	 */
214 214
 	public function total() {
215 215
 		return $this->get( 'TXN_total' );
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	/**
221 221
 	 *        get Total Amount Paid to Date
222 222
 	 * @access        public
223
-	 * @return float
223
+	 * @return boolean
224 224
 	 */
225 225
 	public function paid() {
226 226
 		return $this->get( 'TXN_paid' );
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	/**
323 323
 	 * Gets all the attendees for this transaction (handy for use with EE_Attendee's get_registrations_for_event function
324 324
 	 * for getting attendees and how many registrations they each have for an event)
325
-	 * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT'
325
+	 * @return EE_Base_Class[] EE_Attendee[] by default, int if $output is set to 'COUNT'
326 326
 	 */
327 327
 	public function attendees() {
328 328
 		return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) );
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 	/**
568 568
 	 * Gets all the extra meta info on this payment
569 569
 	 * @param array $query_params like EEM_Base::get_all
570
-	 * @return EE_Extra_Meta
570
+	 * @return EE_Base_Class[]
571 571
 	 */
572 572
 	public function extra_meta( $query_params = array() ) {
573 573
 		return $this->get_many_related( 'Extra_Meta', $query_params );
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 
715 715
 	/**
716 716
 	 * Gets PMD_ID
717
-	 * @return int
717
+	 * @return boolean
718 718
 	 */
719 719
 	function payment_method_ID() {
720 720
 		return $this->get('PMD_ID');
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 	/**
726 726
 	 * Sets PMD_ID
727 727
 	 * @param int $PMD_ID
728
-	 * @return boolean
728
+	 * @return boolean|null
729 729
 	 */
730 730
 	function set_payment_method_ID($PMD_ID) {
731 731
 		$this->set('PMD_ID', $PMD_ID);
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  * @subpackage 	includes/classes/EE_Transaction.class.php
27 27
  * @author 				Brent Christensen
28 28
  */
29
-class EE_Transaction extends EE_Base_Class implements EEI_Transaction{
29
+class EE_Transaction extends EE_Base_Class implements EEI_Transaction {
30 30
 
31 31
 
32 32
 	/**
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @param string $timezone
36 36
 	 * @return EE_Transaction
37 37
 	 */
38
-	public static function new_instance( $props_n_values = array(), $timezone = '' ) {
39
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
40
-		return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone );
38
+	public static function new_instance($props_n_values = array(), $timezone = '') {
39
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
40
+		return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone);
41 41
 	}
42 42
 
43 43
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 * @param string $timezone
49 49
 	 * @return EE_Transaction
50 50
 	 */
51
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) {
52
-		return new self( $props_n_values, TRUE, $timezone );
51
+	public static function new_instance_from_db($props_n_values = array(), $timezone = '') {
52
+		return new self($props_n_values, TRUE, $timezone);
53 53
 	}
54 54
 
55 55
 
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 	 * @return 	void
65 65
 	 */
66 66
 	public function lock() {
67
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
68
-		$locked_transactions[ $this->ID() ] = true;
69
-		update_option( 'ee_locked_transactions', $locked_transactions );
67
+		$locked_transactions = get_option('ee_locked_transactions', array());
68
+		$locked_transactions[$this->ID()] = true;
69
+		update_option('ee_locked_transactions', $locked_transactions);
70 70
 	}
71 71
 
72 72
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @return 	void
81 81
 	 */
82 82
 	public function unlock() {
83
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
84
-		unset( $locked_transactions[ $this->ID() ] );
85
-		update_option( 'ee_locked_transactions', $locked_transactions );
83
+		$locked_transactions = get_option('ee_locked_transactions', array());
84
+		unset($locked_transactions[$this->ID()]);
85
+		update_option('ee_locked_transactions', $locked_transactions);
86 86
 	}
87 87
 
88 88
 	/**
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 * @return boolean
100 100
 	 */
101 101
 	public function is_locked() {
102
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
103
-		return isset( $locked_transactions[ $this->ID() ] ) ? true : false;
102
+		$locked_transactions = get_option('ee_locked_transactions', array());
103
+		return isset($locked_transactions[$this->ID()]) ? true : false;
104 104
 	}
105 105
 
106 106
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 * @access        public
112 112
 	 * @param        float $total total value of transaction
113 113
 	 */
114
-	public function set_total( $total = 0.00 ) {
115
-		$this->set( 'TXN_total', $total );
114
+	public function set_total($total = 0.00) {
115
+		$this->set('TXN_total', $total);
116 116
 	}
117 117
 
118 118
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	 * @access        public
124 124
 	 * @param        float $total_paid total amount paid to date (sum of all payments)
125 125
 	 */
126
-	public function set_paid( $total_paid = 0.00 ) {
127
-		$this->set( 'TXN_paid', $total_paid );
126
+	public function set_paid($total_paid = 0.00) {
127
+		$this->set('TXN_paid', $total_paid);
128 128
 	}
129 129
 
130 130
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 	 * @access        public
136 136
 	 * @param        string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set
137 137
 	 */
138
-	public function set_status( $status = '' ) {
139
-		$this->set( 'STS_ID', $status );
138
+	public function set_status($status = '') {
139
+		$this->set('STS_ID', $status);
140 140
 	}
141 141
 
142 142
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @access        public
148 148
 	 * @param        string $hash_salt required for some payment gateways
149 149
 	 */
150
-	public function set_hash_salt( $hash_salt = '' ) {
151
-		$this->set( 'TXN_hash_salt', $hash_salt );
150
+	public function set_hash_salt($hash_salt = '') {
151
+		$this->set('TXN_hash_salt', $hash_salt);
152 152
 	}
153 153
 
154 154
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 	 * Sets TXN_reg_steps array
158 158
 	 * @param array $txn_reg_steps
159 159
 	 */
160
-	function set_reg_steps( $txn_reg_steps ) {
161
-		$this->set( 'TXN_reg_steps', $txn_reg_steps );
160
+	function set_reg_steps($txn_reg_steps) {
161
+		$this->set('TXN_reg_steps', $txn_reg_steps);
162 162
 	}
163 163
 
164 164
 
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 * @return array
169 169
 	 */
170 170
 	function reg_steps() {
171
-		$TXN_reg_steps = $this->get( 'TXN_reg_steps' );
172
-		return is_array( $TXN_reg_steps ) ? $TXN_reg_steps : array();
171
+		$TXN_reg_steps = $this->get('TXN_reg_steps');
172
+		return is_array($TXN_reg_steps) ? $TXN_reg_steps : array();
173 173
 	}
174 174
 
175 175
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @return string of transaction's total cost, with currency symbol and decimal
180 180
 	 */
181 181
 	public function pretty_total() {
182
-		return $this->get_pretty( 'TXN_total' );
182
+		return $this->get_pretty('TXN_total');
183 183
 	}
184 184
 
185 185
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @return string
190 190
 	 */
191 191
 	public function pretty_paid() {
192
-		return $this->get_pretty( 'TXN_paid' );
192
+		return $this->get_pretty('TXN_paid');
193 193
 	}
194 194
 
195 195
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @return float amount remaining
202 202
 	 */
203 203
 	public function remaining() {
204
-		return (float)( $this->total() - $this->paid() );
204
+		return (float) ($this->total() - $this->paid());
205 205
 	}
206 206
 
207 207
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 * @return float
213 213
 	 */
214 214
 	public function total() {
215
-		return $this->get( 'TXN_total' );
215
+		return $this->get('TXN_total');
216 216
 	}
217 217
 
218 218
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 * @return float
224 224
 	 */
225 225
 	public function paid() {
226
-		return $this->get( 'TXN_paid' );
226
+		return $this->get('TXN_paid');
227 227
 	}
228 228
 
229 229
 
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @access        public
234 234
 	 */
235 235
 	public function get_cart_session() {
236
-		$session_data = $this->get( 'TXN_session_data' );
237
-		return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart ? $session_data[ 'cart' ] : NULL;
236
+		$session_data = $this->get('TXN_session_data');
237
+		return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart ? $session_data['cart'] : NULL;
238 238
 	}
239 239
 
240 240
 
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
 	 * @access        public
245 245
 	 */
246 246
 	public function session_data() {
247
-		$session_data = $this->get( 'TXN_session_data' );
248
-		if ( empty( $session_data ) ) {
249
-			$session_data = array( 'id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array() );
247
+		$session_data = $this->get('TXN_session_data');
248
+		if (empty($session_data)) {
249
+			$session_data = array('id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array());
250 250
 		}
251 251
 		return $session_data;
252 252
 	}
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 	 * @access        public
260 260
 	 * @param        EE_Session|array $session_data
261 261
 	 */
262
-	public function set_txn_session_data( $session_data ) {
263
-		if ( $session_data instanceof EE_Session ) {
264
-			$this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE ));
262
+	public function set_txn_session_data($session_data) {
263
+		if ($session_data instanceof EE_Session) {
264
+			$this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE));
265 265
 		} else {
266
-			$this->set( 'TXN_session_data', $session_data );
266
+			$this->set('TXN_session_data', $session_data);
267 267
 		}
268 268
 	}
269 269
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	 * @access        public
275 275
 	 */
276 276
 	public function hash_salt_() {
277
-		return $this->get( 'TXN_hash_salt' );
277
+		return $this->get('TXN_hash_salt');
278 278
 	}
279 279
 
280 280
 
@@ -293,13 +293,13 @@  discard block
 block discarded – undo
293 293
 	 * @param 	boolean 	$gmt - whether to return a unix timestamp with UTC offset applied (default) or no UTC offset applied
294 294
 	 * @return 	string | int
295 295
 	 */
296
-	public function datetime( $format = FALSE, $gmt = FALSE ) {
297
-		if ( $format ) {
298
-			return $this->get_pretty( 'TXN_timestamp' );
299
-		} else if ( $gmt ) {
300
-			return $this->get_raw( 'TXN_timestamp' );
296
+	public function datetime($format = FALSE, $gmt = FALSE) {
297
+		if ($format) {
298
+			return $this->get_pretty('TXN_timestamp');
299
+		} else if ($gmt) {
300
+			return $this->get_raw('TXN_timestamp');
301 301
 		} else {
302
-			return $this->get( 'TXN_timestamp' );
302
+			return $this->get('TXN_timestamp');
303 303
 		}
304 304
 	}
305 305
 
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 	 * @param        boolean $get_cached   TRUE to retrieve cached registrations or FALSE to pull from the db
312 312
 	 * @return EE_Registration[]
313 313
 	 */
314
-	public function registrations( $query_params = array(), $get_cached = FALSE ) {
315
-		$query_params = ( empty( $query_params ) || ! is_array( $query_params ) ) ? array( 'order_by' => array( 'Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC' ) ) : $query_params;
314
+	public function registrations($query_params = array(), $get_cached = FALSE) {
315
+		$query_params = (empty($query_params) || ! is_array($query_params)) ? array('order_by' => array('Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC')) : $query_params;
316 316
 		$query_params = $get_cached ? array() : $query_params;
317
-		return $this->get_many_related( 'Registration', $query_params );
317
+		return $this->get_many_related('Registration', $query_params);
318 318
 	}
319 319
 
320 320
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT'
326 326
 	 */
327 327
 	public function attendees() {
328
-		return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) );
328
+		return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID())));
329 329
 	}
330 330
 
331 331
 
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
 	 * @param array $query_params like EEM_Base::get_all
336 336
 	 * @return EE_Payment[]
337 337
 	 */
338
-	public function payments( $query_params = array() ) {
339
-		return $this->get_many_related( 'Payment', $query_params );
338
+	public function payments($query_params = array()) {
339
+		return $this->get_many_related('Payment', $query_params);
340 340
 	}
341 341
 
342 342
 
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
 	 * @return EE_Payment[]
347 347
 	 */
348 348
 	public function approved_payments() {
349
-		EE_Registry::instance()->load_model( 'Payment' );
350
-		return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) );
349
+		EE_Registry::instance()->load_model('Payment');
350
+		return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC')));
351 351
 	}
352 352
 
353 353
 
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 	 * @param bool $show_icons
358 358
 	 * @return string
359 359
 	 */
360
-	public function e_pretty_status( $show_icons = FALSE ) {
361
-		echo $this->pretty_status( $show_icons );
360
+	public function e_pretty_status($show_icons = FALSE) {
361
+		echo $this->pretty_status($show_icons);
362 362
 	}
363 363
 
364 364
 
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 	 * @param bool $show_icons
369 369
 	 * @return string
370 370
 	 */
371
-	public function pretty_status( $show_icons = FALSE ) {
372
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
371
+	public function pretty_status($show_icons = FALSE) {
372
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
373 373
 		$icon = '';
374
-		switch ( $this->status_ID() ) {
374
+		switch ($this->status_ID()) {
375 375
 			case EEM_Transaction::complete_status_code:
376 376
 				$icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : '';
377 377
 				break;
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 				$icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : '';
389 389
 				break;
390 390
 		}
391
-		return $icon . $status[ $this->status_ID() ];
391
+		return $icon.$status[$this->status_ID()];
392 392
 	}
393 393
 
394 394
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 * @access        public
399 399
 	 */
400 400
 	public function status_ID() {
401
-		return $this->get( 'STS_ID' );
401
+		return $this->get('STS_ID');
402 402
 	}
403 403
 
404 404
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	 * @return boolean
409 409
 	 */
410 410
 	public function is_free() {
411
-		return (float)$this->get( 'TXN_total' ) == 0 ? TRUE : FALSE;
411
+		return (float) $this->get('TXN_total') == 0 ? TRUE : FALSE;
412 412
 	}
413 413
 
414 414
 
@@ -476,12 +476,12 @@  discard block
 block discarded – undo
476 476
 	 * @access public
477 477
 	 * @return string
478 478
 	 */
479
-	public function invoice_url( $type = 'html' ) {
479
+	public function invoice_url($type = 'html') {
480 480
 		$REG = $this->primary_registration();
481
-		if ( ! $REG instanceof EE_Registration ) {
481
+		if ( ! $REG instanceof EE_Registration) {
482 482
 			return '';
483 483
 		}
484
-		return $REG->invoice_url( $type );
484
+		return $REG->invoice_url($type);
485 485
 	}
486 486
 
487 487
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	 * @return EE_Registration
492 492
 	 */
493 493
 	public function primary_registration() {
494
-		return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) );
494
+		return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
495 495
 	}
496 496
 
497 497
 
@@ -501,12 +501,12 @@  discard block
 block discarded – undo
501 501
 	 * @param string $type 'pdf' or 'html' (default is 'html')
502 502
 	 * @return string
503 503
 	 */
504
-	public function receipt_url( $type = 'html' ) {
504
+	public function receipt_url($type = 'html') {
505 505
 		$REG = $this->primary_registration();
506
-		if ( ! $REG instanceof EE_Registration ) {
506
+		if ( ! $REG instanceof EE_Registration) {
507 507
 			return '';
508 508
 		}
509
-		return $REG->receipt_url( $type );
509
+		return $REG->receipt_url($type);
510 510
 	}
511 511
 
512 512
 
@@ -531,15 +531,15 @@  discard block
 block discarded – undo
531 531
 	 * @deprecated
532 532
 	 * @return boolean
533 533
 	 */
534
-	public function update_based_on_payments(){
534
+	public function update_based_on_payments() {
535 535
 		EE_Error::doing_it_wrong(
536
-			__CLASS__ . '::' . __FUNCTION__,
537
-			sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ),
536
+			__CLASS__.'::'.__FUNCTION__,
537
+			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
538 538
 			'4.6.0'
539 539
 		);
540 540
 		/** @type EE_Transaction_Processor $transaction_processor */
541
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
542
-		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this );
541
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
542
+		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this);
543 543
 	}
544 544
 
545 545
 
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	 * @return string
549 549
 	 */
550 550
 	public function gateway_response_on_transaction() {
551
-		$payment = $this->get_first_related( 'Payment' );
551
+		$payment = $this->get_first_related('Payment');
552 552
 		return $payment instanceof EE_Payment ? $payment->gateway_response() : '';
553 553
 	}
554 554
 
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 	 * @return EE_Status
560 560
 	 */
561 561
 	public function status_obj() {
562
-		return $this->get_first_related( 'Status' );
562
+		return $this->get_first_related('Status');
563 563
 	}
564 564
 
565 565
 
@@ -569,8 +569,8 @@  discard block
 block discarded – undo
569 569
 	 * @param array $query_params like EEM_Base::get_all
570 570
 	 * @return EE_Extra_Meta
571 571
 	 */
572
-	public function extra_meta( $query_params = array() ) {
573
-		return $this->get_many_related( 'Extra_Meta', $query_params );
572
+	public function extra_meta($query_params = array()) {
573
+		return $this->get_many_related('Extra_Meta', $query_params);
574 574
 	}
575 575
 
576 576
 
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
 	 * @param EE_Registration $registration
581 581
 	 * @return EE_Base_Class the relation was added to
582 582
 	 */
583
-	public function add_registration( EE_Registration $registration ) {
584
-		return $this->_add_relation_to( $registration, 'Registration' );
583
+	public function add_registration(EE_Registration $registration) {
584
+		return $this->_add_relation_to($registration, 'Registration');
585 585
 	}
586 586
 
587 587
 
@@ -592,8 +592,8 @@  discard block
 block discarded – undo
592 592
 	 * @param int $registration_or_id
593 593
 	 * @return EE_Base_Class that was removed from being related
594 594
 	 */
595
-	public function remove_registration_with_id( $registration_or_id ) {
596
-		return $this->_remove_relation_to( $registration_or_id, 'Registration' );
595
+	public function remove_registration_with_id($registration_or_id) {
596
+		return $this->_remove_relation_to($registration_or_id, 'Registration');
597 597
 	}
598 598
 
599 599
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 	 * @return EE_Line_Item[]
604 604
 	 */
605 605
 	public function items_purchased() {
606
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) );
606
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item)));
607 607
 	}
608 608
 
609 609
 
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
 	 * @param EE_Line_Item $line_item
614 614
 	 * @return EE_Base_Class the relation was added to
615 615
 	 */
616
-	public function add_line_item( EE_Line_Item $line_item ) {
617
-		return $this->_add_relation_to( $line_item, 'Line_Item' );
616
+	public function add_line_item(EE_Line_Item $line_item) {
617
+		return $this->_add_relation_to($line_item, 'Line_Item');
618 618
 	}
619 619
 
620 620
 
@@ -624,8 +624,8 @@  discard block
 block discarded – undo
624 624
 	 * @param array $query_params
625 625
 	 * @return EE_Line_Item[]
626 626
 	 */
627
-	public function line_items( $query_params = array() ) {
628
-		return $this->get_many_related( 'Line_Item', $query_params );
627
+	public function line_items($query_params = array()) {
628
+		return $this->get_many_related('Line_Item', $query_params);
629 629
 	}
630 630
 
631 631
 
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 	 * @return EE_Line_Item[]
636 636
 	 */
637 637
 	public function tax_items() {
638
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) );
638
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax)));
639 639
 	}
640 640
 
641 641
 
@@ -646,9 +646,9 @@  discard block
 block discarded – undo
646 646
 	 * @return EE_Line_Item
647 647
 	 */
648 648
 	public function total_line_item() {
649
-		$item =  $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) );
650
-		if( ! $item ){
651
-			EE_Registry::instance()->load_helper( 'Line_Item' );
649
+		$item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total)));
650
+		if ( ! $item) {
651
+			EE_Registry::instance()->load_helper('Line_Item');
652 652
 			$item = EEH_Line_Item::create_default_total_line_item();
653 653
 		}
654 654
 		return $item;
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 */
664 664
 	public function tax_total() {
665 665
 		$tax_line_item = $this->tax_total_line_item();
666
-		if ( $tax_line_item ) {
666
+		if ($tax_line_item) {
667 667
 			return $tax_line_item->total();
668 668
 		} else {
669 669
 			return 0;
@@ -677,9 +677,9 @@  discard block
 block discarded – undo
677 677
 	 * @return EE_Line_Item
678 678
 	 */
679 679
 	public function tax_total_line_item() {
680
-		$item =  $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax_sub_total ) ) );
681
-		if( ! $item ){
682
-			EE_Registry::instance()->load_helper( 'Line_Item' );
680
+		$item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax_sub_total)));
681
+		if ( ! $item) {
682
+			EE_Registry::instance()->load_helper('Line_Item');
683 683
 			$item = EEH_Line_Item::create_default_total_line_item();
684 684
 		}
685 685
 		return $item;
@@ -691,20 +691,20 @@  discard block
 block discarded – undo
691 691
 	 *  Gets the array of billing info for the gateway and for this transaction's primary registration's attendee.
692 692
 	 * @return EE_Form_Section_Proper
693 693
 	 */
694
-	public function billing_info(){
694
+	public function billing_info() {
695 695
 		$payment_method = $this->payment_method();
696
-		if ( !$payment_method){
696
+		if ( ! $payment_method) {
697 697
 			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__);
698 698
 			return false;
699 699
 		}
700 700
 		$primary_reg = $this->primary_registration();
701
-		if ( ! $primary_reg ) {
702
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
701
+		if ( ! $primary_reg) {
702
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
703 703
 			return FALSE;
704 704
 		}
705 705
 		$attendee = $primary_reg->attendee();
706
-		if ( ! $attendee ) {
707
-			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__ );
706
+		if ( ! $attendee) {
707
+			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__);
708 708
 			return FALSE;
709 709
 		}
710 710
 		return $attendee->billing_info_for_payment_method($payment_method);
@@ -739,15 +739,15 @@  discard block
 block discarded – undo
739 739
 	 * offline ones, dont' create payments)
740 740
 	 * @return EE_Payment_Method
741 741
 	 */
742
-	function payment_method(){
742
+	function payment_method() {
743 743
 		$pm = $this->get_first_related('Payment_Method');
744
-		if( $pm instanceof EE_Payment_Method ){
744
+		if ($pm instanceof EE_Payment_Method) {
745 745
 			return $pm;
746
-		}else{
746
+		} else {
747 747
 			$last_payment = $this->last_payment();
748
-			if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){
748
+			if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) {
749 749
 				return $last_payment->payment_method();
750
-			}else{
750
+			} else {
751 751
 				return NULL;
752 752
 			}
753 753
 		}
@@ -758,15 +758,15 @@  discard block
 block discarded – undo
758 758
 	 * @return EE_Payment
759 759
 	 */
760 760
 	public function last_payment() {
761
-		return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) );
761
+		return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc')));
762 762
 	}
763 763
 
764 764
 	/**
765 765
 	 * Gets all the line items which are unrelated to tickets on this transaction
766 766
 	 * @return EE_Line_Item[]
767 767
 	 */
768
-	public function non_ticket_line_items(){
769
-		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() );
768
+	public function non_ticket_line_items() {
769
+		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID());
770 770
 	}
771 771
 
772 772
 
Please login to merge, or discard this patch.
core/db_classes/EE_WP_User.class.php 1 patch
Spacing   +9 added lines, -9 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_WP_User class
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	 * @param array $props_n_values
23 23
 	 * @return EE_WP_User|mixed
24 24
 	 */
25
-	public static function new_instance( $props_n_values = array() ) {
26
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
27
-		return $has_object ? $has_object : new self( $props_n_values );
25
+	public static function new_instance($props_n_values = array()) {
26
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
27
+		return $has_object ? $has_object : new self($props_n_values);
28 28
 	}
29 29
 
30 30
 
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 * @param array $props_n_values
34 34
 	 * @return EE_WP_User
35 35
 	 */
36
-	public static function new_instance_from_db( $props_n_values = array() ) {
37
-		return new self( $props_n_values, TRUE );
36
+	public static function new_instance_from_db($props_n_values = array()) {
37
+		return new self($props_n_values, TRUE);
38 38
 	}
39 39
 
40 40
 	/**
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @return WP_User
43 43
 	 */
44 44
 	public function wp_user_obj() {
45
-		if( ! $this->_wp_user_obj ) {
46
-			$this->_wp_user_obj = get_user_by('ID', $this->ID() );
45
+		if ( ! $this->_wp_user_obj) {
46
+			$this->_wp_user_obj = get_user_by('ID', $this->ID());
47 47
 		}
48 48
 		return $this->_wp_user_obj;
49 49
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Answer.model.php 2 patches
Braces   +7 added lines, -5 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
  *
@@ -89,7 +91,7 @@  discard block
 block discarded – undo
89 91
 			if( $answer_obj instanceof EE_Answer ){
90 92
 				if($pretty_answer){
91 93
 					$value = $answer_obj->pretty_value();
92
-				}else{
94
+				} else{
93 95
 					$value = $answer_obj->value();
94 96
 				}
95 97
 			}
@@ -129,13 +131,13 @@  discard block
 block discarded – undo
129 131
 				if($field_name == 'STA_ID'){
130 132
 					$state = $registration->attendee()->state_obj();
131 133
 					$value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'),$registration->attendee()->state_ID());
132
-				}else if($field_name == 'CNT_ISO'){
134
+				} else if($field_name == 'CNT_ISO'){
133 135
 					$country = $registration->attendee()->country_obj();
134 136
 					$value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID());
135
-				}else{
137
+				} else{
136 138
 					$value = $registration->attendee()->get_pretty($field_name);
137 139
 				}
138
-			}else{
140
+			} else{
139 141
 				$value = $registration->attendee()->get($field_name);
140 142
 			}
141 143
 		}
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -50,18 +50,18 @@  discard block
 block discarded – undo
50 50
 	/**
51 51
 	 * 	constructor
52 52
 	 */
53
-	protected function __construct( $timezone = NULL ){
54
-		$this->singular_item = __('Answer','event_espresso');
55
-		$this->plural_item = __('Answers','event_espresso');
53
+	protected function __construct($timezone = NULL) {
54
+		$this->singular_item = __('Answer', 'event_espresso');
55
+		$this->plural_item = __('Answers', 'event_espresso');
56 56
 		$this->_tables = array(
57 57
 			'Answer'=> new EE_Primary_Table('esp_answer', 'ANS_ID')
58 58
 		);
59 59
 		$this->_fields = array(
60 60
 			'Answer'=>array(
61
-				'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID','event_espresso')),
62
-				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID','event_espresso'), false, 0, 'Registration'),
63
-				'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'),
64
-				'ANS_value'=>new EE_Maybe_Serialized_Text_Field('ANS_value', __('Answer Value','event_espresso'), false, '')
61
+				'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')),
62
+				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'),
63
+				'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'),
64
+				'ANS_value'=>new EE_Maybe_Serialized_Text_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '')
65 65
 			));
66 66
 		$this->_model_relations = array(
67 67
 			'Registration'=>new EE_Belongs_To_Relation(),
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		);
70 70
 		$this->_model_chain_to_wp_user = 'Registration.Event';
71 71
 		$this->_caps_slug = 'registrations';
72
-		parent::__construct( $timezone );
72
+		parent::__construct($timezone);
73 73
 	}
74 74
 
75 75
 
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
 	 * @param boolean $pretty_answer whether to call 'pretty_value' or just 'value'
83 83
 	 * @return string
84 84
 	 */
85
-	public function get_answer_value_to_question( EE_Registration $registration, $question_id = NULL,$pretty_answer = FALSE ){
86
-		$value = $this->get_attendee_property_answer_value( $registration, $question_id, $pretty_answer );
87
-		if (  $value === NULL ){
88
-			$answer_obj = $this->get_registration_question_answer_object( $registration, $question_id, $pretty_answer );
89
-			if( $answer_obj instanceof EE_Answer ){
90
-				if($pretty_answer){
85
+	public function get_answer_value_to_question(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) {
86
+		$value = $this->get_attendee_property_answer_value($registration, $question_id, $pretty_answer);
87
+		if ($value === NULL) {
88
+			$answer_obj = $this->get_registration_question_answer_object($registration, $question_id, $pretty_answer);
89
+			if ($answer_obj instanceof EE_Answer) {
90
+				if ($pretty_answer) {
91 91
 					$value = $answer_obj->pretty_value();
92
-				}else{
92
+				} else {
93 93
 					$value = $answer_obj->value();
94 94
 				}
95 95
 			}
96 96
 		}
97
-		return apply_filters( 'FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id );
97
+		return apply_filters('FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id);
98 98
 	}
99 99
 
100 100
 
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 * @param int $question_id
106 106
 	 * @return EE_Answer
107 107
 	 */
108
-	public function get_registration_question_answer_object( EE_Registration $registration, $question_id = NULL){
109
-		$answer_obj = $this->get_one( array( array( 'QST_ID'=>$question_id, 'REG_ID'=>$registration->ID() )));
110
-		return apply_filters( 'FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id );
108
+	public function get_registration_question_answer_object(EE_Registration $registration, $question_id = NULL) {
109
+		$answer_obj = $this->get_one(array(array('QST_ID'=>$question_id, 'REG_ID'=>$registration->ID())));
110
+		return apply_filters('FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id);
111 111
 	}
112 112
 
113 113
 
@@ -119,27 +119,27 @@  discard block
 block discarded – undo
119 119
 	 * @param boolean $pretty_answer
120 120
 	 * @return string
121 121
 	 */
122
-	public function get_attendee_property_answer_value( EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE ){
122
+	public function get_attendee_property_answer_value(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) {
123 123
 		$field_name = NULL;
124 124
 		$value = NULL;
125 125
 		//only bother checking if the registration has an attendee
126
-		if( $registration->attendee() instanceof EE_Attendee && isset($this->_question_id_to_att_field_map[$question_id])){
126
+		if ($registration->attendee() instanceof EE_Attendee && isset($this->_question_id_to_att_field_map[$question_id])) {
127 127
 			$field_name = $this->_question_id_to_att_field_map[$question_id];
128
-			if($pretty_answer){
129
-				if($field_name == 'STA_ID'){
128
+			if ($pretty_answer) {
129
+				if ($field_name == 'STA_ID') {
130 130
 					$state = $registration->attendee()->state_obj();
131
-					$value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'),$registration->attendee()->state_ID());
132
-				}else if($field_name == 'CNT_ISO'){
131
+					$value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID());
132
+				} else if ($field_name == 'CNT_ISO') {
133 133
 					$country = $registration->attendee()->country_obj();
134
-					$value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID());
135
-				}else{
134
+					$value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"), $registration->attendee()->country_ID());
135
+				} else {
136 136
 					$value = $registration->attendee()->get_pretty($field_name);
137 137
 				}
138
-			}else{
138
+			} else {
139 139
 				$value = $registration->attendee()->get($field_name);
140 140
 			}
141 141
 		}
142
-		return apply_filters( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id );
142
+		return apply_filters('FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id);
143 143
 	}
144 144
 
145 145
 
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.
Spacing   +50 added lines, -50 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
  *
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
 	 * QST_ID and QST_systems that relate to attendee attributes.
20 20
 	 * NOTE: this will be deprecated if we remove system questions
21 21
 	 */
22
-	const fname_question_id=1;
23
-	const lname_question_id=2;
24
-	const email_question_id=3;
25
-	const address_question_id=4;
26
-	const address2_question_id=5;
27
-	const city_question_id=6;
28
-	const state_question_id=7;
29
-	const country_question_id=8;
30
-	const zip_question_id=9;
31
-	const phone_question_id=10;
22
+	const fname_question_id = 1;
23
+	const lname_question_id = 2;
24
+	const email_question_id = 3;
25
+	const address_question_id = 4;
26
+	const address2_question_id = 5;
27
+	const city_question_id = 6;
28
+	const state_question_id = 7;
29
+	const country_question_id = 8;
30
+	const zip_question_id = 9;
31
+	const phone_question_id = 10;
32 32
 
33 33
 
34 34
 
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 * @access protected
40 40
 	 * @param null $timezone
41 41
 	 */
42
-	protected function __construct( $timezone = NULL ) {
43
-		$this->singular_item = __('Attendee','event_espresso');
44
-		$this->plural_item = __('Attendees','event_espresso');
42
+	protected function __construct($timezone = NULL) {
43
+		$this->singular_item = __('Attendee', 'event_espresso');
44
+		$this->plural_item = __('Attendees', 'event_espresso');
45 45
 		$this->_tables = array(
46 46
 			'Attendee_CPT'=> new EE_Primary_Table('posts', 'ID'),
47 47
 			'Attendee_Meta'=>new EE_Secondary_Table('esp_attendee_meta', 'ATTM_ID', 'ATT_ID')
@@ -55,36 +55,36 @@  discard block
 block discarded – undo
55 55
 				'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, time()),
56 56
 				'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")),
57 57
 				'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, time()),
58
-				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ),
58
+				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false),
59 59
 				'ATT_parent'=>new EE_DB_Only_Int_Field('post_parent', __("Parent Attendee (unused)", "event_espresso"), false, 0),
60
-				'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'),
60
+				'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'),
61 61
 				'status' => new EE_WP_Post_Status_Field('post_status', __('Attendee Status', 'event_espresso'), false, 'publish')
62 62
 			),
63 63
 			'Attendee_Meta'=>array(
64
-				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID','event_espresso'), false),
64
+				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID', 'event_espresso'), false),
65 65
 				'ATT_ID_fk'=>new EE_DB_Only_Int_Field('ATT_ID', __("Foreign Key to Attendee in Post Table", "event_espresso"), false),
66
-				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name','event_espresso'), true, ''),
67
-				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name','event_espresso'), true, ''),
68
-				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1','event_espresso'), true, ''),
69
-				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2','event_espresso'), true, ''),
70
-				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City','event_espresso'), true, ''),
71
-				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State','event_espresso'), true,0,'State'),
72
-				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country','event_espresso'), true,'','Country'),
73
-				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code','event_espresso'), true, ''),
74
-				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address','event_espresso'), true, ''),
75
-				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone','event_espresso'), true, '')
66
+				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name', 'event_espresso'), true, ''),
67
+				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name', 'event_espresso'), true, ''),
68
+				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1', 'event_espresso'), true, ''),
69
+				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2', 'event_espresso'), true, ''),
70
+				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City', 'event_espresso'), true, ''),
71
+				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State', 'event_espresso'), true, 0, 'State'),
72
+				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country', 'event_espresso'), true, '', 'Country'),
73
+				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code', 'event_espresso'), true, ''),
74
+				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address', 'event_espresso'), true, ''),
75
+				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone', 'event_espresso'), true, '')
76 76
 			));
77 77
 		$this->_model_relations = array(
78 78
 			'Registration'=>new EE_Has_Many_Relation(),
79 79
 			'State'=>new EE_Belongs_To_Relation(),
80 80
 			'Country'=>new EE_Belongs_To_Relation(),
81
-			'Event'=>new EE_HABTM_Relation('Registration', FALSE ),
81
+			'Event'=>new EE_HABTM_Relation('Registration', FALSE),
82 82
 			'WP_User' => new EE_Belongs_To_Relation(),
83 83
 		);
84 84
 		require_once('strategies/EE_CPT_Where_Conditions.strategy.php');
85 85
 		$this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_attendees', 'ATTM_ID');
86 86
 		$this->_caps_slug = 'contacts';
87
-		parent::__construct( $timezone );
87
+		parent::__construct($timezone);
88 88
 
89 89
 	}
90 90
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	 * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID
97 97
 	 * @return EE_Attendee[]
98 98
 	 */
99
-	public function get_attendees_for_transaction( $transaction_id_or_obj ){
100
-		return $this->get_all( array( array(
99
+	public function get_attendees_for_transaction($transaction_id_or_obj) {
100
+		return $this->get_all(array(array(
101 101
 			  'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj
102 102
 		  )));
103 103
 	}
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 	*		@return 		mixed		array on success, FALSE on fail
113 113
 	 * 		@deprecated
114 114
 	*/
115
-	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
115
+	public function get_attendee_by_ID($ATT_ID = FALSE) {
116 116
 		// retrieve a particular EE_Attendee
117
-		return $this->get_one_by_ID( $ATT_ID );
117
+		return $this->get_one_by_ID($ATT_ID);
118 118
 	}
119 119
 
120 120
 
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 	* 		@param		array $where_cols_n_values
128 128
 	*		@return 		mixed		array on success, FALSE on fail
129 129
 	*/
130
-	public function get_attendee( $where_cols_n_values = array() ) {
130
+	public function get_attendee($where_cols_n_values = array()) {
131 131
 
132
-		if ( empty( $where_cols_n_values )) {
132
+		if (empty($where_cols_n_values)) {
133 133
 			return FALSE;
134 134
 		}
135
-		$attendee = $this->get_all( array($where_cols_n_values ));
136
-		if ( ! empty( $attendee )) {
137
-			return array_shift( $attendee );
135
+		$attendee = $this->get_all(array($where_cols_n_values));
136
+		if ( ! empty($attendee)) {
137
+			return array_shift($attendee);
138 138
 		} else {
139 139
 			return FALSE;
140 140
 		}
@@ -150,20 +150,20 @@  discard block
 block discarded – undo
150 150
 	 * @param array $where_cols_n_values
151 151
 	 * @return bool|mixed
152 152
 	 */
153
-	public function find_existing_attendee( $where_cols_n_values = NULL ) {
153
+	public function find_existing_attendee($where_cols_n_values = NULL) {
154 154
 		// search by combo of first and last names plus the email address
155
-		$attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email );
155
+		$attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email);
156 156
 		// no search params means attendee object already exists.
157
-		$where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys;
157
+		$where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys;
158 158
 		$valid_data = TRUE;
159 159
 		// check for required values
160
-		$valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE;
161
-		$valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE;
162
-		$valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE;
160
+		$valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE;
161
+		$valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE;
162
+		$valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE;
163 163
 
164
-		if ( $valid_data ) {
165
-			$attendee = $this->get_attendee( $where_cols_n_values );
166
-			if ( $attendee instanceof EE_Attendee ) {
164
+		if ($valid_data) {
165
+			$attendee = $this->get_attendee($where_cols_n_values);
166
+			if ($attendee instanceof EE_Attendee) {
167 167
 				return $attendee;
168 168
 			}
169 169
 		}
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
              * @param  array $ids array of EE_Registration ids
182 182
              * @return  EE_Attendee[]
183 183
              */
184
-            public function get_array_of_contacts_from_reg_ids( $ids ) {
184
+            public function get_array_of_contacts_from_reg_ids($ids) {
185 185
                 $ids = (array) $ids;
186 186
                 $_where = array(
187
-                    'Registration.REG_ID' => array( 'in', $ids )
187
+                    'Registration.REG_ID' => array('in', $ids)
188 188
                     );
189
-                return $this->get_all( array( $_where ) );
189
+                return $this->get_all(array($_where));
190 190
             }
191 191
 
192 192
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@
 block discarded – undo
256 256
 	* 		@param	int	$TXN_ID
257 257
 	* 		@param    int		$ATT_ID
258 258
 	* 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
259
-	*		@return 		mixed		array on success, FALSE on fail
259
+	*		@return 		EE_Soft_Delete_Base_Class|null		array on success, FALSE on fail
260 260
 	*/
261 261
 	public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) {
262 262
 		return $this->get_one(array(
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_CPT_Base.model.php 2 patches
Spacing   +83 added lines, -83 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_trashed - the wp post status for trashed cpts
@@ -44,42 +44,42 @@  discard block
 block discarded – undo
44 44
 	 * @param string $timezone
45 45
 	 * @throws \EE_Error
46 46
 	 */
47
-	protected function __construct( $timezone = NULL ){
47
+	protected function __construct($timezone = NULL) {
48 48
 
49 49
 		//adds a relationship to Term_Taxonomy for all these models. For this to work
50 50
 		//Term_Relationship must have a relation to each model subclassing EE_CPT_Base explicitly
51 51
 		//eg, in EEM_Term_Relationship, inside the _model_relations array, there must be an entry
52 52
 		//with key equalling the subclassing model's model name (eg 'Event' or 'Venue'), and the value
53 53
 		//must also be new EE_HABTM_Relation('Term_Relationship');
54
-		$this->_model_relations['Term_Taxonomy'] =new EE_HABTM_Relation('Term_Relationship');
54
+		$this->_model_relations['Term_Taxonomy'] = new EE_HABTM_Relation('Term_Relationship');
55 55
 		$primary_table_name = NULL;
56 56
 		//add  the common _status field to all CPT primary tables.
57
-		foreach ( $this->_tables as $alias => $table_obj ) {
58
-			if ( $table_obj instanceof EE_Primary_Table ) {
57
+		foreach ($this->_tables as $alias => $table_obj) {
58
+			if ($table_obj instanceof EE_Primary_Table) {
59 59
 				$primary_table_name = $alias;
60 60
 			}
61 61
 		}
62 62
 		//set default wp post statuses if child has not already set.
63
-		if ( ! isset( $this->_fields[$primary_table_name]['status'] )) {
63
+		if ( ! isset($this->_fields[$primary_table_name]['status'])) {
64 64
 			$this->_fields[$primary_table_name]['status'] = new EE_WP_Post_Status_Field('post_status', __("Event Status", "event_espresso"), false, 'draft');
65 65
 		}
66
-		if( ! isset( $this->_fields[$primary_table_name]['to_ping'])){
67
-			$this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __( 'To Ping', 'event_espresso' ), FALSE, '');
66
+		if ( ! isset($this->_fields[$primary_table_name]['to_ping'])) {
67
+			$this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __('To Ping', 'event_espresso'), FALSE, '');
68 68
 		}
69
-		if( ! isset( $this->_fields[$primary_table_name]['pinged'])){
70
-			$this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __( 'Pinged', 'event_espresso' ), FALSE, '');
69
+		if ( ! isset($this->_fields[$primary_table_name]['pinged'])) {
70
+			$this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __('Pinged', 'event_espresso'), FALSE, '');
71 71
 		}
72 72
 
73
-		if( ! isset( $this->_fields[$primary_table_name]['comment_status'])){
74
-			$this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso' ), FALSE, 'open');
73
+		if ( ! isset($this->_fields[$primary_table_name]['comment_status'])) {
74
+			$this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso'), FALSE, 'open');
75 75
 		}
76 76
 
77
-		if( ! isset( $this->_fields[$primary_table_name]['ping_status'])){
77
+		if ( ! isset($this->_fields[$primary_table_name]['ping_status'])) {
78 78
 			$this->_fields[$primary_table_name]['ping_status'] = new EE_Plain_Text_Field('ping_status', __('Ping Status', 'event_espresso'), FALSE, 'open');
79 79
 		}
80 80
 
81
-		if( ! isset( $this->_fields[$primary_table_name]['post_content_filtered'])){
82
-			$this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __( 'Post Content Filtered', 'event_espresso' ), FALSE, '');
81
+		if ( ! isset($this->_fields[$primary_table_name]['post_content_filtered'])) {
82
+			$this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __('Post Content Filtered', 'event_espresso'), FALSE, '');
83 83
 		}
84 84
 		parent::__construct($timezone);
85 85
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function public_event_stati() {
94 94
 		// @see wp-includes/post.php
95
-		return get_post_stati( array( 'public' => TRUE ));
95
+		return get_post_stati(array('public' => TRUE));
96 96
 	}
97 97
 
98 98
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @return string
104 104
 	 * @throws EE_Error
105 105
 	 */
106
-	public function deleted_field_name(){
106
+	public function deleted_field_name() {
107 107
 		throw new EE_Error(sprintf(__("EEM_CPT_Base should nto call deleted_field_name! It should instead use post_status_field_name", "event_espresso")));
108 108
 	}
109 109
 
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 	 * @return string
115 115
 	 * @throws EE_Error
116 116
 	 */
117
-	public function post_status_field_name(){
117
+	public function post_status_field_name() {
118 118
 		$field = $this->get_a_field_of_type('EE_WP_Post_Status_Field');
119
-		if($field){
119
+		if ($field) {
120 120
 			return $field->get_name();
121
-		}else{
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)));
121
+		} else {
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
 	}
125 125
 
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 	 * @param array $query_params like EEM_Base::get_all's $query_params
131 131
 	 * @return array like EEM_Base::get_all's $query_params
132 132
 	 */
133
-	protected function _alter_query_params_so_only_trashed_items_included($query_params){
134
-		$post_status_field_name=$this->post_status_field_name();
135
-		$query_params[0][$post_status_field_name]=self::post_status_trashed;
133
+	protected function _alter_query_params_so_only_trashed_items_included($query_params) {
134
+		$post_status_field_name = $this->post_status_field_name();
135
+		$query_params[0][$post_status_field_name] = self::post_status_trashed;
136 136
 		return $query_params;
137 137
 	}
138 138
 
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 	 * @param array $query_params
144 144
 	 * @return array
145 145
 	 */
146
-	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params){
147
-		$post_status_field_name=$this->post_status_field_name();
148
-		$query_params[0][$post_status_field_name]=array('IN',array_keys($this->get_status_array()));
146
+	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params) {
147
+		$post_status_field_name = $this->post_status_field_name();
148
+		$query_params[0][$post_status_field_name] = array('IN', array_keys($this->get_status_array()));
149 149
 		return $query_params;
150 150
 	}
151 151
 
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	 * @param array $query_params like EEM_Base::get_all
158 158
 	 * @return boolean success
159 159
 	 */
160
-	function delete_or_restore($delete=true,$query_params = array()){
161
-		$post_status_field_name=$this->post_status_field_name();
160
+	function delete_or_restore($delete = true, $query_params = array()) {
161
+		$post_status_field_name = $this->post_status_field_name();
162 162
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
163 163
 		$new_status = $delete ? self::post_status_trashed : 'draft';
164
-		if ( $this->update (array($post_status_field_name=>$new_status), $query_params )) {
164
+		if ($this->update(array($post_status_field_name=>$new_status), $query_params)) {
165 165
 			return TRUE;
166 166
 		} else {
167 167
 			return FALSE;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public function meta_table() {
180 180
 		$meta_table = $this->_get_other_tables();
181
-		$meta_table = reset( $meta_table );
181
+		$meta_table = reset($meta_table);
182 182
 		return $meta_table instanceof EE_Secondary_Table ? $meta_table->get_table_name() : NULL;
183 183
 	}
184 184
 
@@ -190,16 +190,16 @@  discard block
 block discarded – undo
190 190
 	 * @param  bool $all triggers whether we include DB_Only fields or JUST non DB_Only fields.  Defaults to false (no db only fields)
191 191
 	 * @return array
192 192
 	 */
193
-	public function get_meta_table_fields( $all = FALSE ) {
193
+	public function get_meta_table_fields($all = FALSE) {
194 194
 		$all_fields = $fields_to_return = array();
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 );
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);
198 198
 		}
199 199
 
200
-		if ( !$all ) {
201
-			foreach ( $all_fields as $name => $obj ) {
202
-				if ( $obj instanceof EE_DB_Only_Field_Base )
200
+		if ( ! $all) {
201
+			foreach ($all_fields as $name => $obj) {
202
+				if ($obj instanceof EE_DB_Only_Field_Base)
203 203
 					continue;
204 204
 				$fields_to_return[] = $name;
205 205
 			}
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 	 * @param int $parent_term_taxonomy_id
223 223
 	 * @return EE_Term_Taxonomy
224 224
 	 */
225
-	function add_event_category(EE_CPT_Base $cpt_model_object, $category_name, $category_description ='',$parent_term_taxonomy_id = null){
225
+	function add_event_category(EE_CPT_Base $cpt_model_object, $category_name, $category_description = '', $parent_term_taxonomy_id = null) {
226 226
 		//create term
227
-		require_once( EE_MODELS . 'EEM_Term.model.php');
227
+		require_once(EE_MODELS.'EEM_Term.model.php');
228 228
 		//first, check for a term by the same name or slug
229 229
 		$category_slug = sanitize_title($category_name);
230
-		$term = EEM_Term::instance()->get_one(array(array('OR'=>array('name'=>$category_name,'slug'=>$category_slug))));
231
-		if( ! $term ){
230
+		$term = EEM_Term::instance()->get_one(array(array('OR'=>array('name'=>$category_name, 'slug'=>$category_slug))));
231
+		if ( ! $term) {
232 232
 			$term = EE_Term::new_instance(array(
233 233
 				'name'=>$category_name,
234 234
 				'slug'=>$category_slug
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 			$term->save();
237 237
 		}
238 238
 		//make sure there's a term-taxonomy entry too
239
-		require_once( EE_MODELS . 'EEM_Term_Taxonomy.model.php');
240
-		$term_taxonomy = EEM_Term_Taxonomy::instance()->get_one(array(array('term_id'=>$term->ID(),'taxonomy'=>EE_Event_Category_Taxonomy)));
239
+		require_once(EE_MODELS.'EEM_Term_Taxonomy.model.php');
240
+		$term_taxonomy = EEM_Term_Taxonomy::instance()->get_one(array(array('term_id'=>$term->ID(), 'taxonomy'=>EE_Event_Category_Taxonomy)));
241 241
 		/** @var $term_taxonomy EE_Term_Taxonomy */
242
-		if( ! $term_taxonomy ){
242
+		if ( ! $term_taxonomy) {
243 243
 			$term_taxonomy = EE_Term_Taxonomy::new_instance(array(
244 244
 				'term_id'=>$term->ID(),
245 245
 				'taxonomy'=>EE_Event_Category_Taxonomy,
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 				'parent'=>$parent_term_taxonomy_id
249 249
 			));
250 250
 			$term_taxonomy->save();
251
-		}else{
251
+		} else {
252 252
 			$term_taxonomy->set_count($term_taxonomy->count() + 1);
253 253
 			$term_taxonomy->save();
254 254
 		}
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 	 * @param string $category_name name of the event category (term)
264 264
 	 * @return bool
265 265
 	 */
266
-	function remove_event_category(EE_CPT_Base $cpt_model_object_event, $category_name){
266
+	function remove_event_category(EE_CPT_Base $cpt_model_object_event, $category_name) {
267 267
 		//find the term_taxonomy by that name
268
-		$term_taxonomy = $this->get_first_related($cpt_model_object_event, 'Term_Taxonomy', array(array('Term.name'=>$category_name,'taxonomy'=>EE_Event_Category_Taxonomy)));
268
+		$term_taxonomy = $this->get_first_related($cpt_model_object_event, 'Term_Taxonomy', array(array('Term.name'=>$category_name, 'taxonomy'=>EE_Event_Category_Taxonomy)));
269 269
 		/** @var $term_taxonomy EE_Term_Taxonomy */
270
-		if( $term_taxonomy ){
270
+		if ($term_taxonomy) {
271 271
 			$term_taxonomy->set_count($term_taxonomy->count() - 1);
272 272
 			$term_taxonomy->save();
273 273
 		}
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 	 * @param string|array $attr Optional. Query string or array of attributes.
288 288
 	 * @return string HTML image element
289 289
 	 */
290
-	public function get_feature_image( $id, $size = 'thumbnail', $attr = '' ) {
291
-		return get_the_post_thumbnail( $id, $size, $attr );
290
+	public function get_feature_image($id, $size = 'thumbnail', $attr = '') {
291
+		return get_the_post_thumbnail($id, $size, $attr);
292 292
 	}
293 293
 
294 294
 
@@ -301,10 +301,10 @@  discard block
 block discarded – undo
301 301
 	 * @global array $wp_post_statuses set in wp core for storing all the post stati
302 302
 	 * @return array
303 303
 	 */
304
-	public function get_post_statuses(){
304
+	public function get_post_statuses() {
305 305
 		global $wp_post_statuses;
306 306
 		$statuses = array();
307
-		foreach($wp_post_statuses as $post_status => $args_object){
307
+		foreach ($wp_post_statuses as $post_status => $args_object) {
308 308
 			$statuses[$post_status] = $args_object->label;
309 309
 		}
310 310
 		return $statuses;
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 	public function get_status_array() {
320 320
 		$statuses = $this->get_post_statuses();
321 321
 		//first the global filter
322
-		$statuses = apply_filters( 'FHEE_EEM_CPT_Base__get_status_array', $statuses );
322
+		$statuses = apply_filters('FHEE_EEM_CPT_Base__get_status_array', $statuses);
323 323
 		//now the class specific filter
324
-		$statuses = apply_filters( 'FHEE_EEM_' . get_class($this) . '__get_status_array', $statuses );
324
+		$statuses = apply_filters('FHEE_EEM_'.get_class($this).'__get_status_array', $statuses);
325 325
 		return $statuses;
326 326
 	}
327 327
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 */
334 334
 	public function get_custom_post_statuses() {
335 335
 		$new_stati = array();
336
-		foreach ( $this->_custom_stati as $status => $props ) {
336
+		foreach ($this->_custom_stati as $status => $props) {
337 337
 			$new_stati[$status] = $props['label'];
338 338
 		}
339 339
 		return $new_stati;
@@ -349,24 +349,24 @@  discard block
 block discarded – undo
349 349
 	 * @param WP_Post|array $post
350 350
 	 * @return EE_CPT_Base
351 351
 	 */
352
-	public function instantiate_class_from_post_object_orig($post){
353
-		$post = (array)$post;
352
+	public function instantiate_class_from_post_object_orig($post) {
353
+		$post = (array) $post;
354 354
 		$has_all_necessary_fields_for_table = true;
355 355
 		//check if the post has fields on the meta table already
356
-		foreach($this->_get_other_tables() as $table_obj){
356
+		foreach ($this->_get_other_tables() as $table_obj) {
357 357
 			$fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias());
358
-			foreach($fields_for_that_table as $field_obj){
359
-				if( ! isset($post[$field_obj->get_table_column()])
360
-					&& ! isset($post[$field_obj->get_qualified_column()])){
358
+			foreach ($fields_for_that_table as $field_obj) {
359
+				if ( ! isset($post[$field_obj->get_table_column()])
360
+					&& ! isset($post[$field_obj->get_qualified_column()])) {
361 361
 					$has_all_necessary_fields_for_table = false;
362 362
 				}
363 363
 			}
364 364
 		}
365 365
 		//if we don't have all the fields we need, then just fetch the proper model from the DB
366
-		if( ! $has_all_necessary_fields_for_table){
366
+		if ( ! $has_all_necessary_fields_for_table) {
367 367
 
368 368
 			return $this->get_one_by_ID($post['ID']);
369
-		}else{
369
+		} else {
370 370
 			return $this->instantiate_class_from_array_or_object($post);
371 371
 		}
372 372
 	}
@@ -377,30 +377,30 @@  discard block
 block discarded – undo
377 377
 	 * @param null $post
378 378
 	 * @return EE_Base_Class|EE_Soft_Delete_Base_Class
379 379
 	 */
380
-	public function instantiate_class_from_post_object( $post = NULL ){
381
-		if ( empty( $post )) {
380
+	public function instantiate_class_from_post_object($post = NULL) {
381
+		if (empty($post)) {
382 382
 			global $post;
383 383
 		}
384
-		$post = (array)$post;
384
+		$post = (array) $post;
385 385
 		$tables_needing_to_be_queried = array();
386 386
 		//check if the post has fields on the meta table already
387
-		foreach($this->get_tables() as $table_obj){
387
+		foreach ($this->get_tables() as $table_obj) {
388 388
 			$fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias());
389
-			foreach($fields_for_that_table as $field_obj){
390
-				if( ! isset($post[$field_obj->get_table_column()])
391
-					&& ! isset($post[$field_obj->get_qualified_column()])){
389
+			foreach ($fields_for_that_table as $field_obj) {
390
+				if ( ! isset($post[$field_obj->get_table_column()])
391
+					&& ! isset($post[$field_obj->get_qualified_column()])) {
392 392
 					$tables_needing_to_be_queried[$table_obj->get_table_alias()] = $table_obj;
393 393
 				}
394 394
 			}
395 395
 		}
396 396
 		//if we don't have all the fields we need, then just fetch the proper model from the DB
397
-		if( $tables_needing_to_be_queried){
398
-			if(count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table){
397
+		if ($tables_needing_to_be_queried) {
398
+			if (count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table) {
399 399
 				//so we're only missing data from a secondary table. Well that's not too hard to query for
400 400
 				$table_to_query = reset($tables_needing_to_be_queried);
401
-				$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 ));
402
-				if ( ! empty( $missing_data )) {
403
-					$post = array_merge( $post, $missing_data );
401
+				$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));
402
+				if ( ! empty($missing_data)) {
403
+					$post = array_merge($post, $missing_data);
404 404
 				}
405 405
 			} else {
406 406
 				return $this->get_one_by_ID($post['ID']);
@@ -417,15 +417,15 @@  discard block
 block discarded – undo
417 417
 	 * @throws EE_Error
418 418
 	 * @return string
419 419
 	 */
420
-	public function post_type(){
420
+	public function post_type() {
421 421
 		$post_type_field = NULL;
422
-		foreach($this->field_settings(true) as $field_obj){
423
-			if($field_obj instanceof EE_WP_Post_Type_Field){
424
-				$post_type_field = $field_obj;break;
422
+		foreach ($this->field_settings(true) as $field_obj) {
423
+			if ($field_obj instanceof EE_WP_Post_Type_Field) {
424
+				$post_type_field = $field_obj; break;
425 425
 			}
426 426
 		}
427
-		if($post_type_field == NULL){
428
-			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)));
427
+		if ($post_type_field == NULL) {
428
+			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)));
429 429
 		}
430 430
 		return $post_type_field->get_default_value();
431 431
 	}
Please login to merge, or discard this patch.
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.
core/db_models/EEM_Change_Log.model.php 3 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
@@ -99,7 +100,7 @@  discard block
 block discarded – undo
99 100
 		foreach($models_this_can_attach_to as $model){
100 101
 			if( $model == 'WP_User' ){
101 102
 				$this->_model_relations[ $model ] = new EE_Belongs_To_Relation();
102
-			}elseif( $model != 'Change_Log' ) {
103
+			} elseif( $model != 'Change_Log' ) {
103 104
 				$this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
104 105
 			}
105 106
 		}
@@ -123,7 +124,7 @@  discard block
 block discarded – undo
123 124
 		if($related_model_obj instanceof EE_Base_Class){
124 125
 			$obj_id = $related_model_obj->ID();
125 126
 			$obj_type = $related_model_obj->get_model()->get_this_model_name();
126
-		}else{
127
+		} else{
127 128
 			$obj_id = NULL;
128 129
 			$obj_type = NULL;
129 130
 		}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
 	/**
167 167
 	 * Just gets the bare-bones wpdb results as an array in cases where efficiency is essential
168 168
 	 * @param array $query_params @see EEM_Base::get_all
169
-	 * @return array of arrays
169
+	 * @return stdClass[] of arrays
170 170
 	 */
171 171
 	public function get_all_efficiently($query_params){
172 172
 		return $this->_get_all_wpdb_results($query_params);
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 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_Change_Log extends EEM_Base{
28
+class EEM_Change_Log extends EEM_Base {
29 29
 
30 30
 	/**
31 31
 	 * the related object was created log type
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
 	 *	@access protected
69 69
 	 *	@return EEM_Change_Log
70 70
 	 */
71
-	protected function __construct( $timezone = null ){
71
+	protected function __construct($timezone = null) {
72 72
 		global $current_user;
73
-		$this->singular_item = __('Log','event_espresso');
74
-		$this->plural_item = __('Logs','event_espresso');
73
+		$this->singular_item = __('Log', 'event_espresso');
74
+		$this->plural_item = __('Logs', 'event_espresso');
75 75
 		$this->_tables = array(
76 76
 			'Log'=> new EE_Primary_Table('esp_log', 'LOG_ID')
77 77
 		);
78 78
 		$models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models);
79 79
 		$this->_fields = array(
80 80
 			'Log'=>array(
81
-				'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID','event_espresso')),
81
+				'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID', 'event_espresso')),
82 82
 				'LOG_time'=>new EE_Datetime_Field('LOG_time', __("Log Time", 'event_espresso'), false, current_time('timestamp')),
83
-				'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL,$models_this_can_attach_to),
83
+				'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL, $models_this_can_attach_to),
84 84
 				'OBJ_type'=>new EE_Any_Foreign_Model_Name_Field('OBJ_type', __("Object Type", 'event_espresso'), true, NULL, $models_this_can_attach_to),
85 85
 				'LOG_type'=>new EE_Enum_Text_Field('LOG_type', __("Type of log entry", "event_espresso"), false, self::type_debug,
86 86
 						array(
@@ -92,19 +92,19 @@  discard block
 block discarded – undo
92 92
 							self::type_gateway=> __("Gateway Interaction (IPN or Direct Payment)", 'event_espresso'),
93 93
 							)),
94 94
 				'LOG_message'=>new EE_Maybe_Serialized_Text_Field('LOG_message', __("Log Message (body)", 'event_espresso'), true),
95
-				'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true ),
95
+				'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true),
96 96
 
97 97
 			));
98 98
 		$this->_model_relations = array();
99
-		foreach($models_this_can_attach_to as $model){
100
-			if( $model == 'WP_User' ){
101
-				$this->_model_relations[ $model ] = new EE_Belongs_To_Relation();
102
-			}elseif( $model != 'Change_Log' ) {
99
+		foreach ($models_this_can_attach_to as $model) {
100
+			if ($model == 'WP_User') {
101
+				$this->_model_relations[$model] = new EE_Belongs_To_Relation();
102
+			}elseif ($model != 'Change_Log') {
103 103
 				$this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
104 104
 			}
105 105
 		}
106 106
 
107
-		parent::__construct( $timezone );
107
+		parent::__construct($timezone);
108 108
 	}
109 109
 
110 110
 	/**
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 	 * @param EE_Base_Class $related_model_obj
115 115
 	 * @return EE_Change_Log
116 116
 	 */
117
-	public function log($log_type,$message,$related_model_obj){
118
-		if($related_model_obj instanceof EE_Base_Class){
117
+	public function log($log_type, $message, $related_model_obj) {
118
+		if ($related_model_obj instanceof EE_Base_Class) {
119 119
 			$obj_id = $related_model_obj->ID();
120 120
 			$obj_type = $related_model_obj->get_model()->get_this_model_name();
121
-		}else{
121
+		} else {
122 122
 			$obj_id = NULL;
123 123
 			$obj_type = NULL;
124 124
 		}
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 * @throws EE_Error
143 143
 	 * @return EE_Change_Log
144 144
 	 */
145
-	public function gateway_log( $message, $related_obj_id, $related_obj_type ){
146
-		if( ! EE_Registry::instance()->is_model_name($related_obj_type)){
147
-			throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"),$related_obj_type));
145
+	public function gateway_log($message, $related_obj_id, $related_obj_type) {
146
+		if ( ! EE_Registry::instance()->is_model_name($related_obj_type)) {
147
+			throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"), $related_obj_type));
148 148
 		}
149 149
 		$log = EE_Change_Log::new_instance(array(
150 150
 				'LOG_type'=>EEM_Change_Log::type_gateway,
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @param array $query_params @see EEM_Base::get_all
164 164
 	 * @return array of arrays
165 165
 	 */
166
-	public function get_all_efficiently($query_params){
166
+	public function get_all_efficiently($query_params) {
167 167
 		return $this->_get_all_wpdb_results($query_params);
168 168
 	}
169 169
 
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
  * EEH_URL helper
4 6
  * Helper class for URL-related PHP functions
@@ -62,7 +64,7 @@  discard block
 block discarded – undo
62 64
 				isset($results['response']['code']) &&
63 65
 				$results['response']['code'] == '200'){
64 66
 			return true;
65
-		}else{
67
+		} else{
66 68
 			return false;
67 69
 		}
68 70
 	}
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
 	 * Resets the country
37 37
 	 * @return EEM_Country
38 38
 	 */
39
-	public static function reset( $timezone = NULL ){
39
+	public static function reset($timezone = NULL) {
40 40
 		self::$_active_countries = NULL;
41 41
 		self::$_all_countries = NULL;
42
-		return parent::reset( $timezone );
42
+		return parent::reset($timezone);
43 43
 	}
44 44
 
45
-	protected function __construct( $timezone = NULL ){
46
-		$this->singular_item = __('Country','event_espresso');
47
-		$this->plural_item = __('Countries','event_espresso');
45
+	protected function __construct($timezone = NULL) {
46
+		$this->singular_item = __('Country', 'event_espresso');
47
+		$this->plural_item = __('Countries', 'event_espresso');
48 48
 
49 49
 
50 50
 		$this->_tables = array(
@@ -52,21 +52,21 @@  discard block
 block discarded – undo
52 52
 		);
53 53
 		$this->_fields = array(
54 54
 			'Country'=>array(
55
-				'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists','event_espresso'), false, true),
56
-				'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code','event_espresso')),
57
-				'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code','event_espresso'), false,''),
58
-				'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
59
-				'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name','event_espresso'), false,''),
60
-				'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code','event_espresso'), false),
61
-				'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular','event_espresso'), false),
62
-				'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural','event_espresso'), false),
63
-				'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign','event_espresso'), false),
64
-				'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number','event_espresso'), false, true),
65
-				'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2),
66
-				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark','event_espresso'), false, '.'),
67
-				'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator','event_espresso'), false, ','),
68
-				'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code','event_espresso'), false, ''),
69
-				'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU','event_espresso'), false, false)
55
+				'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true),
56
+				'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code', 'event_espresso')),
57
+				'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code', 'event_espresso'), false, ''),
58
+				'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
59
+				'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name', 'event_espresso'), false, ''),
60
+				'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code', 'event_espresso'), false),
61
+				'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular', 'event_espresso'), false),
62
+				'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural', 'event_espresso'), false),
63
+				'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign', 'event_espresso'), false),
64
+				'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number', 'event_espresso'), false, true),
65
+				'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2),
66
+				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark', 'event_espresso'), false, '.'),
67
+				'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator', 'event_espresso'), false, ','),
68
+				'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code', 'event_espresso'), false, ''),
69
+				'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU', 'event_espresso'), false, false)
70 70
 			));
71 71
 		$this->_model_relations = array(
72 72
 			'Attendee'=>new EE_Has_Many_Relation(),
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 			'Venue'=>new EE_Has_Many_Relation(),
75 75
 		);
76 76
 
77
-		parent::__construct( $timezone );
77
+		parent::__construct($timezone);
78 78
 	}
79 79
 
80 80
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	*		@return 		array
88 88
 	*/
89 89
 	public function get_all_countries() {
90
-		if ( ! self::$_all_countries ) {
91
-			self::$_all_countries = $this->get_all( array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
90
+		if ( ! self::$_all_countries) {
91
+			self::$_all_countries = $this->get_all(array('order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array(0, 99999)));
92 92
 		}
93 93
 		return self::$_all_countries;
94 94
 	}
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	*		@return 		array
102 102
 	*/
103 103
 	public function get_all_active_countries() {
104
-		if ( ! self::$_active_countries ) {
105
-			self::$_active_countries =  $this->get_all( array( array( 'CNT_active' => TRUE ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
104
+		if ( ! self::$_active_countries) {
105
+			self::$_active_countries = $this->get_all(array(array('CNT_active' => TRUE), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array(0, 99999)));
106 106
 		}
107 107
 		return self::$_active_countries;
108 108
 	}
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
 	 * @param string $country_ISO
113 113
 	 * @return string
114 114
 	 */
115
-	public function get_country_name_by_ISO( $country_ISO ){
116
-		if( isset( self::$_all_countries[ $country_ISO ] ) &&
117
-				self::$_all_countries[ $country_ISO ] instanceof EE_Country ){
118
-			return self::$_all_countries[ $country_ISO ]->name();
115
+	public function get_country_name_by_ISO($country_ISO) {
116
+		if (isset(self::$_all_countries[$country_ISO]) &&
117
+				self::$_all_countries[$country_ISO] instanceof EE_Country) {
118
+			return self::$_all_countries[$country_ISO]->name();
119 119
 		}
120
-		$names = $this->get_col( array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name' );
121
-		if( is_array( $names ) && ! empty( $names ) ){
122
-			return reset( $names );
123
-		}else{
120
+		$names = $this->get_col(array(array('CNT_ISO' => $country_ISO), 'limit' => 1), 'CNT_name');
121
+		if (is_array($names) && ! empty($names)) {
122
+			return reset($names);
123
+		} else {
124 124
 			return '';
125 125
 		}
126 126
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime.model.php 4 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 
77 77
 
78 78
 	/**
79
-	*		create new blank datetime
80
-	*
81
-	* 		@access		public
82
-	*		@return 		EE_Datetime[]		array on success, FALSE on fail
83
-	*/
79
+	 *		create new blank datetime
80
+	 *
81
+	 * 		@access		public
82
+	 *		@return 		EE_Datetime[]		array on success, FALSE on fail
83
+	 */
84 84
 	public function create_new_blank_datetime() {
85 85
 		$times = array(
86 86
 				EE_Datetime::new_instance(
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
 
108 108
 
109 109
 	/**
110
-	*		get event start date from db
111
-	*
112
-	* 		@access		public
113
-	* 		@param		int 			$EVT_ID
114
-	*		@return 		EE_Datetime[]		array on success, FALSE on fail
115
-	*/
110
+	 *		get event start date from db
111
+	 *
112
+	 * 		@access		public
113
+	 * 		@param		int 			$EVT_ID
114
+	 *		@return 		EE_Datetime[]		array on success, FALSE on fail
115
+	 */
116 116
 	public function get_all_event_dates( $EVT_ID = FALSE ) {
117 117
 		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
118 118
 			return $this->create_new_blank_datetime();
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
 	}
247 247
 
248 248
 		/**
249
-	 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
250
-	 * only by start date
251
-	 * @param int $TKT_ID
252
-	 * @param bolean $include_expired
253
-	 * @param boolean $inlude_deleted
254
-	 * @param int $limit
255
-	 * @return EE_Datetime[]
256
-	 */
249
+		 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
250
+		 * only by start date
251
+		 * @param int $TKT_ID
252
+		 * @param bolean $include_expired
253
+		 * @param boolean $inlude_deleted
254
+		 * @param int $limit
255
+		 * @return EE_Datetime[]
256
+		 */
257 257
 	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
258 258
 		//sanitize TKT_ID
259 259
 		$TKT_ID =  intval( $TKT_ID );
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @public
135 135
 	 * @param  int   			$EVT_ID event id
136 136
 	 * @param bolean 			$include_expired
137
-	 * @param boolean 			$inlude_deleted
137
+	 * @param boolean 			$include_deleted
138 138
 	 * @param  int 				$limit If included then limit the count of results by
139 139
 	 *                        	the given number
140 140
 	 * @return EE_Datetime[]
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	}
182 182
 	/**
183 183
 	 *
184
-	 * @param type $EVT_ID
184
+	 * @param integer $EVT_ID
185 185
 	 * @param type $include_expired
186 186
 	 * @param type $include_deleted
187 187
 	 * @return EE_Datetime
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 * only by start date
221 221
 	 * @param int $EVT_ID
222 222
 	 * @param bolean $include_expired
223
-	 * @param boolean $inlude_deleted
223
+	 * @param boolean $include_deleted
224 224
 	 * @param int $limit
225 225
 	 * @return EE_Datetime[]
226 226
 	 */
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 * only by start date
250 250
 	 * @param int $TKT_ID
251 251
 	 * @param bolean $include_expired
252
-	 * @param boolean $inlude_deleted
252
+	 * @param boolean $include_deleted
253 253
 	 * @param int $limit
254 254
 	 * @return EE_Datetime[]
255 255
 	 */
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 
327 327
 	/**
328 328
 	 * This returns a wpdb->results array of all DTT month and years matching the incoming query params and grouped by month and year.
329
-	 * @param  array  $query_params Array of query_parms as described in the comments for EEM_Base::get_all()
330
-	 * @return wpdb results array
329
+	 * @param  array  $where_params Array of query_parms as described in the comments for EEM_Base::get_all()
330
+	 * @return stdClass[] results array
331 331
 	 */
332 332
 	public function get_dtt_months_and_years( $where_params ) {
333 333
 		$query_params[0] = $where_params;
Please login to merge, or discard this patch.
Braces   +5 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
 /**
3 5
  * Event Espresso
4 6
  *
@@ -513,7 +515,7 @@  discard block
 block discarded – undo
513 515
 
514 516
 		if($count){
515 517
 			return EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
516
-		}else{
518
+		} else{
517 519
 			return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params);
518 520
 		}
519 521
 	}
@@ -943,7 +945,7 @@  discard block
 block discarded – undo
943 945
 			'limit'=>$limit);
944 946
 		if($count){
945 947
 			return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params);
946
-		}else{
948
+		} else{
947 949
 			return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params);
948 950
 		}
949 951
 
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 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_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Datetime.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Datetime.class.php');
26 26
 
27 27
 class EEM_Datetime extends EEM_Soft_Delete_Base {
28 28
 
@@ -36,27 +36,27 @@  discard block
 block discarded – undo
36 36
 	 *		@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)
37 37
 	 *		@return void
38 38
 	 */
39
-	protected function __construct( $timezone ) {
40
-		$this->singular_item = __('Datetime','event_espresso');
41
-		$this->plural_item = __('Datetimes','event_espresso');
39
+	protected function __construct($timezone) {
40
+		$this->singular_item = __('Datetime', 'event_espresso');
41
+		$this->plural_item = __('Datetimes', 'event_espresso');
42 42
 
43 43
 		$this->_tables = array(
44 44
 			'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID')
45 45
 		);
46 46
 		$this->_fields = array(
47 47
 			'Datetime'=>array(
48
-				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')),
49
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
48
+				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')),
49
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
50 50
 				'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''),
51 51
 				'DTT_description' => new EE_Full_HTML_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''),
52
-				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, current_time('timestamp'), $timezone ),
53
-				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, current_time('timestamp'), $timezone ),
54
-				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, INF),
55
-				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ),
56
-				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false),
52
+				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, current_time('timestamp'), $timezone),
53
+				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, current_time('timestamp'), $timezone),
54
+				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, INF),
55
+				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0),
56
+				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false),
57 57
 				'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0),
58
-				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ),
59
-				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ),
58
+				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0),
59
+				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false),
60 60
 			));
61 61
 		$this->_model_relations = array(
62 62
 			'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		);
66 66
 		$this->_model_chain_to_wp_user = 'Event';
67 67
 
68
-		parent::__construct( $timezone );
68
+		parent::__construct($timezone);
69 69
 	}
70 70
 
71 71
 
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 	* 		@param		int 			$EVT_ID
109 109
 	*		@return 		EE_Datetime[]		array on success, FALSE on fail
110 110
 	*/
111
-	public function get_all_event_dates( $EVT_ID = FALSE ) {
112
-		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
111
+	public function get_all_event_dates($EVT_ID = FALSE) {
112
+		if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0
113 113
 			return $this->create_new_blank_datetime();
114 114
 		}
115
-		$results =  $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
115
+		$results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
116 116
 
117
-		if ( empty( $results ) ) {
117
+		if (empty($results)) {
118 118
 			return $this->create_new_blank_datetime();
119 119
 		}
120 120
 
@@ -135,26 +135,26 @@  discard block
 block discarded – undo
135 135
 	 *                        	the given number
136 136
 	 * @return EE_Datetime[]
137 137
 	 */
138
-	public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL  ) {
138
+	public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) {
139 139
 
140 140
 		//sanitize EVT_ID
141
-		$EVT_ID = intval( $EVT_ID );
141
+		$EVT_ID = intval($EVT_ID);
142 142
 
143 143
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
144
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
145
-		$where_params = array( 'Event.EVT_ID' => $EVT_ID );
144
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
145
+		$where_params = array('Event.EVT_ID' => $EVT_ID);
146 146
 
147
-		$query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' );
147
+		$query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none');
148 148
 
149
-		if( ! $include_expired){
150
-			$query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) );
149
+		if ( ! $include_expired) {
150
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
151 151
 		}
152
-		if( $include_deleted){
153
-			$query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE ));
152
+		if ($include_deleted) {
153
+			$query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE));
154 154
 		}
155 155
 
156
-		$result = $this->get_all( $query_params );
157
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
156
+		$result = $this->get_all($query_params);
157
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
158 158
 		return $result;
159 159
 	}
160 160
 
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 * @param int $limit
170 170
 	 * @return EE_Datetime[]
171 171
 	 */
172
-	public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = FALSE, $limit = NULL){
173
-		return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID),
172
+	public function get_datetimes_for_event_ordered_by_importance($EVT_ID = FALSE, $limit = NULL) {
173
+		return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID),
174 174
 			'limit'=>$limit,
175 175
 			'order_by'=>array('DTT_EVT_start'=>'ASC'),
176 176
 			'default_where_conditions' => 'none'));
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	 * @param type $include_deleted
183 183
 	 * @return EE_Datetime
184 184
 	 */
185
-	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){
186
-		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
187
-		if($results){
185
+	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) {
186
+		$results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
187
+		if ($results) {
188 188
 			return array_shift($results);
189
-		}else{
189
+		} else {
190 190
 			return NULL;
191 191
 		}
192 192
 	}
@@ -195,16 +195,16 @@  discard block
 block discarded – undo
195 195
 	 * @param int $EVT_ID
196 196
 	 * @return EE_Datetime
197 197
 	 */
198
-	public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){
199
-		if($try_to_exclude_expired){
200
-			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false);
201
-			if($non_expired){
198
+	public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) {
199
+		if ($try_to_exclude_expired) {
200
+			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
201
+			if ($non_expired) {
202 202
 				return $non_expired;
203 203
 			}
204 204
 		}
205
-		if($try_to_exclude_deleted){
205
+		if ($try_to_exclude_deleted) {
206 206
 			$expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
207
-			if($expired_even){
207
+			if ($expired_even) {
208 208
 				return $expired_even;
209 209
 			}
210 210
 		}
@@ -220,23 +220,23 @@  discard block
 block discarded – undo
220 220
 	 * @param int $limit
221 221
 	 * @return EE_Datetime[]
222 222
 	 */
223
-	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){
223
+	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
224 224
 		//sanitize EVT_ID
225
-		$EVT_ID = intval( $EVT_ID );
225
+		$EVT_ID = intval($EVT_ID);
226 226
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
227
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
228
-		$query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
229
-		if( ! $include_expired){
230
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
227
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
228
+		$query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
229
+		if ( ! $include_expired) {
230
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
231 231
 		}
232
-		if( $include_deleted){
233
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
232
+		if ($include_deleted) {
233
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
234 234
 		}
235
-		if($limit){
235
+		if ($limit) {
236 236
 			$query_params['limit'] = $limit;
237 237
 		}
238
-		$result = $this->get_all( $query_params );
239
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
238
+		$result = $this->get_all($query_params);
239
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
240 240
 		return $result;
241 241
 	}
242 242
 
@@ -249,23 +249,23 @@  discard block
 block discarded – undo
249 249
 	 * @param int $limit
250 250
 	 * @return EE_Datetime[]
251 251
 	 */
252
-	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
252
+	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
253 253
 		//sanitize TKT_ID
254
-		$TKT_ID =  intval( $TKT_ID );
254
+		$TKT_ID = intval($TKT_ID);
255 255
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
256
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
257
-		$query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
258
-		if( ! $include_expired){
259
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
256
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
257
+		$query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
258
+		if ( ! $include_expired) {
259
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
260 260
 		}
261
-		if( $include_deleted){
262
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
261
+		if ($include_deleted) {
262
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
263 263
 		}
264
-		if($limit){
264
+		if ($limit) {
265 265
 			$query_params['limit'] = $limit;
266 266
 		}
267
-		$result = $this->get_all( $query_params );
268
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
267
+		$result = $this->get_all($query_params);
268
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
269 269
 		return $result;
270 270
 	}
271 271
 
@@ -281,24 +281,24 @@  discard block
 block discarded – undo
281 281
 	 *                                  that number
282 282
 	 * @return EE_Datetime[]
283 283
 	 */
284
-	public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) {
284
+	public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
285 285
 		//sanitize id.
286
-		$TKT_ID =  intval( $TKT_ID );
286
+		$TKT_ID = intval($TKT_ID);
287 287
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
288
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
289
-		$where_params = array( 'Ticket.TKT_ID' => $TKT_ID );
290
-		$query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) );
291
-		if( ! $include_expired){
292
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
288
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
289
+		$where_params = array('Ticket.TKT_ID' => $TKT_ID);
290
+		$query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
291
+		if ( ! $include_expired) {
292
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
293 293
 		}
294
-		if( $include_deleted){
295
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
294
+		if ($include_deleted) {
295
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
296 296
 		}
297
-		if($limit){
297
+		if ($limit) {
298 298
 			$query_params['limit'] = $limit;
299 299
 		}
300
-		$result = $this->get_all( $query_params );
301
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
300
+		$result = $this->get_all($query_params);
301
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
302 302
 		return $result;
303 303
 	}
304 304
 
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
 	 * @param int $EVT_ID
310 310
 	 * @return EE_Datetime
311 311
 	 */
312
-	public function get_most_important_datetime_for_event($EVT_ID){
312
+	public function get_most_important_datetime_for_event($EVT_ID) {
313 313
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
314
-		if($results){
314
+		if ($results) {
315 315
 			return array_shift($results);
316
-		}else{
316
+		} else {
317 317
 			return null;
318 318
 		}
319 319
 	}
@@ -325,15 +325,15 @@  discard block
 block discarded – undo
325 325
 	 * @param  array  $query_params Array of query_parms as described in the comments for EEM_Base::get_all()
326 326
 	 * @return wpdb results array
327 327
 	 */
328
-	public function get_dtt_months_and_years( $where_params ) {
328
+	public function get_dtt_months_and_years($where_params) {
329 329
 		$query_params[0] = $where_params;
330 330
 		$query_params['group_by'] = array('dtt_year', 'dtt_month');
331
-		$query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' );
331
+		$query_params['order_by'] = array('DTT_EVT_start' => 'DESC');
332 332
 		$columns_to_select = array(
333 333
 			'dtt_year' => array('YEAR(DTT_EVT_start)', '%s'),
334 334
 			'dtt_month' => array('MONTHNAME(DTT_EVT_start)', '%s')
335 335
 			);
336
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
336
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
337 337
 	}
338 338
 
339 339
 	/**
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 	 * for the tickets for each datetime)
342 342
 	 * @param EE_Datetime[] $datetimes
343 343
 	 */
344
-	public function update_sold($datetimes){
345
-		foreach($datetimes as $datetime){
344
+	public function update_sold($datetimes) {
345
+		foreach ($datetimes as $datetime) {
346 346
 			$datetime->update_sold();
347 347
 		}
348 348
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Event_Message_Template.model.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@
 block discarded – undo
7 7
  */
8 8
  if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
9 9
  /**
10
- *	EEM_Event_Message_Template
11
- *	Model for relation table between EEM_Message_Template_Group and EEM_Event
12
- *
13
- * @package		Event Espresso
14
- * @subpackage 	models
15
- * @since 			4.3.0
16
- * @author			 Darren Ethier
17
- *
18
- * ------------------------------------------------------------------------
19
- */
10
+  *	EEM_Event_Message_Template
11
+  *	Model for relation table between EEM_Message_Template_Group and EEM_Event
12
+  *
13
+  * @package		Event Espresso
14
+  * @subpackage 	models
15
+  * @since 			4.3.0
16
+  * @author			 Darren Ethier
17
+  *
18
+  * ------------------------------------------------------------------------
19
+  */
20 20
 require_once( EE_MODELS . 'EEM_Base.model.php' );
21 21
 
22 22
 class EEM_Event_Message_Template extends EEM_Base {
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@  discard block
 block discarded – undo
5 5
  * @subpackage 	models
6 6
  * @since 			4.3.0
7 7
  */
8
- if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+ if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+ 	exit('No direct script access allowed');
10
+ }
9 11
  /**
10 12
  *	EEM_Event_Message_Template
11 13
  *	Model for relation table between EEM_Message_Template_Group and EEM_Event
@@ -82,14 +84,17 @@  discard block
 block discarded – undo
82 84
 	 * @return int 		       How many rows were deleted.
83 85
 	 */
84 86
 	public function delete_event_group_relations( $GRP_IDs = array(), $EVT_IDs = array() ) {
85
-		if ( empty( $GRP_IDs ) && empty( $EVT_IDs ) )
86
-			throw new EE_Error( sprintf( __('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso' ), __METHOD__ ) );
87
+		if ( empty( $GRP_IDs ) && empty( $EVT_IDs ) ) {
88
+					throw new EE_Error( sprintf( __('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso' ), __METHOD__ ) );
89
+		}
87 90
 
88
-		if ( !empty( $GRP_IDs ) )
89
-			$where['GRP_ID'] = array( 'IN', (array) $GRP_IDs );
91
+		if ( !empty( $GRP_IDs ) ) {
92
+					$where['GRP_ID'] = array( 'IN', (array) $GRP_IDs );
93
+		}
90 94
 
91
-		if ( !empty( $EVT_IDs ) )
92
-			$where['EVT_ID'] = array( 'IN', (array) $EVT_IDs );
95
+		if ( !empty( $EVT_IDs ) ) {
96
+					$where['EVT_ID'] = array( 'IN', (array) $EVT_IDs );
97
+		}
93 98
 
94 99
 		return $this->delete( array( $where ), FALSE );
95 100
 	}
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * ------------------------------------------------------------------------
19 19
  */
20
-require_once( EE_MODELS . 'EEM_Base.model.php' );
20
+require_once(EE_MODELS.'EEM_Base.model.php');
21 21
 
22 22
 class EEM_Event_Message_Template extends EEM_Base {
23 23
 
@@ -30,25 +30,25 @@  discard block
 block discarded – undo
30 30
 	 * @access private
31 31
 	 * @return void
32 32
 	 */
33
-	protected function __construct( $timezone = NULL ) {
34
-		$this->singlular_item = __('Event Message Template','event_espresso');
35
-		$this->plural_item = __('Event Message Templates','event_espresso');
33
+	protected function __construct($timezone = NULL) {
34
+		$this->singlular_item = __('Event Message Template', 'event_espresso');
35
+		$this->plural_item = __('Event Message Templates', 'event_espresso');
36 36
 
37 37
 		$this->_tables = array(
38 38
 			'Event_Message_Template'=> new EE_Primary_Table('esp_event_message_template', 'EMT_ID')
39 39
 		);
40 40
 		$this->_fields = array(
41 41
 			'Event_Message_Template'=>array(
42
-				'EMT_ID'=>new EE_Primary_Key_Int_Field('EMT_ID', __('Event Message Template ID','event_espresso')),
43
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('The ID to the Event','event_espresso'), false, 0, 'Event' ),
44
-				'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('The ID to the Message Template Group','event_espresso'), false, 0, 'Message_Template_Group' )
42
+				'EMT_ID'=>new EE_Primary_Key_Int_Field('EMT_ID', __('Event Message Template ID', 'event_espresso')),
43
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('The ID to the Event', 'event_espresso'), false, 0, 'Event'),
44
+				'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('The ID to the Message Template Group', 'event_espresso'), false, 0, 'Message_Template_Group')
45 45
 			));
46 46
 		$this->_model_relations = array(
47 47
 			'Event'=>new EE_Belongs_To_Relation(),
48 48
 			'Message_Template_Group'=>new EE_Belongs_To_Relation()
49 49
 		);
50 50
 
51
-		parent::__construct( $timezone );
51
+		parent::__construct($timezone);
52 52
 	}
53 53
 
54 54
 
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	 * @param  int    $GRP_ID The MTP group we want attached events for.
63 63
 	 * @return  array               An array of event ids.
64 64
 	 */
65
-	public function get_attached_event_ids( $GRP_ID ) {
66
-		$event_ids = $this->_get_all_wpdb_results( array( array( 'GRP_ID' => $GRP_ID ) ), ARRAY_N, 'EVT_ID' );
67
-		$event_ids = call_user_func_array( 'array_merge', $event_ids );
65
+	public function get_attached_event_ids($GRP_ID) {
66
+		$event_ids = $this->_get_all_wpdb_results(array(array('GRP_ID' => $GRP_ID)), ARRAY_N, 'EVT_ID');
67
+		$event_ids = call_user_func_array('array_merge', $event_ids);
68 68
 		return $event_ids;
69 69
 	}
70 70
 
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
 	 *                         	       GRPIDs.
78 78
 	 * @return int 		       How many rows were deleted.
79 79
 	 */
80
-	public function delete_event_group_relations( $GRP_IDs = array(), $EVT_IDs = array() ) {
81
-		if ( empty( $GRP_IDs ) && empty( $EVT_IDs ) )
82
-			throw new EE_Error( sprintf( __('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso' ), __METHOD__ ) );
80
+	public function delete_event_group_relations($GRP_IDs = array(), $EVT_IDs = array()) {
81
+		if (empty($GRP_IDs) && empty($EVT_IDs))
82
+			throw new EE_Error(sprintf(__('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso'), __METHOD__));
83 83
 
84
-		if ( !empty( $GRP_IDs ) )
85
-			$where['GRP_ID'] = array( 'IN', (array) $GRP_IDs );
84
+		if ( ! empty($GRP_IDs))
85
+			$where['GRP_ID'] = array('IN', (array) $GRP_IDs);
86 86
 
87
-		if ( !empty( $EVT_IDs ) )
88
-			$where['EVT_ID'] = array( 'IN', (array) $EVT_IDs );
87
+		if ( ! empty($EVT_IDs))
88
+			$where['EVT_ID'] = array('IN', (array) $EVT_IDs);
89 89
 
90
-		return $this->delete( array( $where ), FALSE );
90
+		return $this->delete(array($where), FALSE);
91 91
 	}
92 92
 
93 93
 } //end class EEM_Event_Message_Template
Please login to merge, or discard this patch.