Completed
Branch FET-7988-evertec-needs (20e248)
by
unknown
1119:58 queued 1106:57
created
core/EE_Payment_Processor.core.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@
 block discarded – undo
13 13
  */
14 14
 class EE_Payment_Processor extends EE_Processor_Base {
15 15
 	/**
16
-     * 	@var EE_Payment_Processor $_instance
16
+	 * 	@var EE_Payment_Processor $_instance
17 17
 	 * 	@access 	private
18
-     */
18
+	 */
19 19
 	private static $_instance = NULL;
20 20
 
21 21
 
Please login to merge, or discard this patch.
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 if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 /**
4 4
  *
5 5
  * EE_Payment_Processor
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function instance() {
29 29
 		// check if class object is instantiated
30
-		if ( ! self::$_instance instanceof EE_Payment_Processor ) {
30
+		if ( ! self::$_instance instanceof EE_Payment_Processor) {
31 31
 			self::$_instance = new self();
32 32
 		}
33 33
 		return self::$_instance;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *@return EE_Payment_Processor
43 43
 	 */
44 44
 	private function __construct() {
45
-		do_action( 'AHEE__EE_Payment_Processor__construct' );
45
+		do_action('AHEE__EE_Payment_Processor__construct');
46 46
 	}
47 47
 
48 48
 
@@ -60,32 +60,32 @@  discard block
 block discarded – undo
60 60
 	 * @param boolean              				$update_txn  	whether or not to call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()
61 61
 	 * @return EE_Payment | NULL
62 62
 	 */
63
-	public function process_payment( EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE ) {
63
+	public function process_payment(EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE) {
64 64
 		// verify payment method
65
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE );
65
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE);
66 66
 		// verify transaction
67
-		EEM_Transaction::instance()->ensure_is_obj( $transaction );
68
-		$transaction->set_payment_method_ID( $payment_method->ID() );
67
+		EEM_Transaction::instance()->ensure_is_obj($transaction);
68
+		$transaction->set_payment_method_ID($payment_method->ID());
69 69
 		// verify payment method type
70
-		if ( $payment_method->type_obj() instanceof EE_PMT_Base ){
70
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
71 71
 			$payment = $payment_method->type_obj()->process_payment(
72 72
 				$transaction,
73
-				min( $amount, $transaction->remaining() ),//make sure we don't overcharge
73
+				min($amount, $transaction->remaining()), //make sure we don't overcharge
74 74
 				$billing_form,
75 75
 				$return_url,
76
-				add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
76
+				add_query_arg(array('ee_cancel_payment' => true), $return_url),
77 77
 				$method,
78 78
 				$by_admin
79 79
 			);
80 80
 			//offline gateways DON'T return a payment object, so check it
81
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
81
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
82 82
 			return $payment;
83 83
 		} else {
84 84
 			EE_Error::add_error(
85 85
 				sprintf(
86
-					__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
86
+					__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
87 87
 					'<br/>',
88
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
88
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
89 89
 				), __FILE__, __FUNCTION__, __LINE__
90 90
 			);
91 91
 			return NULL;
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
 	 * @throws EE_Error
102 102
 	 * @return string
103 103
 	 */
104
-	public function get_ipn_url_for_payment_method( $transaction, $payment_method ){
104
+	public function get_ipn_url_for_payment_method($transaction, $payment_method) {
105 105
 		/** @type EE_Transaction $transaction */
106
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
106
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
107 107
 		$primary_reg = $transaction->primary_registration();
108
-		if( ! $primary_reg instanceof EE_Registration ){
109
-			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"),$transaction->ID()));
108
+		if ( ! $primary_reg instanceof EE_Registration) {
109
+			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"), $transaction->ID()));
110 110
 		}
111
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true);
111
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true);
112 112
 		$url = add_query_arg(
113 113
 			array(
114 114
 				'e_reg_url_link'=>$primary_reg->reg_url_link(),
@@ -134,80 +134,80 @@  discard block
 block discarded – undo
134 134
 	 * @throws Exception
135 135
 	 * @return EE_Payment
136 136
 	 */
137
-	public function process_ipn( $_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true ){
138
-		EE_Registry::instance()->load_model( 'Change_Log' );
139
-		EE_Processor_Base::set_IPN( $separate_IPN_request );
140
-		if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){
141
-			$obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) );
142
-		}elseif( $payment_method instanceof EE_Payment ){
137
+	public function process_ipn($_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true) {
138
+		EE_Registry::instance()->load_model('Change_Log');
139
+		EE_Processor_Base::set_IPN($separate_IPN_request);
140
+		if ($transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method) {
141
+			$obj_for_log = EEM_Payment::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), 'order_by' => array('PAY_timestamp' => 'desc')));
142
+		}elseif ($payment_method instanceof EE_Payment) {
143 143
 			$obj_for_log = $payment_method;
144
-		}elseif( $transaction instanceof EE_Transaction ){
144
+		}elseif ($transaction instanceof EE_Transaction) {
145 145
 			$obj_for_log = $transaction;
146
-		}else{
146
+		} else {
147 147
 			$obj_for_log = null;
148 148
 		}
149 149
 		$log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log);
150
-		try{
150
+		try {
151 151
 			/**
152 152
 			 * @var EE_Payment $payment
153 153
 			 */
154 154
 			$payment = NULL;
155
-			if($transaction && $payment_method){
155
+			if ($transaction && $payment_method) {
156 156
 				/** @type EE_Transaction $transaction */
157 157
 				$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
158 158
 				/** @type EE_Payment_Method $payment_method */
159 159
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
160
-				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
161
-						$payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction );
160
+				if ($payment_method->type_obj() instanceof EE_PMT_Base) {
161
+						$payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
162 162
 						$log->set_object($payment);
163 163
 				} else {
164 164
 					// not a payment
165 165
 					EE_Error::add_error(
166 166
 						sprintf(
167
-							__( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ),
167
+							__('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'),
168 168
 							'<br/>',
169
-							EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
169
+							EE_Registry::instance()->CFG->organization->get_pretty('email')
170 170
 						),
171 171
 						__FILE__, __FUNCTION__, __LINE__
172 172
 					);
173 173
 				}
174
-			}else{
174
+			} else {
175 175
 				//that's actually pretty ok. The IPN just wasn't able
176 176
 				//to identify which transaction or payment method this was for
177 177
 				// give all active payment methods a chance to claim it
178 178
 				$active_pms = EEM_Payment_Method::instance()->get_all_active();
179
-				foreach( $active_pms as $payment_method ){
180
-					try{
181
-						$payment = $payment_method->type_obj()->handle_unclaimed_ipn( $_req_data );
179
+				foreach ($active_pms as $payment_method) {
180
+					try {
181
+						$payment = $payment_method->type_obj()->handle_unclaimed_ipn($_req_data);
182 182
 						EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment);
183 183
 						break;
184
-					} catch( EE_Error $e ) {
184
+					} catch (EE_Error $e) {
185 185
 						//that's fine- it apparently couldn't handle the IPN
186 186
 					}
187 187
 				}
188 188
 
189 189
 			}
190 190
 // 			EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method);
191
-			if( $payment instanceof EE_Payment){
191
+			if ($payment instanceof EE_Payment) {
192 192
 				$payment->save();
193 193
 				//  update the TXN
194
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
195
-			}else{
194
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request);
195
+			} else {
196 196
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
197
-				if($payment_method){
197
+				if ($payment_method) {
198 198
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
199
-				}elseif($transaction){
199
+				}elseif ($transaction) {
200 200
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
201 201
 				}
202 202
 			}
203 203
 			return $payment;
204 204
 
205
-		} catch( EE_Error $e ) {
205
+		} catch (EE_Error $e) {
206 206
 			do_action(
207 207
 				'AHEE__log', __FILE__, __FUNCTION__, sprintf(
208 208
 					"Error occurred while receiving IPN. Transaction: %s, req data: %s. The error was '%s'",
209
-					print_r( $transaction, TRUE ),
210
-					print_r( $_req_data, TRUE ),
209
+					print_r($transaction, TRUE),
210
+					print_r($_req_data, TRUE),
211 211
 					$e->getMessage()
212 212
 				)
213 213
 			);
@@ -231,13 +231,13 @@  discard block
 block discarded – undo
231 231
 	 * @throws \EE_Error
232 232
 	 * @return EE_Payment
233 233
 	 */
234
-	public function finalize_payment_for( $transaction, $update_txn = TRUE ){
234
+	public function finalize_payment_for($transaction, $update_txn = TRUE) {
235 235
 		/** @var $transaction EE_Transaction */
236
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
236
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
237 237
 		$last_payment_method = $transaction->payment_method();
238
-		if ( $last_payment_method instanceof EE_Payment_Method ) {
239
-			$payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction );
240
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
238
+		if ($last_payment_method instanceof EE_Payment_Method) {
239
+			$payment = $last_payment_method->type_obj()->finalize_payment_for($transaction);
240
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
241 241
 			return $payment;
242 242
 		} else {
243 243
 			return NULL;
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
 	 * @internal param float $amount
255 255
 	 * @return EE_Payment
256 256
 	 */
257
-	public function process_refund( $payment_method, $payment_to_refund, $refund_info = array() ){
257
+	public function process_refund($payment_method, $payment_to_refund, $refund_info = array()) {
258 258
 		/** @type EE_Payment_Method $payment_method */
259 259
 		$payment_method = EEM_Payment_Method::instance()->ensure_is_ID($payment_method);
260
-		if ( $payment_method->type_obj()->supports_sending_refunds() ) {
261
-			$payment_method->do_direct_refund( $payment_to_refund,$refund_info );
262
-			$this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund );
260
+		if ($payment_method->type_obj()->supports_sending_refunds()) {
261
+			$payment_method->do_direct_refund($payment_to_refund, $refund_info);
262
+			$this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund);
263 263
 		}
264 264
 		return $payment_to_refund;
265 265
 	}
@@ -295,12 +295,12 @@  discard block
 block discarded – undo
295 295
 	 *                        TXN is locked before updating
296 296
 	 * @throws \EE_Error
297 297
 	 */
298
-	public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){
298
+	public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) {
299 299
 		$do_action = FALSE;
300 300
 		/** @type EE_Transaction $transaction */
301
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
301
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
302 302
 		// can we freely update the TXN at this moment?
303
-		if ( $IPN && $transaction->is_locked() ) {
303
+		if ($IPN && $transaction->is_locked()) {
304 304
 			// don't update the transaction at this exact moment
305 305
 			// because the TXN is active in another request
306 306
 			EE_Cron_Tasks::schedule_update_transaction_with_payment(
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
 			);
311 311
 		} else {
312 312
 			// verify payment
313
-			if ( $payment instanceof EE_Payment ) {
314
-				if( $payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base ){
315
-					$payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment );
313
+			if ($payment instanceof EE_Payment) {
314
+				if ($payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base) {
315
+					$payment->payment_method()->type_obj()->update_txn_based_on_payment($payment);
316 316
 				}
317 317
 				// we need to save this payment in order for transaction to be updated correctly
318 318
 				// because it queries the DB to find the total amount paid, and saving puts the payment into the DB
@@ -331,23 +331,23 @@  discard block
 block discarded – undo
331 331
 						'PMD_ID' 				=> $transaction->payment_method_ID()
332 332
 					)
333 333
 				);
334
-				$transaction->set_status( EEM_Transaction::incomplete_status_code );
334
+				$transaction->set_status(EEM_Transaction::incomplete_status_code);
335 335
 				// send out notifications
336
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
336
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
337 337
 				$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made';
338 338
 			}
339
-			if ( $payment->status() !== EEM_Payment::status_id_failed ) {
339
+			if ($payment->status() !== EEM_Payment::status_id_failed) {
340 340
 				/** @type EE_Transaction_Payments $transaction_payments */
341
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
341
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
342 342
 				// set new value for total paid
343
-				$transaction_payments->calculate_total_payments_and_update_status( $transaction );
343
+				$transaction_payments->calculate_total_payments_and_update_status($transaction);
344 344
 				// call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ???
345
-				if ( $update_txn ) {
346
-					$this->_post_payment_processing( $transaction, $payment, $IPN );
345
+				if ($update_txn) {
346
+					$this->_post_payment_processing($transaction, $payment, $IPN);
347 347
 				}
348 348
 				// and set a hook point for others to use?
349
-				if ( $do_action ) {
350
-					do_action( $do_action, $transaction, $payment );
349
+				if ($do_action) {
350
+					do_action($do_action, $transaction, $payment);
351 351
 				}
352 352
 			}
353 353
 		}
@@ -366,40 +366,40 @@  discard block
 block discarded – undo
366 366
 	 * @param EE_Payment     $payment
367 367
 	 * @param bool           $IPN
368 368
 	 */
369
-	protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) {
369
+	protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) {
370 370
 		/** @type EE_Transaction_Processor $transaction_processor */
371
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
371
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
372 372
 		// is the Payment Options Reg Step completed ?
373
-		$payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' );
373
+		$payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options');
374 374
 		// if the Payment Options Reg Step is completed...
375 375
 		$revisit = $payment_options_step_completed !== false ? true : false;
376 376
 		// then this is kinda sorta a revisit with regards to payments at least
377
-		$transaction_processor->set_revisit( $revisit );
377
+		$transaction_processor->set_revisit($revisit);
378 378
 		// if this is an IPN, let's consider the Payment Options Reg Step completed if not already
379 379
 		if (
380 380
 			$IPN &&
381 381
 			$payment_options_step_completed !== true &&
382
-			( $payment->is_approved() || $payment->is_pending() )
382
+			($payment->is_approved() || $payment->is_pending())
383 383
 		) {
384
-			$transaction_processor->set_reg_step_completed( $transaction, 'payment_options' );
384
+			$transaction_processor->set_reg_step_completed($transaction, 'payment_options');
385 385
 		}
386 386
 		// DEBUG LOG
387 387
 		//$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction );
388 388
 		/** @type EE_Transaction_Payments $transaction_payments */
389
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
389
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
390 390
 		// maybe update status, but don't save transaction just yet
391
-		$transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false );
391
+		$transaction_payments->update_transaction_status_based_on_total_paid($transaction, false);
392 392
 		//check if enough Reg Steps have been completed to warrant finalizing the TXN
393
-		$finalized = $transaction_processor->all_reg_steps_completed_except_final_step( $transaction );
393
+		$finalized = $transaction_processor->all_reg_steps_completed_except_final_step($transaction);
394 394
 		//  if this is an IPN and the final step has not been initiated
395
-		if ( $IPN && $finalized === false ) {
395
+		if ($IPN && $finalized === false) {
396 396
 			// and if it hasn't already been set as being started...
397
-			$finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' );
397
+			$finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration');
398 398
 		}
399 399
 		// because the above will return false if the final step was not fully completed, we need to check again...
400
-		if ( $IPN && $finalized ) {
400
+		if ($IPN && $finalized) {
401 401
 			// and if we are all good to go, then send out notifications
402
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
402
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
403 403
 			// DEBUG LOG
404 404
 			//$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction );
405 405
 		}
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		//	)
420 420
 		//);
421 421
 		//ok, now process the transaction according to the payment
422
-		$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment );
422
+		$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment);
423 423
 	}
424 424
 
425 425
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 		EE_Processor_Base::set_IPN( $separate_IPN_request );
140 140
 		if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){
141 141
 			$obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) );
142
-		}elseif( $payment_method instanceof EE_Payment ){
142
+		} elseif( $payment_method instanceof EE_Payment ){
143 143
 			$obj_for_log = $payment_method;
144
-		}elseif( $transaction instanceof EE_Transaction ){
144
+		} elseif( $transaction instanceof EE_Transaction ){
145 145
 			$obj_for_log = $transaction;
146
-		}else{
146
+		} else{
147 147
 			$obj_for_log = null;
148 148
 		}
149 149
 		$log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log);
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 						__FILE__, __FUNCTION__, __LINE__
172 172
 					);
173 173
 				}
174
-			}else{
174
+			} else{
175 175
 				//that's actually pretty ok. The IPN just wasn't able
176 176
 				//to identify which transaction or payment method this was for
177 177
 				// give all active payment methods a chance to claim it
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 				$payment->save();
193 193
 				//  update the TXN
194 194
 				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
195
-			}else{
195
+			} else{
196 196
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
197 197
 				if($payment_method){
198 198
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
199
-				}elseif($transaction){
199
+				} elseif($transaction){
200 200
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
201 201
 				}
202 202
 			}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_Data_Migration_Script_Base.core.php 2 patches
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 					$records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated);
308 308
 					$num_records_actually_migrated += $records_migrated_during_stage;
309 309
 					$records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage;
310
-				}catch(Exception $e){
310
+				} catch(Exception $e){
311 311
 					//yes if we catch an exception here, we consider that migration stage borked.
312 312
 					$stage->set_status(EE_Data_Migration_Manager::status_fatal_error);
313 313
 					$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 			//this migration script apparently has NO stages... which is super weird, but whatever
334 334
 			$this->set_completed();
335 335
 			$this->_maybe_do_schema_changes(false);
336
-		}else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
336
+		} else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
337 337
 			//apparently we're done, because we couldn't migrate the number we intended to
338 338
 			$this->set_completed();
339 339
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
340 340
 			//do schema changes for after the migration now
341 341
 			//first double-check we haven't already done this
342 342
 			$this->_maybe_do_schema_changes(false);
343
-		}else{
343
+		} else{
344 344
 			//update feedback message, keeping in mind that we show them with the most recent at the top
345 345
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
346 346
 		}
@@ -379,12 +379,12 @@  discard block
 block discarded – undo
379 379
 				ob_start();
380 380
 				if($before){
381 381
 					$this->schema_changes_before_migration();
382
-				}else{
382
+				} else{
383 383
 					$this->schema_changes_after_migration();
384 384
 				}
385 385
 				$output = ob_get_contents();
386 386
 				ob_end_clean();
387
-			}catch(Exception $e){
387
+			} catch(Exception $e){
388 388
 				$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
389 389
 				throw $e;
390 390
 			}
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 				EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance;
426 426
 		if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation  || $currently_migrating ){
427 427
 			$drop_pre_existing_tables = true;
428
-		}else{
428
+		} else{
429 429
 			$drop_pre_existing_tables = false;
430 430
 		}
431 431
 		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables );
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 
449 449
 		if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){
450 450
 			$drop_pre_existing_tables = true;
451
-		}else{
451
+		} else{
452 452
 			$drop_pre_existing_tables = false;
453 453
 		}
454 454
 		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables );
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		EE_Registry::instance()->load_helper('Activation');
466 466
 		try{
467 467
 			EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables);
468
-		}catch( EE_Error $e ) {
468
+		} catch( EE_Error $e ) {
469 469
 			$message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString();
470 470
 			$this->add_error( $message  );
471 471
 			$this->_feedback_message .= $message;
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
 	private function _get_req_type_for_plugin_corresponding_to_this_dms(){
483 483
 		if($this->slug() == 'Core'){
484 484
 			return EE_System::instance()->detect_req_type();
485
-		}else{//it must be for an addon
485
+		} else{//it must be for an addon
486 486
 			$addon_name = $this->slug();
487 487
 			if( EE_Registry::instance()->get_addon_by_name($addon_name)){
488 488
 				return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type();
489
-			}else{
489
+			} else{
490 490
 				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ;
491 491
 			}
492 492
 		}
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 	 * All children of this must call parent::__construct() at the end of their constructor or suffer the consequences!
118 118
 	 */
119 119
 	public function __construct() {
120
-		$this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages',$this->_migration_stages);
121
-		foreach($this->_migration_stages as $migration_stage){
122
-			if ( $migration_stage instanceof EE_Data_Migration_Script_Stage ) {
120
+		$this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages', $this->_migration_stages);
121
+		foreach ($this->_migration_stages as $migration_stage) {
122
+			if ($migration_stage instanceof EE_Data_Migration_Script_Stage) {
123 123
 				$migration_stage->_construct_finalize($this);
124 124
 			}
125 125
 		}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 * Place to add hooks and filters for tweaking the migrations page, in order
133 133
 	 * to customize it
134 134
 	 */
135
-	public function migration_page_hooks(){
135
+	public function migration_page_hooks() {
136 136
 		//by default none are added because we normally like the default look of the migration page
137 137
 	}
138 138
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 * @param int|string $new_pk eg posts.ID
148 148
 	 * @return void
149 149
 	 */
150
-	public function set_mapping($old_table,$old_pk,$new_table,$new_pk){
150
+	public function set_mapping($old_table, $old_pk, $new_table, $new_pk) {
151 151
 		//make sure it has the needed keys
152
-		if( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])){
152
+		if ( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])) {
153 153
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
154 154
 		}
155 155
 		$this->_mappings[$old_table][$new_table][$old_pk] = $new_pk;
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 * @param string $new_table with wpdb prefix (wp_). Eg: wp_posts
166 166
 	 * @return mixed the primary key on the new table
167 167
 	 */
168
-	public function get_mapping_new_pk($old_table,$old_pk,$new_table){
169
-		if( ! isset($this->_mappings[$old_table]) ||
170
-			! isset($this->_mappings[$old_table][$new_table])){
168
+	public function get_mapping_new_pk($old_table, $old_pk, $new_table) {
169
+		if ( ! isset($this->_mappings[$old_table]) ||
170
+			! isset($this->_mappings[$old_table][$new_table])) {
171 171
 			//try fetching the option
172 172
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
173 173
 		}
@@ -184,15 +184,15 @@  discard block
 block discarded – undo
184 184
 	 * @param mixed $new_pk
185 185
 	 * @return mixed
186 186
 	 */
187
-	public function get_mapping_old_pk($old_table,$new_table,$new_pk){
188
-		if( ! isset($this->_mappings[$old_table]) ||
189
-			! isset($this->_mappings[$old_table][$new_table])){
187
+	public function get_mapping_old_pk($old_table, $new_table, $new_pk) {
188
+		if ( ! isset($this->_mappings[$old_table]) ||
189
+			! isset($this->_mappings[$old_table][$new_table])) {
190 190
 			//try fetching the option
191 191
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
192 192
 		}
193
-		if(isset($this->_mappings[$old_table][$new_table])){
193
+		if (isset($this->_mappings[$old_table][$new_table])) {
194 194
 			$new_pk_to_old_pk = array_flip($this->_mappings[$old_table][$new_table]);
195
-			if(isset($new_pk_to_old_pk[$new_pk])){
195
+			if (isset($new_pk_to_old_pk[$new_pk])) {
196 196
 				return $new_pk_to_old_pk[$new_pk];
197 197
 			}
198 198
 		}
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 * @param string $new_table_name
208 208
 	 * @return array
209 209
 	 */
210
-	protected function _get_mapping_option($old_table_name,$new_table_name){
211
-		$option =  get_option($this->_get_mapping_option_name($old_table_name, $new_table_name),array());
210
+	protected function _get_mapping_option($old_table_name, $new_table_name) {
211
+		$option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name), array());
212 212
 		return $option;
213 213
 	}
214 214
 
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 	 * @param array $mapping_array
222 222
 	 * @return boolean success of updating option
223 223
 	 */
224
-	protected function _set_mapping_option($old_table_name,$new_table_name,$mapping_array){
224
+	protected function _set_mapping_option($old_table_name, $new_table_name, $mapping_array) {
225 225
 //		echo "set mapping for $old_table_name $new_table_name".count($mapping_array)."<br>";
226
-		$success =  update_option($this->_get_mapping_option_name($old_table_name, $new_table_name),$mapping_array);
226
+		$success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name), $mapping_array);
227 227
 		return $success;
228 228
 	}
229 229
 
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 	 * @param string $new_table_name
236 236
 	 * @return string
237 237
 	 */
238
-	protected function _get_mapping_option_name($old_table_name,$new_table_name){
238
+	protected function _get_mapping_option_name($old_table_name, $new_table_name) {
239 239
 		global $wpdb;
240
-		$old_table_name_sans_wp = str_replace($wpdb->prefix,"",$old_table_name);
241
-		$new_table_name_sans_wp = str_replace($wpdb->prefix,"",$new_table_name);
240
+		$old_table_name_sans_wp = str_replace($wpdb->prefix, "", $old_table_name);
241
+		$new_table_name_sans_wp = str_replace($wpdb->prefix, "", $new_table_name);
242 242
 		$migrates_to = EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this));
243
-		return substr( EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix . $migrates_to [ 'slug' ] . '_' . $migrates_to[ 'version' ] . '_' . $old_table_name_sans_wp . '_' . $new_table_name_sans_wp, 0, 64 );
243
+		return substr(EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix.$migrates_to ['slug'].'_'.$migrates_to['version'].'_'.$old_table_name_sans_wp.'_'.$new_table_name_sans_wp, 0, 64);
244 244
 	}
245 245
 
246 246
 
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 * 99% until the function "migration_step" returns EE_Data_Migration_Script_Base::status_complete.
258 258
 	 * @return int
259 259
 	 */
260
-	protected function _count_records_to_migrate(){
260
+	protected function _count_records_to_migrate() {
261 261
 		$count = 0;
262
-		foreach($this->stages() as $stage){
263
-			$count+= $stage->count_records_to_migrate();
262
+		foreach ($this->stages() as $stage) {
263
+			$count += $stage->count_records_to_migrate();
264 264
 		}
265 265
 		return $count;
266 266
 	}
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 	 * by just setting a transient and updating it after each migration_step
273 273
 	 * @return int
274 274
 	 */
275
-	public function count_records_migrated(){
275
+	public function count_records_migrated() {
276 276
 		$count = 0;
277
-		foreach($this->stages() as $stage){
278
-			$count+= $stage->count_records_migrated();
277
+		foreach ($this->stages() as $stage) {
278
+			$count += $stage->count_records_migrated();
279 279
 		}
280 280
 		$this->_records_migrated = $count;
281 281
 		return $count;
@@ -289,24 +289,24 @@  discard block
 block discarded – undo
289 289
 	 * @throws EE_Error
290 290
 	 * @throws Exception
291 291
 	 */
292
-	public function migration_step($num_records_to_migrate_limit){
292
+	public function migration_step($num_records_to_migrate_limit) {
293 293
 		//reset the feedback message
294 294
 		$this->_feedback_message = '';
295 295
 		//if we haven't yet done the 1st schema changes, do them now. buffer any output
296 296
 		$this->_maybe_do_schema_changes(true);
297 297
 
298
-		$num_records_actually_migrated =0;
298
+		$num_records_actually_migrated = 0;
299 299
 		$records_migrated_per_stage = array();
300 300
 		//setup the 'stage' variable, which should hold the last run stage of the migration  (or none at all if nothing runs)
301 301
 		$stage = null;
302 302
 		//get the next stage that isn't complete
303
-		foreach($this->stages() as $stage){
304
-			if( $stage->get_status() == EE_Data_Migration_Manager::status_continue){
305
-				try{
303
+		foreach ($this->stages() as $stage) {
304
+			if ($stage->get_status() == EE_Data_Migration_Manager::status_continue) {
305
+				try {
306 306
 					$records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated);
307 307
 					$num_records_actually_migrated += $records_migrated_during_stage;
308 308
 					$records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage;
309
-				}catch(Exception $e){
309
+				} catch (Exception $e) {
310 310
 					//yes if we catch an exception here, we consider that migration stage borked.
311 311
 					$stage->set_status(EE_Data_Migration_Manager::status_fatal_error);
312 312
 					$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 					throw $e;
315 315
 				}
316 316
 				//check that the migration stage didn't mark itself as having a fatal error
317
-				if($stage->is_broken()){
317
+				if ($stage->is_broken()) {
318 318
 					$this->set_broken();
319 319
 					throw new EE_Error($stage->get_last_error());
320 320
 				}
@@ -322,24 +322,24 @@  discard block
 block discarded – undo
322 322
 			//once we've migrated all the number we intended to (possibly from different stages), stop migrating
323 323
 			//or if we had a fatal error
324 324
 			//or if the current script stopped early- its not done, but it's done all it thinks we should do on this step
325
-			if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()){
325
+			if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()) {
326 326
 				break;
327 327
 			}
328 328
 		}
329 329
 		//check if we're all done this data migration...
330 330
 		//which is indicated by being done early AND the last stage claims to be done
331
-		if($stage == NULL){
331
+		if ($stage == NULL) {
332 332
 			//this migration script apparently has NO stages... which is super weird, but whatever
333 333
 			$this->set_completed();
334 334
 			$this->_maybe_do_schema_changes(false);
335
-		}else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
335
+		} else if ($num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()) {
336 336
 			//apparently we're done, because we couldn't migrate the number we intended to
337 337
 			$this->set_completed();
338 338
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
339 339
 			//do schema changes for after the migration now
340 340
 			//first double-check we haven't already done this
341 341
 			$this->_maybe_do_schema_changes(false);
342
-		}else{
342
+		} else {
343 343
 			//update feedback message, keeping in mind that we show them with the most recent at the top
344 344
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
345 345
 		}
@@ -353,12 +353,12 @@  discard block
 block discarded – undo
353 353
 	 * @param array $records_migrated_per_stage KEYS are pretty names for each stage; values are the count of records migrated from that stage
354 354
 	 * @return void
355 355
 	 */
356
-	private function _update_feedback_message($records_migrated_per_stage){
356
+	private function _update_feedback_message($records_migrated_per_stage) {
357 357
 		$feedback_message_array = array();
358
-		foreach($records_migrated_per_stage as $migration_stage_name => $num_records_migrated){
359
-			$feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"),$num_records_migrated,$migration_stage_name) ;
358
+		foreach ($records_migrated_per_stage as $migration_stage_name => $num_records_migrated) {
359
+			$feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"), $num_records_migrated, $migration_stage_name);
360 360
 		}
361
-		$this->_feedback_message .= implode("<br>",$feedback_message_array);
361
+		$this->_feedback_message .= implode("<br>", $feedback_message_array);
362 362
 	}
363 363
 
364 364
 
@@ -370,27 +370,27 @@  discard block
 block discarded – undo
370 370
 	 * @throws Exception
371 371
 	 * @return void
372 372
 	 */
373
-	private function _maybe_do_schema_changes($before = true){
373
+	private function _maybe_do_schema_changes($before = true) {
374 374
 		//so this property will be either _schema_changes_after_migration_ran or _schema_changes_before_migration_ran
375
-		$property_name = '_schema_changes_'. ($before ? 'before' : 'after').'_migration_ran';
376
-		if ( ! $this->$property_name ){
377
-			try{
375
+		$property_name = '_schema_changes_'.($before ? 'before' : 'after').'_migration_ran';
376
+		if ( ! $this->$property_name) {
377
+			try {
378 378
 				ob_start();
379
-				if($before){
379
+				if ($before) {
380 380
 					$this->schema_changes_before_migration();
381
-				}else{
381
+				} else {
382 382
 					$this->schema_changes_after_migration();
383 383
 				}
384 384
 				$output = ob_get_contents();
385 385
 				ob_end_clean();
386
-			}catch(Exception $e){
386
+			} catch (Exception $e) {
387 387
 				$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
388 388
 				throw $e;
389 389
 			}
390 390
 			//record that we've done these schema changes
391 391
 			$this->$property_name = true;
392 392
 			//if there were any warnings etc, record them as non-fatal errors
393
-			if( $output ){
393
+			if ($output) {
394 394
 				//there were some warnings
395 395
 				$this->_errors[] = $output;
396 396
 			}
@@ -417,17 +417,17 @@  discard block
 block discarded – undo
417 417
 	 * @param string $table_definition_sql
418 418
 	 * @param string $engine_string
419 419
 	 */
420
-	protected function _table_is_new_in_this_version($table_name,$table_definition_sql,$engine_string='ENGINE=InnoDB '){
420
+	protected function _table_is_new_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=InnoDB ') {
421 421
 		//we want to know if we are currently performing a migration. We could just believe what was set on the _migrating property, but let's double-check (ie the script should apply and we should be in MM)
422 422
 		$currently_migrating = $this->_migrating &&
423
-				$this->can_migrate_from_version( EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set() ) &&
423
+				$this->can_migrate_from_version(EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set()) &&
424 424
 				EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance;
425
-		if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation  || $currently_migrating ){
425
+		if ($this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $currently_migrating) {
426 426
 			$drop_pre_existing_tables = true;
427
-		}else{
427
+		} else {
428 428
 			$drop_pre_existing_tables = false;
429 429
 		}
430
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables );
430
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables);
431 431
 	}
432 432
 
433 433
 
@@ -443,14 +443,14 @@  discard block
 block discarded – undo
443 443
 	 * @param string $table_definition_sql
444 444
 	 * @param string $engine_string
445 445
 	 */
446
-	protected function _table_should_exist_previously($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
446
+	protected function _table_should_exist_previously($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
447 447
 
448
-		if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){
448
+		if (in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(), array(EE_System::req_type_new_activation))) {
449 449
 			$drop_pre_existing_tables = true;
450
-		}else{
450
+		} else {
451 451
 			$drop_pre_existing_tables = false;
452 452
 		}
453
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables );
453
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables);
454 454
 	}
455 455
 
456 456
 	/**
@@ -460,13 +460,13 @@  discard block
 block discarded – undo
460 460
 	 * @param string $engine_string
461 461
 	 * @param boolean $drop_pre_existing_tables
462 462
 	 */
463
-	private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){
463
+	private function _create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE) {
464 464
 		EE_Registry::instance()->load_helper('Activation');
465
-		try{
466
-			EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables);
467
-		}catch( EE_Error $e ) {
468
-			$message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString();
469
-			$this->add_error( $message  );
465
+		try {
466
+			EEH_Activation::create_table($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables);
467
+		} catch (EE_Error $e) {
468
+			$message = $e->getMessage().'<br>Stack Trace:'.$e->getTraceAsString();
469
+			$this->add_error($message);
470 470
 			$this->_feedback_message .= $message;
471 471
 		}
472 472
 	}
@@ -478,15 +478,15 @@  discard block
 block discarded – undo
478 478
 	 * @return int one of EE_System::_req_type_* constants
479 479
 	 * @throws EE_Error
480 480
 	 */
481
-	private function _get_req_type_for_plugin_corresponding_to_this_dms(){
482
-		if($this->slug() == 'Core'){
481
+	private function _get_req_type_for_plugin_corresponding_to_this_dms() {
482
+		if ($this->slug() == 'Core') {
483 483
 			return EE_System::instance()->detect_req_type();
484
-		}else{//it must be for an addon
484
+		} else {//it must be for an addon
485 485
 			$addon_name = $this->slug();
486
-			if( EE_Registry::instance()->get_addon_by_name($addon_name)){
486
+			if (EE_Registry::instance()->get_addon_by_name($addon_name)) {
487 487
 				return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type();
488
-			}else{
489
-				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ;
488
+			} else {
489
+				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"), $this->slug(), $addon_name, implode(",", array_keys(EE_Registry::instance()->get_addons_by_name()))));
490 490
 			}
491 491
 		}
492 492
 	}
@@ -497,13 +497,13 @@  discard block
 block discarded – undo
497 497
 	 * returns an array of strings describing errors by all the script's stages
498 498
 	 * @return array
499 499
 	 */
500
-	public function get_errors(){
500
+	public function get_errors() {
501 501
 		$all_errors = $this->_errors;
502
-		if( ! is_array($all_errors)){
502
+		if ( ! is_array($all_errors)) {
503 503
 			$all_errors = array();
504 504
 		}
505
-		foreach($this->stages() as $stage){
506
-			$all_errors = array_merge($stage->get_errors(),$all_errors);
505
+		foreach ($this->stages() as $stage) {
506
+			$all_errors = array_merge($stage->get_errors(), $all_errors);
507 507
 		}
508 508
 		return $all_errors;
509 509
 	}
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 	 * Indicates whether or not this migration script should continue
515 515
 	 * @return boolean
516 516
 	 */
517
-	public function can_continue(){
518
-		return in_array($this->get_status(),  EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script);
517
+	public function can_continue() {
518
+		return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script);
519 519
 	}
520 520
 
521 521
 
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 	 * get ordered by the indexes
528 528
 	 * @return EE_Data_Migration_Script_Stage[]
529 529
 	 */
530
-	protected function stages(){
531
-		$stages = apply_filters( 'FHEE__'.get_class($this).'__stages',$this->_migration_stages );
530
+	protected function stages() {
531
+		$stages = apply_filters('FHEE__'.get_class($this).'__stages', $this->_migration_stages);
532 532
 		ksort($stages);
533 533
 		return $stages;
534 534
 	}
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	 * can be displayed to the user
541 541
 	 * @return string
542 542
 	 */
543
-	public function get_feedback_message(){
543
+	public function get_feedback_message() {
544 544
 		return $this->_feedback_message;
545 545
 	}
546 546
 
@@ -552,16 +552,16 @@  discard block
 block discarded – undo
552 552
 	 * possible that this class is defined when it goes to sleep, but NOT available when it
553 553
 	 * awakes (eg, this class is part of an addon that is deactivated at some point).
554 554
 	 */
555
-	public function properties_as_array(){
555
+	public function properties_as_array() {
556 556
 		$properties = parent::properties_as_array();
557 557
 		$properties['_migration_stages'] = array();
558
-		foreach($this->_migration_stages as $migration_stage_priority => $migration_stage_class){
558
+		foreach ($this->_migration_stages as $migration_stage_priority => $migration_stage_class) {
559 559
 			$properties['_migration_stages'][$migration_stage_priority] = $migration_stage_class->properties_as_array();
560 560
 		}
561 561
 		unset($properties['_mappings']);
562 562
 
563
-		foreach($this->_mappings as $old_table_name => $mapping_to_new_table){
564
-			foreach($mapping_to_new_table as $new_table_name => $mapping){
563
+		foreach ($this->_mappings as $old_table_name => $mapping_to_new_table) {
564
+			foreach ($mapping_to_new_table as $new_table_name => $mapping) {
565 565
 				$this->_set_mapping_option($old_table_name, $new_table_name, $mapping);
566 566
 			}
567 567
 		}
@@ -576,19 +576,19 @@  discard block
 block discarded – undo
576 576
 	 * @param array $array_of_properties like what's produced from properties_as_array() method
577 577
 	 * @return void
578 578
 	 */
579
-	public function instantiate_from_array_of_properties($array_of_properties){
579
+	public function instantiate_from_array_of_properties($array_of_properties) {
580 580
 		$stages_properties_arrays = $array_of_properties['_migration_stages'];
581 581
 		unset($array_of_properties['_migration_stages']);
582 582
 		unset($array_of_properties['class']);
583
-		foreach($array_of_properties as $property_name => $property_value){
583
+		foreach ($array_of_properties as $property_name => $property_value) {
584 584
 			$this->$property_name = $property_value;
585 585
 		}
586 586
 		//_migration_stages are already instantiated, but have only default data
587
-		foreach($this->_migration_stages as $stage){
588
-			$stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage),$stages_properties_arrays);
587
+		foreach ($this->_migration_stages as $stage) {
588
+			$stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage), $stages_properties_arrays);
589 589
 			//SO, if we found the stage data that was saved, use it. Otherwise, I guess the stage is new? (maybe added by
590 590
 			//an addon? Unlikely... not sure why it wouldn't exist, but if it doesn't just treat it like it was never started yet)
591
-			if($stage_data){
591
+			if ($stage_data) {
592 592
 				$stage->instantiate_from_array_of_properties($stage_data);
593 593
 			}
594 594
 		}
@@ -604,9 +604,9 @@  discard block
 block discarded – undo
604 604
 	 * @param array $migration_stage_data_arrays
605 605
 	 * @return null
606 606
 	 */
607
-	private function _find_migration_stage_data_with_classname($classname,$migration_stage_data_arrays){
608
-		foreach($migration_stage_data_arrays as $migration_stage_data_array){
609
-			if(isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname){
607
+	private function _find_migration_stage_data_with_classname($classname, $migration_stage_data_arrays) {
608
+		foreach ($migration_stage_data_arrays as $migration_stage_data_array) {
609
+			if (isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname) {
610 610
 				return $migration_stage_data_array;
611 611
 			}
612 612
 		}
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
 	 * @return array where the first key is the plugin's slug, the 2nd is the version of that plugin
623 623
 	 * that will be updated to. Eg array('Core','4.1.0')
624 624
 	 */
625
-	public final function migrates_to_version(){
626
-		return EE_Data_Migration_Manager::instance()->script_migrates_to_version( get_class( $this ) );
625
+	public final function migrates_to_version() {
626
+		return EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this));
627 627
 	}
628 628
 
629 629
 
@@ -635,10 +635,10 @@  discard block
 block discarded – undo
635 635
 	 * Or 'Core' for core (non-addon).
636 636
 	 * @return string
637 637
 	 */
638
-	public function slug(){
638
+	public function slug() {
639 639
 		$migrates_to_version_info = $this->migrates_to_version();
640 640
 		//the slug is the first part of the array
641
-		return $migrates_to_version_info[ 'slug' ];
641
+		return $migrates_to_version_info['slug'];
642 642
 	}
643 643
 
644 644
 
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 	 * the database up so it can run), then you can set "A" to priority 3 or something.
653 653
 	 * @return int
654 654
 	 */
655
-	public function priority(){
655
+	public function priority() {
656 656
 		return $this->_priority;
657 657
 	}
658 658
 
@@ -665,18 +665,18 @@  discard block
 block discarded – undo
665 665
 	 * @param boolean $migrating
666 666
 	 * @return void
667 667
 	 */
668
-	public function set_migrating( $migrating = TRUE ){
668
+	public function set_migrating($migrating = TRUE) {
669 669
 		$this->_migrating = $migrating;
670 670
 	}
671 671
 
672 672
 	/**
673 673
 	 * Marks that we think this migration class can continue to migrate
674 674
 	 */
675
-	public function reattempt(){
675
+	public function reattempt() {
676 676
 		parent::reattempt();
677 677
 		//also, we want to reattempt any stages that were marked as borked
678
-		foreach( $this->stages() as $stage ) {
679
-			if( $stage->is_broken() ) {
678
+		foreach ($this->stages() as $stage) {
679
+			if ($stage->is_broken()) {
680 680
 				$stage->reattempt();
681 681
 			}
682 682
 		}
Please login to merge, or discard this patch.
core/db_classes/EE_Datetime_Ticket.class.php 1 patch
Spacing   +7 added lines, -7 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
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 	 * @param null  $timezone
32 32
 	 * @return EE_Datetime_Ticket|mixed
33 33
 	 */
34
-	public static function new_instance( $props_n_values = array(), $timezone = NULL ) {
35
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone );
36
-		return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone );
34
+	public static function new_instance($props_n_values = array(), $timezone = NULL) {
35
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone);
36
+		return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone);
37 37
 	}
38 38
 
39 39
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @param null  $timezone
44 44
 	 * @return EE_Datetime_Ticket
45 45
 	 */
46
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = NULL ) {
47
-		return new self( $props_n_values, TRUE, $timezone );
46
+	public static function new_instance_from_db($props_n_values = array(), $timezone = NULL) {
47
+		return new self($props_n_values, TRUE, $timezone);
48 48
 	}
49 49
 } //end EE_Datetime_Ticket class
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_classes/EE_Line_Item.class.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -861,7 +861,7 @@
 block discarded – undo
861 861
 
862 862
 				if ( $child_line_item->type() == EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) {
863 863
 					$total += $child_line_item->total();
864
-				}elseif( $child_line_item->type() == EEM_Line_Item::type_sub_total ){
864
+				} elseif( $child_line_item->type() == EEM_Line_Item::type_sub_total ){
865 865
 					$total += $child_line_item->taxable_total();
866 866
 				}
867 867
 			}
Please login to merge, or discard this patch.
Doc Comments   +24 added lines, -25 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 	/**
78 78
 	 * Gets TXN_ID
79
-	 * @return int
79
+	 * @return boolean
80 80
 	 */
81 81
 	function TXN_ID() {
82 82
 		return $this->get( 'TXN_ID' );
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	/**
88 88
 	 * Sets TXN_ID
89 89
 	 * @param int $TXN_ID
90
-	 * @return boolean
90
+	 * @return boolean|null
91 91
 	 */
92 92
 	function set_TXN_ID( $TXN_ID ) {
93 93
 		$this->set( 'TXN_ID', $TXN_ID );
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	/**
113 113
 	 * Sets name
114 114
 	 * @param string $name
115
-	 * @return boolean
115
+	 * @return boolean|null
116 116
 	 */
117 117
 	function set_name( $name ) {
118 118
 		$this->set( 'LIN_name', $name );
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 	/**
124 124
 	 * Gets desc
125
-	 * @return string
125
+	 * @return boolean
126 126
 	 */
127 127
 	function desc() {
128 128
 		return $this->get( 'LIN_desc' );
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	/**
134 134
 	 * Sets desc
135 135
 	 * @param string $desc
136
-	 * @return boolean
136
+	 * @return boolean|null
137 137
 	 */
138 138
 	function set_desc( $desc ) {
139 139
 		$this->set( 'LIN_desc', $desc );
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 	/**
145 145
 	 * Gets quantity
146
-	 * @return int
146
+	 * @return boolean
147 147
 	 */
148 148
 	function quantity() {
149 149
 		return $this->get( 'LIN_quantity' );
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	/**
155 155
 	 * Sets quantity
156 156
 	 * @param int $quantity
157
-	 * @return boolean
157
+	 * @return boolean|null
158 158
 	 */
159 159
 	function set_quantity( $quantity ) {
160 160
 		$this->set( 'LIN_quantity', $quantity );
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
 	/**
166 166
 	 * Gets item_id
167
-	 * @return string
167
+	 * @return boolean
168 168
 	 */
169 169
 	function OBJ_ID() {
170 170
 		return $this->get( 'OBJ_ID' );
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	/**
176 176
 	 * Sets item_id
177 177
 	 * @param string $item_id
178
-	 * @return boolean
178
+	 * @return boolean|null
179 179
 	 */
180 180
 	function set_OBJ_ID( $item_id ) {
181 181
 		$this->set( 'OBJ_ID', $item_id );
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
 	/**
187 187
 	 * Gets item_type
188
-	 * @return string
188
+	 * @return boolean
189 189
 	 */
190 190
 	function OBJ_type() {
191 191
 		return $this->get( 'OBJ_type' );
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	/**
197 197
 	 * Sets item_type
198 198
 	 * @param string $OBJ_type
199
-	 * @return boolean
199
+	 * @return boolean|null
200 200
 	 */
201 201
 	function set_OBJ_type( $OBJ_type ) {
202 202
 		$this->set( 'OBJ_type', $OBJ_type );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
 	/**
208 208
 	 * Gets unit_price
209
-	 * @return float
209
+	 * @return boolean
210 210
 	 */
211 211
 	function unit_price() {
212 212
 		return $this->get( 'LIN_unit_price' );
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	/**
218 218
 	 * Sets unit_price
219 219
 	 * @param float $unit_price
220
-	 * @return boolean
220
+	 * @return boolean|null
221 221
 	 */
222 222
 	function set_unit_price( $unit_price ) {
223 223
 		$this->set( 'LIN_unit_price', $unit_price );
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
 	/**
251 251
 	 * Gets percent (between 100-.001)
252
-	 * @return float
252
+	 * @return boolean
253 253
 	 */
254 254
 	function percent() {
255 255
 		return $this->get( 'LIN_percent' );
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	/**
261 261
 	 * Sets percent (between 100-0.01)
262 262
 	 * @param float $percent
263
-	 * @return boolean
263
+	 * @return boolean|null
264 264
 	 */
265 265
 	function set_percent( $percent ) {
266 266
 		$this->set( 'LIN_percent', $percent );
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
 	/**
272 272
 	 * Gets total
273
-	 * @return float
273
+	 * @return boolean
274 274
 	 */
275 275
 	function total() {
276 276
 		return $this->get( 'LIN_total' );
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	/**
282 282
 	 * Sets total
283 283
 	 * @param float $total
284
-	 * @return boolean
284
+	 * @return boolean|null
285 285
 	 */
286 286
 	function set_total( $total ) {
287 287
 		$this->set( 'LIN_total', $total );
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 
292 292
 	/**
293 293
 	 * Gets parent
294
-	 * @return int
294
+	 * @return boolean
295 295
 	 */
296 296
 	function parent_ID() {
297 297
 		return $this->get( 'LIN_parent' );
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	/**
303 303
 	 * Sets parent
304 304
 	 * @param int $parent
305
-	 * @return boolean
305
+	 * @return boolean|null
306 306
 	 */
307 307
 	function set_parent_ID( $parent ) {
308 308
 		$this->set( 'LIN_parent', $parent );
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
 	/**
314 314
 	 * Gets type
315
-	 * @return string
315
+	 * @return boolean
316 316
 	 */
317 317
 	function type() {
318 318
 		return $this->get( 'LIN_type' );
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	/**
324 324
 	 * Sets type
325 325
 	 * @param string $type
326
-	 * @return boolean
326
+	 * @return boolean|null
327 327
 	 */
328 328
 	function set_type( $type ) {
329 329
 		$this->set( 'LIN_type', $type );
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 
361 361
 	/**
362 362
 	 * Gets code
363
-	 * @return string
363
+	 * @return boolean
364 364
 	 */
365 365
 	function code() {
366 366
 		return $this->get( 'LIN_code' );
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	/**
372 372
 	 * Sets code
373 373
 	 * @param string $code
374
-	 * @return boolean
374
+	 * @return boolean|null
375 375
 	 */
376 376
 	function set_code( $code ) {
377 377
 		$this->set( 'LIN_code', $code );
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	/**
393 393
 	 * Sets is_taxable
394 394
 	 * @param boolean $is_taxable
395
-	 * @return boolean
395
+	 * @return boolean|null
396 396
 	 */
397 397
 	function set_is_taxable( $is_taxable ) {
398 398
 		$this->set( 'LIN_is_taxable', $is_taxable );
@@ -670,7 +670,6 @@  discard block
 block discarded – undo
670 670
 	 * Recursively goes through all the children and recalculates sub-totals EXCEPT for
671 671
 	 * tax-sub-totals (they're a an odd beast). Updates the 'total' on each line item according to either its
672 672
 	 * unit price * quantity or the total of all its children EXCEPT when we're only calculating the taxable total and when this is called on the grand total
673
-	 * @param bool $include_taxable_items_only. If FALSE (default), updates the line items and sub-totals. If TRUE, just finds the amount taxable in this line item's price or its children's.
674 673
 	 * @throws EE_Error
675 674
 	 * @return float
676 675
 	 */
Please login to merge, or discard this patch.
Spacing   +153 added lines, -153 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
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	 * @param string $timezone
42 42
 	 * @return EE_Line_Item
43 43
 	 */
44
-	public static function new_instance( $props_n_values = array(), $timezone = '' ) {
45
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone );
46
-		return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone );
44
+	public static function new_instance($props_n_values = array(), $timezone = '') {
45
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone);
46
+		return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone);
47 47
 	}
48 48
 
49 49
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	 * @param string $timezone
54 54
 	 * @return EE_Line_Item
55 55
 	 */
56
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) {
57
-		return new self( $props_n_values, TRUE, $timezone );
56
+	public static function new_instance_from_db($props_n_values = array(), $timezone = '') {
57
+		return new self($props_n_values, TRUE, $timezone);
58 58
 	}
59 59
 
60 60
 
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	 * @param bool   $bydb
66 66
 	 * @param string $timezone
67 67
 	 */
68
-	protected function __construct( $fieldValues = array(), $bydb = FALSE, $timezone = '' ) {
69
-		parent::__construct( $fieldValues, $bydb, $timezone );
70
-		if ( !$this->get( 'LIN_code' ) ) {
71
-			$this->set_code( $this->generate_code() );
68
+	protected function __construct($fieldValues = array(), $bydb = FALSE, $timezone = '') {
69
+		parent::__construct($fieldValues, $bydb, $timezone);
70
+		if ( ! $this->get('LIN_code')) {
71
+			$this->set_code($this->generate_code());
72 72
 		}
73 73
 	}
74 74
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @return int
80 80
 	 */
81 81
 	function TXN_ID() {
82
-		return $this->get( 'TXN_ID' );
82
+		return $this->get('TXN_ID');
83 83
 	}
84 84
 
85 85
 
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 	 * @param int $TXN_ID
90 90
 	 * @return boolean
91 91
 	 */
92
-	function set_TXN_ID( $TXN_ID ) {
93
-		$this->set( 'TXN_ID', $TXN_ID );
92
+	function set_TXN_ID($TXN_ID) {
93
+		$this->set('TXN_ID', $TXN_ID);
94 94
 	}
95 95
 
96 96
 
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 	 * @return string
101 101
 	 */
102 102
 	function name() {
103
-		$name =  $this->get( 'LIN_name' );
104
-		if( ! $name ){
105
-			$name = ucwords( str_replace( '-', ' ', $this->type() ) );
103
+		$name = $this->get('LIN_name');
104
+		if ( ! $name) {
105
+			$name = ucwords(str_replace('-', ' ', $this->type()));
106 106
 		}
107 107
 		return $name;
108 108
 	}
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 * @param string $name
115 115
 	 * @return boolean
116 116
 	 */
117
-	function set_name( $name ) {
118
-		$this->set( 'LIN_name', $name );
117
+	function set_name($name) {
118
+		$this->set('LIN_name', $name);
119 119
 	}
120 120
 
121 121
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @return string
126 126
 	 */
127 127
 	function desc() {
128
-		return $this->get( 'LIN_desc' );
128
+		return $this->get('LIN_desc');
129 129
 	}
130 130
 
131 131
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 	 * @param string $desc
136 136
 	 * @return boolean
137 137
 	 */
138
-	function set_desc( $desc ) {
139
-		$this->set( 'LIN_desc', $desc );
138
+	function set_desc($desc) {
139
+		$this->set('LIN_desc', $desc);
140 140
 	}
141 141
 
142 142
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return int
147 147
 	 */
148 148
 	function quantity() {
149
-		return $this->get( 'LIN_quantity' );
149
+		return $this->get('LIN_quantity');
150 150
 	}
151 151
 
152 152
 
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 	 * @param int $quantity
157 157
 	 * @return boolean
158 158
 	 */
159
-	function set_quantity( $quantity ) {
160
-		$this->set( 'LIN_quantity', $quantity );
159
+	function set_quantity($quantity) {
160
+		$this->set('LIN_quantity', $quantity);
161 161
 	}
162 162
 
163 163
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @return string
168 168
 	 */
169 169
 	function OBJ_ID() {
170
-		return $this->get( 'OBJ_ID' );
170
+		return $this->get('OBJ_ID');
171 171
 	}
172 172
 
173 173
 
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 	 * @param string $item_id
178 178
 	 * @return boolean
179 179
 	 */
180
-	function set_OBJ_ID( $item_id ) {
181
-		$this->set( 'OBJ_ID', $item_id );
180
+	function set_OBJ_ID($item_id) {
181
+		$this->set('OBJ_ID', $item_id);
182 182
 	}
183 183
 
184 184
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 * @return string
189 189
 	 */
190 190
 	function OBJ_type() {
191
-		return $this->get( 'OBJ_type' );
191
+		return $this->get('OBJ_type');
192 192
 	}
193 193
 
194 194
 
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 	 * @param string $OBJ_type
199 199
 	 * @return boolean
200 200
 	 */
201
-	function set_OBJ_type( $OBJ_type ) {
202
-		$this->set( 'OBJ_type', $OBJ_type );
201
+	function set_OBJ_type($OBJ_type) {
202
+		$this->set('OBJ_type', $OBJ_type);
203 203
 	}
204 204
 
205 205
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * @return float
210 210
 	 */
211 211
 	function unit_price() {
212
-		return $this->get( 'LIN_unit_price' );
212
+		return $this->get('LIN_unit_price');
213 213
 	}
214 214
 
215 215
 
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 	 * @param float $unit_price
220 220
 	 * @return boolean
221 221
 	 */
222
-	function set_unit_price( $unit_price ) {
223
-		$this->set( 'LIN_unit_price', $unit_price );
222
+	function set_unit_price($unit_price) {
223
+		$this->set('LIN_unit_price', $unit_price);
224 224
 	}
225 225
 
226 226
 
@@ -231,14 +231,14 @@  discard block
 block discarded – undo
231 231
 	 * @return boolean
232 232
 	 */
233 233
 	function is_percent() {
234
-		$unit_price = $this->get( 'LIN_unit_price' );
235
-		$percent = $this->get( 'LIN_percent' );
236
-		if ( $unit_price < .001 && $percent ) {
234
+		$unit_price = $this->get('LIN_unit_price');
235
+		$percent = $this->get('LIN_percent');
236
+		if ($unit_price < .001 && $percent) {
237 237
 			return TRUE;
238
-		} elseif ( $unit_price >= .001 && !$percent ) {
238
+		} elseif ($unit_price >= .001 && ! $percent) {
239 239
 			return FALSE;
240
-		} elseif ( $unit_price >= .001 && $percent ) {
241
-			throw new EE_Error( sprintf( __( "A Line Item can not have a unit price of (%s) AND a percent (%s)!", "event_espresso" ), $unit_price, $percent ) );
240
+		} elseif ($unit_price >= .001 && $percent) {
241
+			throw new EE_Error(sprintf(__("A Line Item can not have a unit price of (%s) AND a percent (%s)!", "event_espresso"), $unit_price, $percent));
242 242
 		} else {
243 243
 			// if they're both 0, assume its not a percent item
244 244
 			return FALSE;
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @return float
253 253
 	 */
254 254
 	function percent() {
255
-		return $this->get( 'LIN_percent' );
255
+		return $this->get('LIN_percent');
256 256
 	}
257 257
 
258 258
 
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 * @param float $percent
263 263
 	 * @return boolean
264 264
 	 */
265
-	function set_percent( $percent ) {
266
-		$this->set( 'LIN_percent', $percent );
265
+	function set_percent($percent) {
266
+		$this->set('LIN_percent', $percent);
267 267
 	}
268 268
 
269 269
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return float
274 274
 	 */
275 275
 	function total() {
276
-		return $this->get( 'LIN_total' );
276
+		return $this->get('LIN_total');
277 277
 	}
278 278
 
279 279
 
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 	 * @param float $total
284 284
 	 * @return boolean
285 285
 	 */
286
-	function set_total( $total ) {
287
-		$this->set( 'LIN_total', $total );
286
+	function set_total($total) {
287
+		$this->set('LIN_total', $total);
288 288
 	}
289 289
 
290 290
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 * @return int
295 295
 	 */
296 296
 	function parent_ID() {
297
-		return $this->get( 'LIN_parent' );
297
+		return $this->get('LIN_parent');
298 298
 	}
299 299
 
300 300
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	 * @param int $parent
305 305
 	 * @return boolean
306 306
 	 */
307
-	function set_parent_ID( $parent ) {
308
-		$this->set( 'LIN_parent', $parent );
307
+	function set_parent_ID($parent) {
308
+		$this->set('LIN_parent', $parent);
309 309
 	}
310 310
 
311 311
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * @return string
316 316
 	 */
317 317
 	function type() {
318
-		return $this->get( 'LIN_type' );
318
+		return $this->get('LIN_type');
319 319
 	}
320 320
 
321 321
 
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 	 * @param string $type
326 326
 	 * @return boolean
327 327
 	 */
328
-	function set_type( $type ) {
329
-		$this->set( 'LIN_type', $type );
328
+	function set_type($type) {
329
+		$this->set('LIN_type', $type);
330 330
 	}
331 331
 
332 332
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	 * @return EE_Line_Item
337 337
 	 */
338 338
 	public function parent() {
339
-		return $this->get_model()->get_one_by_ID( $this->parent_ID() );
339
+		return $this->get_model()->get_one_by_ID($this->parent_ID());
340 340
 	}
341 341
 
342 342
 
@@ -346,10 +346,10 @@  discard block
 block discarded – undo
346 346
 	 * @return EE_Line_Item[]
347 347
 	 */
348 348
 	public function children() {
349
-		if ( $this->ID() ) {
350
-			return $this->get_model()->get_all( array( array( 'LIN_parent' => $this->ID() ) ) );
349
+		if ($this->ID()) {
350
+			return $this->get_model()->get_all(array(array('LIN_parent' => $this->ID())));
351 351
 		} else {
352
-			if ( !is_array( $this->_Line_Item ) ) {
352
+			if ( ! is_array($this->_Line_Item)) {
353 353
 				$this->_Line_Item = array();
354 354
 			}
355 355
 			return $this->_Line_Item;
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 * @return string
364 364
 	 */
365 365
 	function code() {
366
-		return $this->get( 'LIN_code' );
366
+		return $this->get('LIN_code');
367 367
 	}
368 368
 
369 369
 
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
 	 * @param string $code
374 374
 	 * @return boolean
375 375
 	 */
376
-	function set_code( $code ) {
377
-		$this->set( 'LIN_code', $code );
376
+	function set_code($code) {
377
+		$this->set('LIN_code', $code);
378 378
 	}
379 379
 
380 380
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	 * @return boolean
385 385
 	 */
386 386
 	function is_taxable() {
387
-		return $this->get( 'LIN_is_taxable' );
387
+		return $this->get('LIN_is_taxable');
388 388
 	}
389 389
 
390 390
 
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
 	 * @param boolean $is_taxable
395 395
 	 * @return boolean
396 396
 	 */
397
-	function set_is_taxable( $is_taxable ) {
398
-		$this->set( 'LIN_is_taxable', $is_taxable );
397
+	function set_is_taxable($is_taxable) {
398
+		$this->set('LIN_is_taxable', $is_taxable);
399 399
 	}
400 400
 
401 401
 
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
 	 */
408 408
 	function get_object() {
409 409
 		$model_name_of_related_obj = $this->OBJ_type();
410
-		$is_model_name = EE_Registry::instance()->is_model_name( $model_name_of_related_obj );
411
-		if ( !$is_model_name ) {
410
+		$is_model_name = EE_Registry::instance()->is_model_name($model_name_of_related_obj);
411
+		if ( ! $is_model_name) {
412 412
 			return NULL;
413 413
 		} else {
414
-			return $this->get_first_related( $model_name_of_related_obj );
414
+			return $this->get_first_related($model_name_of_related_obj);
415 415
 		}
416 416
 	}
417 417
 
@@ -423,11 +423,11 @@  discard block
 block discarded – undo
423 423
 	 * @param array $query_params
424 424
 	 * @return EE_Ticket
425 425
 	 */
426
-	function ticket( $query_params = array() ) {
426
+	function ticket($query_params = array()) {
427 427
 		//we're going to assume that when this method is called we always want to receive the attached ticket EVEN if that ticket is archived.  This can be overridden via the incoming $query_params argument
428
-		$remove_defaults = array( 'default_where_conditions' => 'none' );
429
-		$query_params = array_merge( $remove_defaults, $query_params );
430
-		return $this->get_first_related( 'Ticket', $query_params );
428
+		$remove_defaults = array('default_where_conditions' => 'none');
429
+		$query_params = array_merge($remove_defaults, $query_params);
430
+		return $this->get_first_related('Ticket', $query_params);
431 431
 	}
432 432
 
433 433
 
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
 	 * @return string
439 439
 	 */
440 440
 	function ticket_event_name() {
441
-		$event_name = __( "Unknown", "event_espresso" );
441
+		$event_name = __("Unknown", "event_espresso");
442 442
 		$ticket = $this->ticket();
443
-		if ( $ticket ) {
443
+		if ($ticket) {
444 444
 			$datetime = $ticket->first_datetime();
445
-			if ( $datetime instanceof EE_Datetime ) {
445
+			if ($datetime instanceof EE_Datetime) {
446 446
 				$event = $datetime->event();
447
-				if ( $event instanceof EE_Event ) {
447
+				if ($event instanceof EE_Event) {
448 448
 					$event_name = $event->name();
449 449
 				}
450 450
 			}
@@ -460,13 +460,13 @@  discard block
 block discarded – undo
460 460
 	 * @param string $time_format
461 461
 	 * @return string
462 462
 	 */
463
-	function ticket_datetime_start( $date_format = '', $time_format = '' ) {
464
-		$first_datetime_string = __( "Unknown", "event_espresso" );
463
+	function ticket_datetime_start($date_format = '', $time_format = '') {
464
+		$first_datetime_string = __("Unknown", "event_espresso");
465 465
 		$ticket = $this->ticket();
466
-		if ( $ticket instanceof EE_Ticket ) {
466
+		if ($ticket instanceof EE_Ticket) {
467 467
 			$first_datetime = $ticket->first_datetime();
468
-			if ( $first_datetime ) {
469
-				$first_datetime_string = $first_datetime->start_date_and_time( $date_format, $time_format );
468
+			if ($first_datetime) {
469
+				$first_datetime_string = $first_datetime->start_date_and_time($date_format, $time_format);
470 470
 			}
471 471
 		}
472 472
 		return $first_datetime_string;
@@ -480,20 +480,20 @@  discard block
 block discarded – undo
480 480
 	 * @param EE_Line_Item $line_item
481 481
 	 * @return boolean success
482 482
 	 */
483
-	function add_child_line_item( EE_Line_Item $line_item ) {
484
-		if ( $this->ID() ) {
483
+	function add_child_line_item(EE_Line_Item $line_item) {
484
+		if ($this->ID()) {
485 485
 			//check for any duplicate line items (with the same code), if so, thsi replaces it
486
-			$line_item_with_same_code = $this->get_child_line_item(  $line_item->code() );
487
-			if( $line_item_with_same_code instanceof EE_Line_Item ) {
488
-				$this->delete_child_line_item( $line_item_with_same_code->code() );
486
+			$line_item_with_same_code = $this->get_child_line_item($line_item->code());
487
+			if ($line_item_with_same_code instanceof EE_Line_Item) {
488
+				$this->delete_child_line_item($line_item_with_same_code->code());
489 489
 			}
490
-			$line_item->set_parent_ID( $this->ID() );
491
-			if( $this->TXN_ID() ){
492
-				$line_item->set_TXN_ID( $this->TXN_ID() );
490
+			$line_item->set_parent_ID($this->ID());
491
+			if ($this->TXN_ID()) {
492
+				$line_item->set_TXN_ID($this->TXN_ID());
493 493
 			}
494 494
 			return $line_item->save();
495 495
 		} else {
496
-			$this->_Line_Item[ $line_item->code() ] = $line_item;
496
+			$this->_Line_Item[$line_item->code()] = $line_item;
497 497
 			return TRUE;
498 498
 		}
499 499
 	}
@@ -507,11 +507,11 @@  discard block
 block discarded – undo
507 507
 	 * @param string $code
508 508
 	 * @return EE_Line_Item
509 509
 	 */
510
-	function get_child_line_item( $code ) {
511
-		if ( $this->ID() ) {
512
-			return $this->get_model()->get_one( array( array( 'LIN_parent' => $this->ID(), 'LIN_code' => $code ) ) );
510
+	function get_child_line_item($code) {
511
+		if ($this->ID()) {
512
+			return $this->get_model()->get_one(array(array('LIN_parent' => $this->ID(), 'LIN_code' => $code)));
513 513
 		} else {
514
-			return $this->_Line_Item[ $code ];
514
+			return $this->_Line_Item[$code];
515 515
 		}
516 516
 	}
517 517
 
@@ -522,10 +522,10 @@  discard block
 block discarded – undo
522 522
 	 * @return int
523 523
 	 */
524 524
 	function delete_children_line_items() {
525
-		if ( $this->ID() ) {
526
-			return $this->get_model()->delete( array( array( 'LIN_parent' => $this->ID() ) ) );
525
+		if ($this->ID()) {
526
+			return $this->get_model()->delete(array(array('LIN_parent' => $this->ID())));
527 527
 		} else {
528
-			$count = count( $this->_Line_Item );
528
+			$count = count($this->_Line_Item);
529 529
 			$this->_Line_Item = array();
530 530
 			return $count;
531 531
 		}
@@ -539,11 +539,11 @@  discard block
 block discarded – undo
539 539
 	 * @param string $code
540 540
 	 * @return int count of items deleted (or simply removed from the line item's cache, if not has not been saved to the DB yet)
541 541
 	 */
542
-	function delete_child_line_item( $code ) {
543
-		if ( $this->ID() ) {
544
-			return $this->get_model()->delete( array( array( 'LIN_code' => $code, 'LIN_parent' => $this->ID() ) ) );
542
+	function delete_child_line_item($code) {
543
+		if ($this->ID()) {
544
+			return $this->get_model()->delete(array(array('LIN_code' => $code, 'LIN_parent' => $this->ID())));
545 545
 		} else {
546
-			unset( $this->_Line_Item[ $code ] );
546
+			unset($this->_Line_Item[$code]);
547 547
 			return 1;
548 548
 		}
549 549
 	}
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 	 */
557 557
 	function generate_code() {
558 558
 		// each line item in the cart requires a unique identifier
559
-		return md5( $this->get( 'OBJ_type' ) . $this->get( 'OBJ_ID' ) . time() );
559
+		return md5($this->get('OBJ_type').$this->get('OBJ_ID').time());
560 560
 	}
561 561
 
562 562
 
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 	 * @return string like '2, 004.00', formatted according to the localized currency
621 621
 	 */
622 622
 	function unit_price_no_code() {
623
-		return $this->get_pretty( 'LIN_unit_price', 'no_currency_code' );
623
+		return $this->get_pretty('LIN_unit_price', 'no_currency_code');
624 624
 	}
625 625
 
626 626
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 	 * @return string like '2, 004.00', formatted according to the localized currency
631 631
 	 */
632 632
 	function total_no_code() {
633
-		return $this->get_pretty( 'LIN_total', 'no_currency_code' );
633
+		return $this->get_pretty('LIN_total', 'no_currency_code');
634 634
 	}
635 635
 
636 636
 
@@ -646,9 +646,9 @@  discard block
 block discarded – undo
646 646
 		$pre_tax_total = $this->recalculate_pre_tax_total();
647 647
 		$tax_total = $this->recalculate_taxes_and_tax_total();
648 648
 		$total = $pre_tax_total + $tax_total;
649
-		$this->set_total( $total );
650
-		if( $this->type() == EEM_Line_Item::type_total && $this->transaction() instanceof EE_Transaction ){
651
-			$this->transaction()->set_total( $total );
649
+		$this->set_total($total);
650
+		if ($this->type() == EEM_Line_Item::type_total && $this->transaction() instanceof EE_Transaction) {
651
+			$this->transaction()->set_total($total);
652 652
 		}
653 653
 		return $total;
654 654
 	}
@@ -666,20 +666,20 @@  discard block
 block discarded – undo
666 666
 	function recalculate_pre_tax_total( ) {
667 667
 		$total = 0;
668 668
 		//completely ignore tax sub-totals when calculating the pre-tax-total
669
-		if ( $this->is_tax_sub_total() ) {
669
+		if ($this->is_tax_sub_total()) {
670 670
 			return 0;
671
-		} elseif ( $this->is_sub_line_item() ) {
672
-			throw new EE_Error( sprintf( __( "Calculating the pretax-total on subline items doesn't make sense right now. You were trying to calculate it on %s", "event_espresso" ), d( $this ) ) );
673
-		} elseif ( $this->is_line_item() ) {
671
+		} elseif ($this->is_sub_line_item()) {
672
+			throw new EE_Error(sprintf(__("Calculating the pretax-total on subline items doesn't make sense right now. You were trying to calculate it on %s", "event_espresso"), d($this)));
673
+		} elseif ($this->is_line_item()) {
674 674
 			//we'll want to attach promotions here too. So maybe, if the line item has children, we'll need to take them into account too
675 675
 			$total = $this->unit_price() * $this->quantity();
676
-			$this->set_total( $total );
677
-		} elseif ( $this->is_sub_total() || $this->is_total() ) {
676
+			$this->set_total($total);
677
+		} elseif ($this->is_sub_total() || $this->is_total()) {
678 678
 			//get the total of all its children
679
-			foreach ( $this->children() as $child_line_item ) {
680
-				if ( $child_line_item instanceof EE_Line_Item ) {
679
+			foreach ($this->children() as $child_line_item) {
680
+				if ($child_line_item instanceof EE_Line_Item) {
681 681
 					//only recalculate sub-totals for NON-taxes
682
-					if ( $child_line_item->is_percent() ) {
682
+					if ($child_line_item->is_percent()) {
683 683
 						$total += $total * $child_line_item->percent() / 100;
684 684
 					} else {
685 685
 						$total += $child_line_item->recalculate_pre_tax_total();
@@ -688,8 +688,8 @@  discard block
 block discarded – undo
688 688
 			}
689 689
 			//we only want to update sub-totals if we're including non-taxable items
690 690
 			//and grand totals shouldn't be updated when calculating pre-tax totals
691
-			if( $this->is_sub_total() ){
692
-				$this->set_total( $total );
691
+			if ($this->is_sub_total()) {
692
+				$this->set_total($total);
693 693
 			}
694 694
 		}
695 695
 		return $total;
@@ -708,10 +708,10 @@  discard block
 block discarded – undo
708 708
 		//calculate the pretax total
709 709
 		$taxable_total = $this->taxable_total();
710 710
 		$tax_total = 0;
711
-		foreach ( $taxes as $tax ) {
711
+		foreach ($taxes as $tax) {
712 712
 			$total_on_this_tax = $taxable_total * $tax->percent() / 100;
713 713
 			//remember the total on this line item
714
-			$tax->set_total( $total_on_this_tax );
714
+			$tax->set_total($total_on_this_tax);
715 715
 			$tax_total += $tax->total();
716 716
 		}
717 717
 		$this->_recalculate_tax_sub_total();
@@ -725,18 +725,18 @@  discard block
 block discarded – undo
725 725
 	 * @return void
726 726
 	 */
727 727
 	private function _recalculate_tax_sub_total() {
728
-		if ( $this->is_tax_sub_total() ) {
728
+		if ($this->is_tax_sub_total()) {
729 729
 			$total = 0;
730 730
 			//simply loop through all its children (which should be taxes) and sum their total
731
-			foreach ( $this->children() as $child_tax ) {
732
-				if ( $child_tax instanceof EE_Line_Item ) {
731
+			foreach ($this->children() as $child_tax) {
732
+				if ($child_tax instanceof EE_Line_Item) {
733 733
 					$total += $child_tax->total();
734 734
 				}
735 735
 			}
736
-			$this->set_total( $total );
737
-		} elseif ( $this->is_total() ) {
738
-			foreach ( $this->children() as $maybe_tax_subtotal ) {
739
-				if ( $maybe_tax_subtotal instanceof EE_Line_Item ) {
736
+			$this->set_total($total);
737
+		} elseif ($this->is_total()) {
738
+			foreach ($this->children() as $maybe_tax_subtotal) {
739
+				if ($maybe_tax_subtotal instanceof EE_Line_Item) {
740 740
 					$maybe_tax_subtotal->_recalculate_tax_sub_total();
741 741
 				}
742 742
 			}
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 	public function get_total_tax() {
753 753
 		$this->_recalculate_tax_sub_total();
754 754
 		$total = 0;
755
-		foreach ( $this->tax_descendants() as $tax_line_item ) {
755
+		foreach ($this->tax_descendants() as $tax_line_item) {
756 756
 			$total += $tax_line_item->total();
757 757
 		}
758 758
 		return $total;
@@ -765,8 +765,8 @@  discard block
 block discarded – undo
765 765
 	 */
766 766
 	public function get_items_total() {
767 767
 		$total = 0;
768
-		foreach ( $this->_get_descendants_of_type( EEM_Line_Item::type_line_item ) as $item ) {
769
-			if ( $item instanceof EE_Line_Item ) {
768
+		foreach ($this->_get_descendants_of_type(EEM_Line_Item::type_line_item) as $item) {
769
+			if ($item instanceof EE_Line_Item) {
770 770
 				$total += $item->total();
771 771
 			}
772 772
 		}
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 	 * @return EE_Line_Item[]
782 782
 	 */
783 783
 	function tax_descendants() {
784
-		return $this->_get_descendants_of_type( EEM_Line_Item::type_tax );
784
+		return $this->_get_descendants_of_type(EEM_Line_Item::type_tax);
785 785
 	}
786 786
 
787 787
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 * @return EE_Line_Item[]
792 792
 	 */
793 793
 	function get_items() {
794
-		return $this->_get_descendants_of_type( EEM_Line_Item::type_line_item );
794
+		return $this->_get_descendants_of_type(EEM_Line_Item::type_line_item);
795 795
 	}
796 796
 
797 797
 
@@ -801,15 +801,15 @@  discard block
 block discarded – undo
801 801
 	 * @param string $type one of the constants on EEM_Line_Item
802 802
 	 * @return EE_Line_Item[]
803 803
 	 */
804
-	protected function _get_descendants_of_type( $type ) {
804
+	protected function _get_descendants_of_type($type) {
805 805
 		$line_items_of_type = array();
806
-		foreach ( $this->children() as $child_line_item ) {
807
-			if ( $child_line_item instanceof EE_Line_Item ) {
808
-				if ( $child_line_item->type() == $type ) {
809
-					$line_items_of_type[ ] = $child_line_item;
806
+		foreach ($this->children() as $child_line_item) {
807
+			if ($child_line_item instanceof EE_Line_Item) {
808
+				if ($child_line_item->type() == $type) {
809
+					$line_items_of_type[] = $child_line_item;
810 810
 				} else {
811 811
 					//go-through-all-its children looking for taxes
812
-					$line_items_of_type = array_merge( $line_items_of_type, $child_line_item->_get_descendants_of_type( $type ) );
812
+					$line_items_of_type = array_merge($line_items_of_type, $child_line_item->_get_descendants_of_type($type));
813 813
 				}
814 814
 			}
815 815
 		}
@@ -822,15 +822,15 @@  discard block
 block discarded – undo
822 822
 	 * @param string $type like one of the EEM_Line_Item::type_*
823 823
 	 * @return EE_Line_Item
824 824
 	 */
825
-	public function get_nearest_descendant_of_type( $type ) {
826
-		foreach( $this->children() as $child ){
827
-			if( $child->type() == $type ){
825
+	public function get_nearest_descendant_of_type($type) {
826
+		foreach ($this->children() as $child) {
827
+			if ($child->type() == $type) {
828 828
 				return $child;
829 829
 			}
830 830
 		}
831
-		foreach($this->children() as $child ){
832
-			$descendant_found = $child->get_nearest_descendant_of_type( $type );
833
-			if( $descendant_found ){
831
+		foreach ($this->children() as $child) {
832
+			$descendant_found = $child->get_nearest_descendant_of_type($type);
833
+			if ($descendant_found) {
834 834
 				return $descendant_found;
835 835
 			}
836 836
 		}
@@ -846,12 +846,12 @@  discard block
 block discarded – undo
846 846
 	 */
847 847
 	function taxable_total() {
848 848
 		$total = 0;
849
-		if ( $this->children() ) {
850
-			foreach ( $this->children() as $child_line_item ) {
849
+		if ($this->children()) {
850
+			foreach ($this->children() as $child_line_item) {
851 851
 
852
-				if ( $child_line_item->type() == EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) {
852
+				if ($child_line_item->type() == EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) {
853 853
 					$total += $child_line_item->total();
854
-				}elseif( $child_line_item->type() == EEM_Line_Item::type_sub_total ){
854
+				}elseif ($child_line_item->type() == EEM_Line_Item::type_sub_total) {
855 855
 					$total += $child_line_item->taxable_total();
856 856
 				}
857 857
 			}
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 	 * @return EE_Transaction
867 867
 	 */
868 868
 	public function transaction() {
869
-		return $this->get_first_related( 'Transaction' );
869
+		return $this->get_first_related('Transaction');
870 870
 	}
871 871
 
872 872
 
@@ -879,17 +879,17 @@  discard block
 block discarded – undo
879 879
 	 * @param int $txn_id if none is provided, assumes $this->TXN_ID()
880 880
 	 * @return int count of items saved
881 881
 	 */
882
-	public function save_this_and_descendants_to_txn( $txn_id = NULL ) {
883
-		if ( ! $txn_id ) {
882
+	public function save_this_and_descendants_to_txn($txn_id = NULL) {
883
+		if ( ! $txn_id) {
884 884
 			$txn_id = $this->TXN_ID();
885 885
 		}
886
-		$this->set_TXN_ID( $txn_id );
886
+		$this->set_TXN_ID($txn_id);
887 887
 		$children = $this->children();
888 888
 		$this->save();
889
-		foreach ( $children as $child_line_item ) {
890
-			if ( $child_line_item instanceof EE_Line_Item ) {
891
-				$child_line_item->set_parent_ID( $this->ID() );
892
-				$child_line_item->save_this_and_descendants_to_txn( $txn_id );
889
+		foreach ($children as $child_line_item) {
890
+			if ($child_line_item instanceof EE_Line_Item) {
891
+				$child_line_item->set_parent_ID($this->ID());
892
+				$child_line_item->save_this_and_descendants_to_txn($txn_id);
893 893
 			}
894 894
 		}
895 895
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Event.model.php 3 patches
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 require_once( EE_MODELS . 'EEM_CPT_Base.model.php');
3 5
 /**
4 6
  *
@@ -337,8 +339,9 @@  discard block
 block discarded – undo
337 339
 			 	$questions[ $qg->ID() ] = $qg->model_field_array();
338 340
 			 	$questions[ $qg->ID() ]['QSG_questions'] = array();
339 341
 			 	foreach ( $qsts as $qst ) {
340
-			 		if ( $qst->is_system_question() )
341
-			 			continue;
342
+			 		if ( $qst->is_system_question() ) {
343
+			 					 			continue;
344
+			 		}
342 345
 			 		$answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID() ) ) );
343 346
 			 		$answer = $answer instanceof EE_Answer ? $answer : EEM_Answer::instance()->create_default_object();
344 347
 			 		$qst_name = $qstn_id = $qst->ID();
@@ -514,8 +517,9 @@  discard block
 block discarded – undo
514 517
 		}
515 518
 
516 519
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
517
-		if ( isset( $where_params['status'] ) )
518
-			unset( $where_params['status'] );
520
+		if ( isset( $where_params['status'] ) ) {
521
+					unset( $where_params['status'] );
522
+		}
519 523
 		$where_params['OR'] = array( 'status' => array( '!=', 'publish' ), 'AND' => array('status' => 'publish', 'Datetime.DTT_EVT_end' => array( '<',  date('Y-m-d g:i:s', time() ) ) ) );
520 524
 		$query_params[0] = $where_params;
521 525
 		return $count ? $this->count($query_params, 'EVT_ID') : $this->get_all( $query_params );
@@ -538,8 +542,9 @@  discard block
 block discarded – undo
538 542
 		}
539 543
 
540 544
 		//let's add in specific query_params for inactive events.
541
-		if ( isset( $where_params['status'] ) )
542
-			unset( $where_params['status'] );
545
+		if ( isset( $where_params['status'] ) ) {
546
+					unset( $where_params['status'] );
547
+		}
543 548
 
544 549
 		//we check for events that are not published OR are expired.
545 550
 
Please login to merge, or discard this patch.
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once( EE_MODELS . 'EEM_CPT_Base.model.php');
2
+require_once(EE_MODELS.'EEM_CPT_Base.model.php');
3 3
 /**
4 4
  *
5 5
  * EEM_Event Model
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author				Michael Nelson, Brent Christensen
12 12
  *
13 13
  */
14
-class EEM_Event  extends EEM_CPT_Base{
14
+class EEM_Event  extends EEM_CPT_Base {
15 15
 
16 16
 	/**
17 17
 	 * constant used by status(), indicating that no more tickets can be purchased for any of the datetimes for the event
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
 	 * @param string $timezone
46 46
 	 * @return EEM_Event
47 47
 	 */
48
-	public static function instance( $timezone = NULL ){
48
+	public static function instance($timezone = NULL) {
49 49
 
50 50
 		// check if instance of EEM_Event already exists
51
-		if ( ! self::$_instance instanceof EEM_Event ) {
51
+		if ( ! self::$_instance instanceof EEM_Event) {
52 52
 			// instantiate Espresso_model
53
-			self::$_instance = new self( $timezone );
53
+			self::$_instance = new self($timezone);
54 54
 		}
55 55
 		//we might have a timezone set, let set_timezone decide what to do with it
56
-		self::$_instance->set_timezone( $timezone );
56
+		self::$_instance->set_timezone($timezone);
57 57
 		// EEM_Event object
58 58
 		return self::$_instance;
59 59
 	}
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 * @param string $timezone
65 65
 	 * @return EEM_Event
66 66
 	 */
67
-	protected function __construct($timezone = null){
67
+	protected function __construct($timezone = null) {
68 68
 
69
-		EE_Registry::instance()->load_model( 'Registration' );
69
+		EE_Registry::instance()->load_model('Registration');
70 70
 
71
-		$this->singular_item = __('Event','event_espresso');
72
-		$this->plural_item = __('Events','event_espresso');
71
+		$this->singular_item = __('Event', 'event_espresso');
72
+		$this->plural_item = __('Events', 'event_espresso');
73 73
 
74 74
 		// to remove Cancelled events from the frontend, copy the following filter to your functions.php file
75 75
 		// add_filter( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', '__return_false' );
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
 			array(
84 84
 				EEM_Event::cancelled => array(
85 85
 					'label' => __('Cancelled', 'event_espresso'),
86
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE )
86
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE)
87 87
 				),
88 88
 				EEM_Event::postponed => array(
89 89
 					'label' => __('Postponed', 'event_espresso'),
90
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE )
90
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE)
91 91
 				),
92 92
 				EEM_Event::sold_out => array(
93 93
 					'label' => __('Sold Out', 'event_espresso'),
94
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE )
94
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE)
95 95
 				)
96 96
 			)
97 97
 		);
@@ -99,41 +99,41 @@  discard block
 block discarded – undo
99 99
 		$default_registration_status = EE_Registry::instance()->CFG->registration instanceof EE_Registration_Config ? EE_Registry::instance()->CFG->registration->default_STS_ID : EEM_Registration::status_id_pending_payment;
100 100
 
101 101
 		$this->_tables = array(
102
-			'Event_CPT'=>new EE_Primary_Table( 'posts','ID' ),
103
-			'Event_Meta'=> new EE_Secondary_Table( 'esp_event_meta', 'EVTM_ID', 'EVT_ID' )
102
+			'Event_CPT'=>new EE_Primary_Table('posts', 'ID'),
103
+			'Event_Meta'=> new EE_Secondary_Table('esp_event_meta', 'EVTM_ID', 'EVT_ID')
104 104
 		);
105 105
 
106 106
 		$this->_fields = array(
107 107
 			'Event_CPT'=>array(
108
-				'EVT_ID'=>new EE_Primary_Key_Int_Field( 'ID', __( 'Post ID for Event','event_espresso' )),
109
-				'EVT_name'=>new EE_Plain_Text_Field( 'post_title', __( 'Event Name','event_espresso' ), FALSE, '' ),
110
-				'EVT_desc'=>new EE_Post_Content_Field( 'post_content', __( 'Event Description', 'event_espresso' ), FALSE, '' ),
111
-				'EVT_slug'=>new EE_Slug_Field( 'post_name', __( 'Event Slug', 'event_espresso' ), FALSE, '' ),
112
-				'EVT_created'=>new EE_Datetime_Field( 'post_date', __( 'Date/Time Event Created', 'event_espresso' ), FALSE, current_time( 'timestamp' )),
113
-				'EVT_short_desc'=>new EE_Simple_HTML_Field( 'post_excerpt', __( 'Event Short Description', 'event_espresso' ), FALSE,'' ),
114
-				'EVT_modified'=>new EE_Datetime_Field( 'post_modified', __( 'Date/Time Event Modified', 'event_espresso' ), FALSE, current_time( 'timestamp' )),
115
-				'EVT_wp_user'=>new EE_WP_User_Field( 'post_author', __( 'Event Creator ID', 'event_espresso'), FALSE),
116
-				'parent'=>new EE_Integer_Field( 'post_parent', __( 'Event Parent ID', 'event_espresso' ), FALSE, 0 ),
117
-				'EVT_order'=>new EE_Integer_Field( 'menu_order', __( 'Event Menu Order', 'event_espresso' ), FALSE, 1 ),
118
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_events'),// EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ),
119
-				'status' => new EE_WP_Post_Status_Field( 'post_status', __( 'Event Status', 'event_espresso' ), FALSE, 'draft', $this->_custom_stati )
108
+				'EVT_ID'=>new EE_Primary_Key_Int_Field('ID', __('Post ID for Event', 'event_espresso')),
109
+				'EVT_name'=>new EE_Plain_Text_Field('post_title', __('Event Name', 'event_espresso'), FALSE, ''),
110
+				'EVT_desc'=>new EE_Post_Content_Field('post_content', __('Event Description', 'event_espresso'), FALSE, ''),
111
+				'EVT_slug'=>new EE_Slug_Field('post_name', __('Event Slug', 'event_espresso'), FALSE, ''),
112
+				'EVT_created'=>new EE_Datetime_Field('post_date', __('Date/Time Event Created', 'event_espresso'), FALSE, current_time('timestamp')),
113
+				'EVT_short_desc'=>new EE_Simple_HTML_Field('post_excerpt', __('Event Short Description', 'event_espresso'), FALSE, ''),
114
+				'EVT_modified'=>new EE_Datetime_Field('post_modified', __('Date/Time Event Modified', 'event_espresso'), FALSE, current_time('timestamp')),
115
+				'EVT_wp_user'=>new EE_WP_User_Field('post_author', __('Event Creator ID', 'event_espresso'), FALSE),
116
+				'parent'=>new EE_Integer_Field('post_parent', __('Event Parent ID', 'event_espresso'), FALSE, 0),
117
+				'EVT_order'=>new EE_Integer_Field('menu_order', __('Event Menu Order', 'event_espresso'), FALSE, 1),
118
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_events'), // EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ),
119
+				'status' => new EE_WP_Post_Status_Field('post_status', __('Event Status', 'event_espresso'), FALSE, 'draft', $this->_custom_stati)
120 120
 			),
121 121
 			'Event_Meta'=>array(
122
-				'EVTM_ID'=> new EE_DB_Only_Float_Field( 'EVTM_ID', __( 'Event Meta Row ID','event_espresso' ), FALSE ),
123
-				'EVT_ID_fk'=>new EE_DB_Only_Int_Field( 'EVT_ID', __( 'Foreign key to Event ID from Event Meta table', 'event_espresso' ), FALSE ),
124
-				'EVT_display_desc'=>new EE_Boolean_Field( 'EVT_display_desc', __( 'Display Description Flag', 'event_espresso' ), FALSE, 1 ),
125
-				'EVT_display_ticket_selector'=>new EE_Boolean_Field( 'EVT_display_ticket_selector', __( 'Display Ticket Selector Flag', 'event_espresso' ), FALSE, 1 ),
126
-				'EVT_visible_on'=>new EE_Datetime_Field( 'EVT_visible_on', __( 'Event Visible Date', 'event_espresso' ), TRUE, current_time( 'timestamp' )),
127
-				'EVT_additional_limit'=>new EE_Integer_Field( 'EVT_additional_limit', __( 'Limit of Additional Registrations on Same Transaction', 'event_espresso' ), TRUE, 10 ),
122
+				'EVTM_ID'=> new EE_DB_Only_Float_Field('EVTM_ID', __('Event Meta Row ID', 'event_espresso'), FALSE),
123
+				'EVT_ID_fk'=>new EE_DB_Only_Int_Field('EVT_ID', __('Foreign key to Event ID from Event Meta table', 'event_espresso'), FALSE),
124
+				'EVT_display_desc'=>new EE_Boolean_Field('EVT_display_desc', __('Display Description Flag', 'event_espresso'), FALSE, 1),
125
+				'EVT_display_ticket_selector'=>new EE_Boolean_Field('EVT_display_ticket_selector', __('Display Ticket Selector Flag', 'event_espresso'), FALSE, 1),
126
+				'EVT_visible_on'=>new EE_Datetime_Field('EVT_visible_on', __('Event Visible Date', 'event_espresso'), TRUE, current_time('timestamp')),
127
+				'EVT_additional_limit'=>new EE_Integer_Field('EVT_additional_limit', __('Limit of Additional Registrations on Same Transaction', 'event_espresso'), TRUE, 10),
128 128
 				'EVT_default_registration_status'=>new EE_Enum_Text_Field(
129
-					'EVT_default_registration_status', __( 'Default Registration Status on this Event', 'event_espresso' ), FALSE, $default_registration_status, EEM_Registration::reg_status_array()
129
+					'EVT_default_registration_status', __('Default Registration Status on this Event', 'event_espresso'), FALSE, $default_registration_status, EEM_Registration::reg_status_array()
130 130
 				),
131
-				'EVT_member_only'=>new EE_Boolean_Field( 'EVT_member_only', __( 'Member-Only Event Flag', 'event_espresso' ), FALSE, FALSE ),
132
-				'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __( 'Event Phone Number', 'event_espresso' ), FALSE ),
133
-				'EVT_allow_overflow'=>new EE_Boolean_Field(  'EVT_allow_overflow', __( 'Allow Overflow on Event', 'event_espresso' ), FALSE, FALSE ),
134
-				'EVT_timezone_string'=>new EE_Plain_Text_Field( 'EVT_timezone_string', __( 'Timezone (name) for Event times', 'event_espresso' ), FALSE ),
135
-				'EVT_external_URL'=>new EE_Plain_Text_Field( 'EVT_external_URL', __( 'URL of Event Page if hosted elsewhere', 'event_espresso' ), TRUE ),
136
-				'EVT_donations'=>new EE_Boolean_Field( 'EVT_donations', __( 'Accept Donations?', 'event_espresso' ), FALSE, FALSE )
131
+				'EVT_member_only'=>new EE_Boolean_Field('EVT_member_only', __('Member-Only Event Flag', 'event_espresso'), FALSE, FALSE),
132
+				'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __('Event Phone Number', 'event_espresso'), FALSE),
133
+				'EVT_allow_overflow'=>new EE_Boolean_Field('EVT_allow_overflow', __('Allow Overflow on Event', 'event_espresso'), FALSE, FALSE),
134
+				'EVT_timezone_string'=>new EE_Plain_Text_Field('EVT_timezone_string', __('Timezone (name) for Event times', 'event_espresso'), FALSE),
135
+				'EVT_external_URL'=>new EE_Plain_Text_Field('EVT_external_URL', __('URL of Event Page if hosted elsewhere', 'event_espresso'), TRUE),
136
+				'EVT_donations'=>new EE_Boolean_Field('EVT_donations', __('Accept Donations?', 'event_espresso'), FALSE, FALSE)
137 137
 
138 138
 			));
139 139
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		);
150 150
 
151 151
 		$this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_events', 'EVTM_ID');
152
-		parent::__construct( $timezone );
152
+		parent::__construct($timezone);
153 153
 	}
154 154
 
155 155
 
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 	*		@return 		array
165 165
 	*/
166 166
 	public function get_all_question_groups() {
167
-		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
168
-			array( 'QSG_deleted' => FALSE ),
169
-			'order_by' => array( 'QSG_order' => 'ASC' )
167
+		return EE_Registry::instance()->load_model('Question_Group')->get_all(array(
168
+			array('QSG_deleted' => FALSE),
169
+			'order_by' => array('QSG_order' => 'ASC')
170 170
 		));
171 171
 	}
172 172
 
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
 	* 		@param		int $EVT_ID
183 183
 	*		@return 		array
184 184
 	*/
185
-	public function get_all_event_question_groups( $EVT_ID = 0 ) {
186
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
187
-			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
185
+	public function get_all_event_question_groups($EVT_ID = 0) {
186
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
187
+			EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
188 188
 			return FALSE;
189 189
 		}
190
-		return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array(
191
-			array( 'EVT_ID' => $EVT_ID )
190
+		return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array(
191
+			array('EVT_ID' => $EVT_ID)
192 192
 		));
193 193
 	}
194 194
 
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
 	* 		@param		boolean	$for_primary_attendee
205 205
 	*		@return 		array
206 206
 	*/
207
-	public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) {
208
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
209
-			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
207
+	public function get_event_question_groups($EVT_ID = 0, $for_primary_attendee = TRUE) {
208
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
209
+			EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
210 210
 			return FALSE;
211 211
 		}
212
-		return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array(
213
-			array( 'EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee )
212
+		return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array(
213
+			array('EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee)
214 214
 		));
215 215
 	}
216 216
 
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
 	* 		@param		EE_Registration 	$registration
228 228
 	*		@return 		array
229 229
 	*/
230
-	public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) {
230
+	public function get_question_groups_for_event($EVT_ID = 0, EE_Registration $registration) {
231 231
 
232
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
233
-			EE_Error::add_error( __( 'An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
232
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
233
+			EE_Error::add_error(__('An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
234 234
 			return FALSE;
235 235
 		}
236 236
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			'QSG_deleted' => FALSE
241 241
 		);
242 242
 
243
-		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
243
+		return EE_Registry::instance()->load_model('Question_Group')->get_all(array(
244 244
 			$where_params,
245 245
 			'order_by' => array('QSG_order' => 'ASC')
246 246
 		));
@@ -260,16 +260,16 @@  discard block
 block discarded – undo
260 260
 	* 		@param		string		$QSG_IDs  csv list of $QSG IDs
261 261
 	*		@return 		array
262 262
 	*/
263
-	public function get_questions_in_groups( $QSG_IDs = '' ) {
263
+	public function get_questions_in_groups($QSG_IDs = '') {
264 264
 
265
-		if ( empty( $QSG_IDs )) {
266
-			EE_Error::add_error( __( 'An error occurred. No Question Group IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
265
+		if (empty($QSG_IDs)) {
266
+			EE_Error::add_error(__('An error occurred. No Question Group IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
267 267
 			return FALSE;
268 268
 		}
269 269
 
270
-		return EE_Registry::instance()->load_model( 'Question' )->get_all( array(
270
+		return EE_Registry::instance()->load_model('Question')->get_all(array(
271 271
 			array(
272
-				'Question_Group.QSG_ID' => array( 'IN', $QSG_IDs ),
272
+				'Question_Group.QSG_ID' => array('IN', $QSG_IDs),
273 273
 				'QST_deleted' => FALSE,
274 274
 				'QST_admin_only' => is_admin()
275 275
 			),
@@ -291,16 +291,16 @@  discard block
 block discarded – undo
291 291
 	* 		@param		string		$QST_IDs  csv list of $QST IDs
292 292
 	*		@return 		array
293 293
 	*/
294
-	public function get_options_for_question( $QST_IDs ) {
294
+	public function get_options_for_question($QST_IDs) {
295 295
 
296
-		if ( empty( $QST_IDs )) {
297
-			EE_Error::add_error( __( 'An error occurred. No Question IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
296
+		if (empty($QST_IDs)) {
297
+			EE_Error::add_error(__('An error occurred. No Question IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
298 298
 			return FALSE;
299 299
 		}
300 300
 
301
-		return EE_Registry::instance()->load_model( 'Question_Option' )->get_all( array(
301
+		return EE_Registry::instance()->load_model('Question_Option')->get_all(array(
302 302
 			array(
303
-				'Question.QST_ID' => array( 'IN', $QST_IDs ),
303
+				'Question.QST_ID' => array('IN', $QST_IDs),
304 304
 				'QSO_deleted' => FALSE
305 305
 			),
306 306
 			'order_by' => 'QSO_ID'
@@ -319,45 +319,45 @@  discard block
 block discarded – undo
319 319
 	 * @throws EE_Error
320 320
 	 * @return 	array
321 321
 	 */
322
-	public function assemble_array_of_groups_questions_and_options( EE_Registration $registration, $EVT_ID = 0 ) {
322
+	public function assemble_array_of_groups_questions_and_options(EE_Registration $registration, $EVT_ID = 0) {
323 323
 
324
-		if ( empty( $EVT_ID ) ) {
325
-			throw new EE_Error( __( 'An error occurred. No EVT_ID is included.  Needed to know which question groups to retrieve.', 'event_espresso' ) );
324
+		if (empty($EVT_ID)) {
325
+			throw new EE_Error(__('An error occurred. No EVT_ID is included.  Needed to know which question groups to retrieve.', 'event_espresso'));
326 326
 		}
327 327
 
328 328
 		$questions = array();
329 329
 
330 330
 		// get all question groups for event
331
-		$qgs = $this->get_question_groups_for_event( $EVT_ID, $registration );
332
-		if ( !empty( $qgs ) ) {
333
-			foreach ( $qgs as $qg ) {
331
+		$qgs = $this->get_question_groups_for_event($EVT_ID, $registration);
332
+		if ( ! empty($qgs)) {
333
+			foreach ($qgs as $qg) {
334 334
 			 	$qsts = $qg->questions();
335
-			 	$questions[ $qg->ID() ] = $qg->model_field_array();
336
-			 	$questions[ $qg->ID() ]['QSG_questions'] = array();
337
-			 	foreach ( $qsts as $qst ) {
338
-			 		if ( $qst->is_system_question() )
335
+			 	$questions[$qg->ID()] = $qg->model_field_array();
336
+			 	$questions[$qg->ID()]['QSG_questions'] = array();
337
+			 	foreach ($qsts as $qst) {
338
+			 		if ($qst->is_system_question())
339 339
 			 			continue;
340
-			 		$answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID() ) ) );
340
+			 		$answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID())));
341 341
 			 		$answer = $answer instanceof EE_Answer ? $answer : EEM_Answer::instance()->create_default_object();
342 342
 			 		$qst_name = $qstn_id = $qst->ID();
343 343
 			 		$ans_id = $answer->ID();
344
-			 		$qst_name = !empty( $ans_id ) ?  '[' . $qst_name . '][' . $ans_id . ']' : '[' . $qst_name . ']';
344
+			 		$qst_name = ! empty($ans_id) ? '['.$qst_name.']['.$ans_id.']' : '['.$qst_name.']';
345 345
 			 		$input_name = '';
346
-			 		$input_id = sanitize_key( $qst->display_text() );
346
+			 		$input_id = sanitize_key($qst->display_text());
347 347
 			 		$input_class = '';
348 348
 			 		$questions[$qg->ID()]['QSG_questions'][$qst->ID()] = $qst->model_field_array();
349
-		 			$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_name'] = 'qstn' . $input_name . $qst_name;
350
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_id'] = $input_id . '-' . $qstn_id;
351
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_class'] = $input_class;
352
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'] = array();
353
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['qst_obj'] = $qst;
354
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['ans_obj'] = $answer;
355
-
356
-					if ( $qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN' ) {
357
-						$QSOs = $qst->options(TRUE,$answer->value());
358
-						if ( is_array( $QSOs ) ) {
359
-							foreach ( $QSOs as $QSO_ID => $QSO ) {
360
-								$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'][ $QSO_ID ] = $QSO->model_field_array();
349
+		 			$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_name'] = 'qstn'.$input_name.$qst_name;
350
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_id'] = $input_id.'-'.$qstn_id;
351
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_class'] = $input_class;
352
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'] = array();
353
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['qst_obj'] = $qst;
354
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['ans_obj'] = $answer;
355
+
356
+					if ($qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN') {
357
+						$QSOs = $qst->options(TRUE, $answer->value());
358
+						if (is_array($QSOs)) {
359
+							foreach ($QSOs as $QSO_ID => $QSO) {
360
+								$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'][$QSO_ID] = $QSO->model_field_array();
361 361
 							}
362 362
 						}
363 363
 					}
@@ -381,9 +381,9 @@  discard block
 block discarded – undo
381 381
 	* 		@param		$QST
382 382
 	*		@return 		string		string
383 383
 	*/
384
-	private function _generate_question_input_name( $QST ) {
384
+	private function _generate_question_input_name($QST) {
385 385
 
386
-		if ( $QST->QST_system ) {
386
+		if ($QST->QST_system) {
387 387
 			$qst_name = $QST->QST_system;
388 388
 /*			switch( $QST->QST_system ) {
389 389
 
@@ -450,20 +450,20 @@  discard block
 block discarded – undo
450 450
 	 * @param bool    $count whether to return the count or not (default FALSE)
451 451
 	 * @return array 	EE_Event objects
452 452
 	 */
453
-	public function get_active_events( $query_params, $count = FALSE ) {
454
-		if ( array_key_exists( 0, $query_params ) ) {
453
+	public function get_active_events($query_params, $count = FALSE) {
454
+		if (array_key_exists(0, $query_params)) {
455 455
 			$where_params = $query_params[0];
456
-			unset( $query_params[0] );
456
+			unset($query_params[0]);
457 457
 		} else {
458 458
 			$where_params = array();
459 459
 		}
460 460
 
461 461
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
462 462
 		$where_params['status'] = 'publish';
463
-		$where_params['Datetime.DTT_EVT_start'] = array('>',  date('Y-m-d g:i:s', time() ) );
464
-		$where_params['Datetime.DTT_EVT_end'] = array('<', date('Y-m-d g:i:s', time() ) );
463
+		$where_params['Datetime.DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time()));
464
+		$where_params['Datetime.DTT_EVT_end'] = array('<', date('Y-m-d g:i:s', time()));
465 465
 		$query_params[0] = $where_params;
466
-		$events = $count ? $this->count($query_params, 'EVT_ID') : $this->get_all( $query_params );
466
+		$events = $count ? $this->count($query_params, 'EVT_ID') : $this->get_all($query_params);
467 467
 		return $events;
468 468
 	}
469 469
 
@@ -479,19 +479,19 @@  discard block
 block discarded – undo
479 479
 	 * @param bool    $count whether to return the count or not (default FALSE)
480 480
 	 * @return array               EE_Event objects
481 481
 	 */
482
-	public function get_upcoming_events( $query_params, $count = FALSE ) {
483
-		if ( array_key_exists( 0, $query_params ) ) {
482
+	public function get_upcoming_events($query_params, $count = FALSE) {
483
+		if (array_key_exists(0, $query_params)) {
484 484
 			$where_params = $query_params[0];
485
-			unset( $query_params[0] );
485
+			unset($query_params[0]);
486 486
 		} else {
487 487
 			$where_params = array();
488 488
 		}
489 489
 
490 490
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
491 491
 		$where_params['status'] = 'publish';
492
-		$where_params['Datetime.DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time() ) );
492
+		$where_params['Datetime.DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time()));
493 493
 		$query_params[0] = $where_params;
494
-		return $count ? $this->count($query_params, 'EVT_ID') : $this->get_all( $query_params );
494
+		return $count ? $this->count($query_params, 'EVT_ID') : $this->get_all($query_params);
495 495
 	}
496 496
 
497 497
 
@@ -503,20 +503,20 @@  discard block
 block discarded – undo
503 503
 	 * @param bool    $count whether to return the count or not (default FALSE)
504 504
 	 * @return array 	EE_Event objects
505 505
 	 */
506
-	public function get_expired_events( $query_params, $count = FALSE ) {
507
-		if ( array_key_exists( 0, $query_params ) ) {
506
+	public function get_expired_events($query_params, $count = FALSE) {
507
+		if (array_key_exists(0, $query_params)) {
508 508
 			$where_params = $query_params[0];
509
-			unset( $query_params[0] );
509
+			unset($query_params[0]);
510 510
 		} else {
511 511
 			$where_params = array();
512 512
 		}
513 513
 
514 514
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
515
-		if ( isset( $where_params['status'] ) )
516
-			unset( $where_params['status'] );
517
-		$where_params['OR'] = array( 'status' => array( '!=', 'publish' ), 'AND' => array('status' => 'publish', 'Datetime.DTT_EVT_end' => array( '<',  date('Y-m-d g:i:s', time() ) ) ) );
515
+		if (isset($where_params['status']))
516
+			unset($where_params['status']);
517
+		$where_params['OR'] = array('status' => array('!=', 'publish'), 'AND' => array('status' => 'publish', 'Datetime.DTT_EVT_end' => array('<', date('Y-m-d g:i:s', time()))));
518 518
 		$query_params[0] = $where_params;
519
-		return $count ? $this->count($query_params, 'EVT_ID') : $this->get_all( $query_params );
519
+		return $count ? $this->count($query_params, 'EVT_ID') : $this->get_all($query_params);
520 520
 	}
521 521
 
522 522
 
@@ -527,23 +527,23 @@  discard block
 block discarded – undo
527 527
 	 * @param  boolean $count        whether to return the count or not (default FALSE)
528 528
 	 * @return EE_Event[]            array of EE_Event objects
529 529
 	 */
530
-	public function get_inactive_events( $query_params, $count = FALSE ) {
531
-		if ( array_key_exists( 0, $query_params ) ) {
530
+	public function get_inactive_events($query_params, $count = FALSE) {
531
+		if (array_key_exists(0, $query_params)) {
532 532
 			$where_params = $query_params[0];
533
-			unset( $query_params[0] );
533
+			unset($query_params[0]);
534 534
 		} else {
535 535
 			$where_params = array();
536 536
 		}
537 537
 
538 538
 		//let's add in specific query_params for inactive events.
539
-		if ( isset( $where_params['status'] ) )
540
-			unset( $where_params['status'] );
539
+		if (isset($where_params['status']))
540
+			unset($where_params['status']);
541 541
 
542 542
 		//we check for events that are not published OR are expired.
543 543
 
544
-		$where_params['OR'] = array( 'status' => array( '!=', 'publish' ), 'Datetime.DTT_EVT_end' => array( '<', date('Y-m-d g:i:s', time() ) ) );
544
+		$where_params['OR'] = array('status' => array('!=', 'publish'), 'Datetime.DTT_EVT_end' => array('<', date('Y-m-d g:i:s', time())));
545 545
 		$query_params[0] = $where_params;
546
-		return $count ? $this->count( $query_params, 'EVT_ID' ) : $this->get_all( $query_params );
546
+		return $count ? $this->count($query_params, 'EVT_ID') : $this->get_all($query_params);
547 547
 	}
548 548
 
549 549
 
@@ -551,13 +551,13 @@  discard block
 block discarded – undo
551 551
 	 * This is just injecting into the parent add_relationship_to so we do special handling on price relationships because we don't want to override any existing global default prices but instead insert NEW prices that get attached to the event.
552 552
 	 * See parent for param descriptions
553 553
 	 */
554
-	public function add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query = array()){
554
+	public function add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query = array()) {
555 555
 
556
-		if ( $relationName == 'Price' ) {
556
+		if ($relationName == 'Price') {
557 557
 			//let's get the PRC object for the given ID to make sure that we aren't dealing with a default
558 558
 			$prc_chk = $this->get_related_model_obj($relationName)->ensure_is_obj($other_model_id_or_obj);
559 559
 			//if EVT_ID = 0, then this is a default
560
-			if ( $prc_chk->get('EVT_ID') == 0 ) {
560
+			if ($prc_chk->get('EVT_ID') == 0) {
561 561
 				//let's set the prc_id as 0 so we force an insert on the add_relation_to carried out by relation
562 562
 				$prc_chk->set('PRC_ID', 0);
563 563
 			}
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 		}
568 568
 
569 569
 		//otherwise carry on as normal
570
-		return parent::add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query);
570
+		return parent::add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query);
571 571
 	}
572 572
 
573 573
 
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 
180 180
 
181 181
 	/**
182
-	*		get_question_groups
183
-	*
184
-	* 		@access		public
185
-	*		@return 		array
186
-	*/
182
+	 *		get_question_groups
183
+	 *
184
+	 * 		@access		public
185
+	 *		@return 		array
186
+	 */
187 187
 	public function get_all_question_groups() {
188 188
 		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
189 189
 			array( 'QSG_deleted' => FALSE ),
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 
198 198
 
199 199
 	/**
200
-	*		get_question_groups
201
-	*
202
-	* 		@access		public
203
-	* 		@param		int $EVT_ID
204
-	*		@return 		array
205
-	*/
200
+	 *		get_question_groups
201
+	 *
202
+	 * 		@access		public
203
+	 * 		@param		int $EVT_ID
204
+	 *		@return 		array
205
+	 */
206 206
 	public function get_all_event_question_groups( $EVT_ID = 0 ) {
207 207
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
208 208
 			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
@@ -218,13 +218,13 @@  discard block
 block discarded – undo
218 218
 
219 219
 
220 220
 	/**
221
-	*		get_question_groups
222
-	*
223
-	* 		@access		public
224
-	* 		@param		int $EVT_ID
225
-	* 		@param		boolean	$for_primary_attendee
226
-	*		@return 		array
227
-	*/
221
+	 *		get_question_groups
222
+	 *
223
+	 * 		@access		public
224
+	 * 		@param		int $EVT_ID
225
+	 * 		@param		boolean	$for_primary_attendee
226
+	 *		@return 		array
227
+	 */
228 228
 	public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) {
229 229
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
230 230
 			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 
242 242
 
243 243
 	/**
244
-	*		get_question_groups
245
-	*
246
-	* 		@access		public
247
-	* 		@param		int $EVT_ID
248
-	* 		@param		EE_Registration 	$registration
249
-	*		@return 		array
250
-	*/
244
+	 *		get_question_groups
245
+	 *
246
+	 * 		@access		public
247
+	 * 		@param		int $EVT_ID
248
+	 * 		@param		EE_Registration 	$registration
249
+	 *		@return 		array
250
+	 */
251 251
 	public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) {
252 252
 
253 253
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
 
276 276
 
277 277
 	/**
278
-	*		get_question_target_db_column
279
-	*
280
-	* 		@access		public
281
-	* 		@param		string		$QSG_IDs  csv list of $QSG IDs
282
-	*		@return 		array
283
-	*/
278
+	 *		get_question_target_db_column
279
+	 *
280
+	 * 		@access		public
281
+	 * 		@param		string		$QSG_IDs  csv list of $QSG IDs
282
+	 *		@return 		array
283
+	 */
284 284
 	public function get_questions_in_groups( $QSG_IDs = '' ) {
285 285
 
286 286
 		if ( empty( $QSG_IDs )) {
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 
307 307
 
308 308
 	/**
309
-	*		get_options_for_question
310
-	*
311
-	* 		@access		public
312
-	* 		@param		string		$QST_IDs  csv list of $QST IDs
313
-	*		@return 		array
314
-	*/
309
+	 *		get_options_for_question
310
+	 *
311
+	 * 		@access		public
312
+	 * 		@param		string		$QST_IDs  csv list of $QST IDs
313
+	 *		@return 		array
314
+	 */
315 315
 	public function get_options_for_question( $QST_IDs ) {
316 316
 
317 317
 		if ( empty( $QST_IDs )) {
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
 
397 397
 
398 398
 	/**
399
-	*		_get_question_target_db_column
400
-	*
401
-	* 		@access		private
402
-	* 		@param		$QST
403
-	*		@return 		string		string
404
-	*/
399
+	 *		_get_question_target_db_column
400
+	 *
401
+	 * 		@access		private
402
+	 * 		@param		$QST
403
+	 *		@return 		string		string
404
+	 */
405 405
 	private function _generate_question_input_name( $QST ) {
406 406
 
407 407
 		if ( $QST->QST_system ) {
Please login to merge, or discard this patch.
core/db_models/fields/EE_Enum_Integer_Field.php 2 patches
Spacing   +10 added lines, -10 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 . 'fields/EE_Integer_Field.php' );
2
+require_once(EE_MODELS.'fields/EE_Integer_Field.php');
3 3
 /**
4 4
  * Class EE_Enum_Integer_Field
5 5
  *
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @author				Mike Nelson
9 9
  *
10 10
  */
11
-class EE_Enum_Integer_Field extends EE_Integer_Field{
11
+class EE_Enum_Integer_Field extends EE_Integer_Field {
12 12
 
13 13
 	var $_allowed_enum_values;
14 14
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param int $default_value
21 21
 	 * @param array $allowed_enum_values  keys are values to be used in the DB, values are how they should be displayed
22 22
 	 */
23
-	function __construct($table_column, $nicename, $nullable, $default_value, $allowed_enum_values){
23
+	function __construct($table_column, $nicename, $nullable, $default_value, $allowed_enum_values) {
24 24
 		$this->_allowed_enum_values = $allowed_enum_values;
25 25
 		parent::__construct($table_column, $nicename, $nullable, $default_value);
26 26
 	}
@@ -32,21 +32,21 @@  discard block
 block discarded – undo
32 32
 	 * @throws EE_Error
33 33
 	 */
34 34
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
35
-		if( $value_inputted_for_field_on_model_object !== NULL && ! array_key_exists( $value_inputted_for_field_on_model_object, $this->_allowed_enum_values )){
36
-			if( defined( 'WP_DEBUG' ) && WP_DEBUG ){
35
+		if ($value_inputted_for_field_on_model_object !== NULL && ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values)) {
36
+			if (defined('WP_DEBUG') && WP_DEBUG) {
37 37
 				$msg = sprintf(
38
-					__('System is assigning incompatible value "%1$s" to field "%2$s"','event_espresso'),
38
+					__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
39 39
 					$value_inputted_for_field_on_model_object,
40 40
 					$this->_name
41 41
 				);
42 42
 				$msg2 = sprintf(
43
-					__('Allowed values for "%1$s" are "%2$s". You provided "%3$s"','event_espresso'),
43
+					__('Allowed values for "%1$s" are "%2$s". You provided "%3$s"', 'event_espresso'),
44 44
 					$this->_name,
45
-					implode( ', ', array_keys( $this->_allowed_enum_values )),
45
+					implode(', ', array_keys($this->_allowed_enum_values)),
46 46
 					$value_inputted_for_field_on_model_object
47 47
 				);
48 48
 				throw new EE_Error("$msg||$msg2");
49
-			}else{
49
+			} else {
50 50
 				return $this->get_default_value();
51 51
 			}
52 52
 		}
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @param null         $schema
63 63
 	 * @return string
64 64
 	 */
65
-	function prepare_for_pretty_echoing( $value_on_field_to_be_outputted, $schema = NULL ) {
65
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = NULL) {
66 66
 		return $this->_allowed_enum_values[$value_on_field_to_be_outputted];
67 67
 	}
68 68
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -89,7 +91,7 @@  discard block
 block discarded – undo
89 91
 			$payment_method_slug = EE_Registry::instance()->REQ->get( 'ee_payment_method', NULL );
90 92
 			if( $payment_method_slug ) {
91 93
 				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug( $payment_method_slug );
92
-			}else{
94
+			} else{
93 95
 				$payment_method = null;
94 96
 			}
95 97
 			/** @type EE_Payment_Processor $payment_processor */
Please login to merge, or discard this patch.
core/db_models/fields/EE_Enum_Text_Field.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' );
2
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
3 3
 /**
4 4
  *
5 5
  * Class EE_Enum_Text_Field
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @param mixed $default_value
24 24
 	 * @param array $allowed_enum_values  keys are values to be used in the DB, values are how they should be displayed
25 25
 	 */
26
-	function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values){
26
+	function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) {
27 27
 		$this->_allowed_enum_values = $allowed_enum_values;
28 28
 		parent::__construct($table_column, $nice_name, $nullable, $default_value);
29 29
 	}
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 	 * @throws EE_Error
39 39
 	 */
40 40
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
41
-		if($value_inputted_for_field_on_model_object!==null && !array_key_exists($value_inputted_for_field_on_model_object,$this->_allowed_enum_values)){
42
-			if(WP_DEBUG){
43
-				$msg = sprintf(__("System is assigning incompatible value '%s' to field '%s'",'event_espresso'),$value_inputted_for_field_on_model_object,$this->_name);
44
-				$msg2 = sprintf(__("Allowed values for '%s' are %s. You provided %s",'event_espresso'),$this->_name,implode(", ",array_keys($this->_allowed_enum_values)),$value_inputted_for_field_on_model_object);
41
+		if ($value_inputted_for_field_on_model_object !== null && ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values)) {
42
+			if (WP_DEBUG) {
43
+				$msg = sprintf(__("System is assigning incompatible value '%s' to field '%s'", 'event_espresso'), $value_inputted_for_field_on_model_object, $this->_name);
44
+				$msg2 = sprintf(__("Allowed values for '%s' are %s. You provided %s", 'event_espresso'), $this->_name, implode(", ", array_keys($this->_allowed_enum_values)), $value_inputted_for_field_on_model_object);
45 45
 				throw new EE_Error("$msg||$msg2");
46
-			}else{
46
+			} else {
47 47
 				return $this->get_default_value();
48 48
 			}
49 49
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 		if( $normalized_value ){
34 34
 			if (filter_var($normalized_value, FILTER_VALIDATE_URL) === false){
35 35
 				throw new EE_Validation_Error( $this->get_validation_error_message(), 'invalid_url');
36
-			}else{
36
+			} else{
37 37
 				EE_Registry::instance()->load_helper('URL');
38 38
 				if( ! EEH_URL::remote_file_exists(
39 39
 						$normalized_value,
Please login to merge, or discard this patch.
core/helpers/EEH_DTT_Helper.helper.php 3 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -60,19 +60,19 @@
 block discarded – undo
60 60
 	private static function _timezone_convert_to_string_from_offset( $offset ) {
61 61
 		//shamelessly taken from bottom comment at http://ca1.php.net/manual/en/function.timezone-name-from-abbr.php because timezone_name_from_abbr() did NOT work as expected - its not reliable
62 62
 		$offset *= 3600; // convert hour offset to seconds
63
-        $abbrarray = timezone_abbreviations_list();
64
-        foreach ($abbrarray as $abbr)
65
-        {
66
-                foreach ($abbr as $city)
67
-                {
68
-                        if ($city['offset'] === $offset && $city['dst'] === FALSE)
69
-                        {
70
-                                return $city['timezone_id'];
71
-                        }
72
-                }
73
-        }
74
-
75
-        return FALSE;
63
+		$abbrarray = timezone_abbreviations_list();
64
+		foreach ($abbrarray as $abbr)
65
+		{
66
+				foreach ($abbr as $city)
67
+				{
68
+						if ($city['offset'] === $offset && $city['dst'] === FALSE)
69
+						{
70
+								return $city['timezone_id'];
71
+						}
72
+				}
73
+		}
74
+
75
+		return FALSE;
76 76
 	}
77 77
 
78 78
 
Please login to merge, or discard this patch.
Spacing   +29 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 	public static function get_timezone() {
41 41
 		$timezone = get_option('timezone_string');
42 42
 		//if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter
43
-		if ( empty( $timezone ) ) {
43
+		if (empty($timezone)) {
44 44
 			//let's get a the WordPress UTC offset
45 45
 			$offset = get_option('gmt_offset');
46
-			$timezone = self::_timezone_convert_to_string_from_offset( $offset );
46
+			$timezone = self::_timezone_convert_to_string_from_offset($offset);
47 47
 		}
48 48
 		return $timezone;
49 49
 	}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @param  string $offset GMT offset
58 58
 	 * @return string         timezone_string (valid for DateTimeZone)
59 59
 	 */
60
-	private static function _timezone_convert_to_string_from_offset( $offset ) {
60
+	private static function _timezone_convert_to_string_from_offset($offset) {
61 61
 		//shamelessly taken from bottom comment at http://ca1.php.net/manual/en/function.timezone-name-from-abbr.php because timezone_name_from_abbr() did NOT work as expected - its not reliable
62 62
 		$offset *= 3600; // convert hour offset to seconds
63 63
         $abbrarray = timezone_abbreviations_list();
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 
78 78
 
79 79
 
80
-	public function prepare_dtt_from_db( $dttvalue, $format = 'U' ) {
80
+	public function prepare_dtt_from_db($dttvalue, $format = 'U') {
81 81
 		
82 82
 		$timezone = self::get_timezone();
83 83
 
84
-		$date_obj = new DateTime( $dttvalue, new DateTimeZone('UTC') );
85
-		if ( !$date_obj )
86
-			throw new EE_Error( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso' ) );
87
-		$date_obj->setTimezone( new DateTimeZone($timezone) );
84
+		$date_obj = new DateTime($dttvalue, new DateTimeZone('UTC'));
85
+		if ( ! $date_obj)
86
+			throw new EE_Error(__('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso'));
87
+		$date_obj->setTimezone(new DateTimeZone($timezone));
88 88
 
89 89
 		return $date_obj->format($format);
90 90
 	}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
 
96 96
 	public static function ddtimezone($tz_event = '') {
97
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
97
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
98 98
 
99 99
 		$timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
100 100
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 			if (0 == $current_offset)
113 113
 				$tzstring = 'UTC';
114 114
 			elseif ($current_offset < 0)
115
-				$tzstring = 'UTC' . $current_offset;
115
+				$tzstring = 'UTC'.$current_offset;
116 116
 			else
117
-				$tzstring = 'UTC+' . $current_offset;
117
+				$tzstring = 'UTC+'.$current_offset;
118 118
 		}
119 119
 		?>
120 120
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		</p>
127 127
 
128 128
 		<p><span><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span>
129
-			<?php if (get_option('timezone_string') || !empty($current_offset)) : ?>
129
+			<?php if (get_option('timezone_string') || ! empty($current_offset)) : ?>
130 130
 				<br /><span><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span>
131 131
 		<?php endif; ?>
132 132
 
@@ -159,10 +159,9 @@  discard block
 block discarded – undo
159 159
 						if ($found) {
160 160
 							echo ' ';
161 161
 							$message = $tr['isdst'] ?
162
-											__('Daylight saving time begins on: <code>%s</code>.') :
163
-											__('Standard time begins  on: <code>%s</code>.');
162
+											__('Daylight saving time begins on: <code>%s</code>.') : __('Standard time begins  on: <code>%s</code>.');
164 163
 							// Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n().
165
-							printf($message, date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $tr['ts'] + ($tz_offset - $tr['offset'])));
164
+							printf($message, date_i18n(get_option('date_format').' '.get_option('time_format'), $tr['ts'] + ($tz_offset - $tr['offset'])));
166 165
 						} else {
167 166
 							_e('This timezone does not observe daylight saving time.');
168 167
 						}
@@ -177,16 +176,16 @@  discard block
 block discarded – undo
177 176
 
178 177
 
179 178
 
180
-	public static function date_time_for_timezone( $timestamp, $format, $timezone ) {
181
-		$timezone = empty( $timezone ) ? self::get_timezone() : $timezone;
179
+	public static function date_time_for_timezone($timestamp, $format, $timezone) {
180
+		$timezone = empty($timezone) ? self::get_timezone() : $timezone;
182 181
 
183 182
 		//set timezone
184
-		date_default_timezone_set( $timezone );
183
+		date_default_timezone_set($timezone);
185 184
 
186
-		$date = date( $format, $timestamp );
185
+		$date = date($format, $timestamp);
187 186
 
188 187
 		//setback
189
-		date_default_timezone_set( 'UTC' );
188
+		date_default_timezone_set('UTC');
190 189
 		return $date;
191 190
 	}
192 191
 
@@ -199,7 +198,7 @@  discard block
 block discarded – undo
199 198
 	 * @param  integer       $value    what you want to increment the time by
200 199
 	 * @return EE_Base_Class		   return the EE_Base_Class object so right away you can do something with it (chaining)
201 200
 	 */
202
-	public static function date_time_add( EE_Base_Class $obj, $dttfield, $what = 'years', $value = 1 ) {
201
+	public static function date_time_add(EE_Base_Class $obj, $dttfield, $what = 'years', $value = 1) {
203 202
 		//get the raw UTC date.
204 203
 		$dtt = $obj->get_raw($dttfield);
205 204
 		$new_date = self::calc_date($dtt, $what, $value);
@@ -209,7 +208,7 @@  discard block
 block discarded – undo
209 208
 	}
210 209
 
211 210
 	//same as date_time_add except subtracting value instead of adding.
212
-	public static function date_time_subtract( EE_Base_Class $obj, $dttfield, $what = 'years', $value = 1 ) {
211
+	public static function date_time_subtract(EE_Base_Class $obj, $dttfield, $what = 'years', $value = 1) {
213 212
 		//get the raw UTC date
214 213
 		$dtt = $obj->get_raw($dttfield);
215 214
 		$new_date = self::calc_date($dtt, $what, $value, '-');
@@ -228,21 +227,21 @@  discard block
 block discarded – undo
228 227
 	 * @param  string  $operand What operand you wish to use for the calculation
229 228
 	 * @return string          new UTC timestamp
230 229
 	 */
231
-	public static function calc_date( $utcdtt, $what = 'years', $value = 1, $operand = '+' ) {
230
+	public static function calc_date($utcdtt, $what = 'years', $value = 1, $operand = '+') {
232 231
 		$newdtt = '';
233 232
 
234
-		switch ( $what ) {
233
+		switch ($what) {
235 234
 			case 'years' :
236
-				$value = (60*60*24*364.5) * $value;
235
+				$value = (60 * 60 * 24 * 364.5) * $value;
237 236
 				break;
238 237
 			case 'months' :
239
-				$value = (60*60*24*30.375) * $value;
238
+				$value = (60 * 60 * 24 * 30.375) * $value;
240 239
 				break;
241 240
 			case 'days' :
242
-				$value = (60*60*24) * $value;
241
+				$value = (60 * 60 * 24) * $value;
243 242
 				break;
244 243
 			case 'hours' :
245
-				$value = (60*60) * $value;
244
+				$value = (60 * 60) * $value;
246 245
 				break;
247 246
 			case 'minutes' :
248 247
 				$value = 60 * $value;
@@ -252,7 +251,7 @@  discard block
 block discarded – undo
252 251
 				break;
253 252
 		}
254 253
 
255
-		switch ( $operand ) {
254
+		switch ($operand) {
256 255
 			case '+':
257 256
 				$newdtt = $utcdtt + $value;
258 257
 				break;
Please login to merge, or discard this patch.
Braces   +20 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -82,8 +83,9 @@  discard block
 block discarded – undo
82 83
 		$timezone = self::get_timezone();
83 84
 
84 85
 		$date_obj = new DateTime( $dttvalue, new DateTimeZone('UTC') );
85
-		if ( !$date_obj )
86
-			throw new EE_Error( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso' ) );
86
+		if ( !$date_obj ) {
87
+					throw new EE_Error( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso' ) );
88
+		}
87 89
 		$date_obj->setTimezone( new DateTimeZone($timezone) );
88 90
 
89 91
 		return $date_obj->format($format);
@@ -104,17 +106,19 @@  discard block
 block discarded – undo
104 106
 		$check_zone_info = true;
105 107
 
106 108
 		// Remove old Etc mappings.  Fallback to gmt_offset.
107
-		if (false !== strpos($tzstring, 'Etc/GMT'))
108
-			$tzstring = '';
109
+		if (false !== strpos($tzstring, 'Etc/GMT')) {
110
+					$tzstring = '';
111
+		}
109 112
 
110 113
 		if (empty($tzstring)) { // Create a UTC+- zone if no timezone string exists
111 114
 			$check_zone_info = false;
112
-			if (0 == $current_offset)
113
-				$tzstring = 'UTC';
114
-			elseif ($current_offset < 0)
115
-				$tzstring = 'UTC' . $current_offset;
116
-			else
117
-				$tzstring = 'UTC+' . $current_offset;
115
+			if (0 == $current_offset) {
116
+							$tzstring = 'UTC';
117
+			} elseif ($current_offset < 0) {
118
+							$tzstring = 'UTC' . $current_offset;
119
+			} else {
120
+							$tzstring = 'UTC+' . $current_offset;
121
+			}
118 122
 		}
119 123
 		?>
120 124
 
@@ -137,10 +141,11 @@  discard block
 block discarded – undo
137 141
 					// Set TZ so localtime works.
138 142
 					date_default_timezone_set($tzstring);
139 143
 					$now = localtime(time(), true);
140
-					if ($now['tm_isdst'])
141
-						_e('This timezone is currently in daylight saving time.');
142
-					else
143
-						_e('This timezone is currently in standard time.');
144
+					if ($now['tm_isdst']) {
145
+											_e('This timezone is currently in daylight saving time.');
146
+					} else {
147
+											_e('This timezone is currently in standard time.');
148
+					}
144 149
 					?>
145 150
 					<br />
146 151
 					<?php
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Datepicker_Input.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,19 +6,19 @@  discard block
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Datepicker_Input extends EE_Form_Input_Base{
9
+class EE_Datepicker_Input extends EE_Form_Input_Base {
10 10
 
11 11
 	/**
12 12
 	 * @param array $input_settings
13 13
 	 */
14
-	function __construct( $input_settings = array() ){
15
-		$this->_set_display_strategy( new EE_Text_Input_Display_Strategy( 'datepicker' ) );
16
-		$this->_set_normalization_strategy( new EE_Text_Normalization() );
17
-		parent::__construct( $input_settings );
18
-		$this->set_html_class( $this->html_class() . ' datepicker' );
14
+	function __construct($input_settings = array()) {
15
+		$this->_set_display_strategy(new EE_Text_Input_Display_Strategy('datepicker'));
16
+		$this->_set_normalization_strategy(new EE_Text_Normalization());
17
+		parent::__construct($input_settings);
18
+		$this->set_html_class($this->html_class().' datepicker');
19 19
 		// add some style and make it dance
20
-		add_action( 'wp_enqueue_scripts', array( 'EE_Datepicker_Input', 'enqueue_styles_and_scripts' ));
21
-		add_action( 'admin_enqueue_scripts', array( 'EE_Datepicker_Input', 'enqueue_styles_and_scripts' ));
20
+		add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
21
+		add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
22 22
 	}
23 23
 
24 24
 
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public static function enqueue_styles_and_scripts() {
33 33
 		// load css
34
-		wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION, TRUE );
35
-		wp_enqueue_style( 'espresso-ui-theme');
34
+		wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION, TRUE);
35
+		wp_enqueue_style('espresso-ui-theme');
36 36
 	}
37 37
 
38 38
 
Please login to merge, or discard this patch.