Completed
Branch FET-9795-new-interfaces (ea072c)
by
unknown
51:56 queued 35:16
created
modules/messages/EED_Messages.module.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -558,7 +558,7 @@
 block discarded – undo
558 558
 	 *
559 559
 	 * @param string  $payment_status The payment status being matched.
560 560
 	 *
561
-	 * @return string|bool The payment message type slug matching the status or false if no match.
561
+	 * @return string|false The payment message type slug matching the status or false if no match.
562 562
 	 */
563 563
 	protected static function _get_payment_message_type( $payment_status ) {
564 564
 		$matches = array(
Please login to merge, or discard this patch.
Spacing   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @return EED_Messages
70 70
 	 */
71 71
 	public static function instance() {
72
-		return parent::get_instance( __CLASS__ );
72
+		return parent::get_instance(__CLASS__);
73 73
 	}
74 74
 
75 75
 
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function set_hooks() {
86 86
 		//actions
87
-		add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 );
88
-		add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 2 );
87
+		add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2);
88
+		add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 2);
89 89
 		//filters
90
-		add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
91
-		add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
90
+		add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
91
+		add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
92 92
 		//register routes
93 93
 		self::_register_routes();
94 94
 	}
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public static function set_hooks_admin() {
103 103
 		//actions
104
-		add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 );
105
-		add_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array( 'EED_Messages', 'payment_reminder' ), 10 );
106
-		add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 3 );
107
-		add_action( 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array( 'EED_Messages', 'send_newsletter_message' ), 10, 2 );
108
-		add_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array( 'EED_Messages', 'cancelled_registration' ), 10 );
109
-		add_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', array( 'EED_Messages', 'process_admin_payment' ), 10, 1 );
104
+		add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2);
105
+		add_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array('EED_Messages', 'payment_reminder'), 10);
106
+		add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 3);
107
+		add_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array('EED_Messages', 'send_newsletter_message'), 10, 2);
108
+		add_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array('EED_Messages', 'cancelled_registration'), 10);
109
+		add_action('AHEE__EE_Admin_Page___process_admin_payment_notification', array('EED_Messages', 'process_admin_payment'), 10, 1);
110 110
 		//filters
111
-		add_filter( 'FHEE__EE_Admin_Page___process_resend_registration__success', array( 'EED_Messages', 'process_resend' ), 10, 2 );
112
-		add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
113
-		add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
111
+		add_filter('FHEE__EE_Admin_Page___process_resend_registration__success', array('EED_Messages', 'process_resend'), 10, 2);
112
+		add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
113
+		add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
114 114
 	}
115 115
 
116 116
 
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 	 * @return void
125 125
 	 */
126 126
 	protected static function _register_routes() {
127
-		EE_Config::register_route( 'msg_url_trigger', 'Messages', 'run' );
128
-		EE_Config::register_route( 'msg_cron_trigger', 'Messages', 'execute_batch_request' );
129
-		EE_Config::register_route( 'msg_browser_trigger', 'Messages', 'browser_trigger' );
130
-		EE_Config::register_route( 'msg_browser_error_trigger', 'Messages', 'browser_error_trigger' );
131
-		do_action( 'AHEE__EED_Messages___register_routes' );
127
+		EE_Config::register_route('msg_url_trigger', 'Messages', 'run');
128
+		EE_Config::register_route('msg_cron_trigger', 'Messages', 'execute_batch_request');
129
+		EE_Config::register_route('msg_browser_trigger', 'Messages', 'browser_trigger');
130
+		EE_Config::register_route('msg_browser_error_trigger', 'Messages', 'browser_error_trigger');
131
+		do_action('AHEE__EED_Messages___register_routes');
132 132
 	}
133 133
 
134 134
 
@@ -139,18 +139,18 @@  discard block
 block discarded – undo
139 139
 	 * @since 4.9.0
140 140
 	 * @param WP $WP
141 141
 	 */
142
-	public function browser_trigger( $WP ) {
142
+	public function browser_trigger($WP) {
143 143
 		//ensure controller is loaded
144 144
 		self::_load_controller();
145
-		$token = EE_Registry::instance()->REQ->get( 'token' );
145
+		$token = EE_Registry::instance()->REQ->get('token');
146 146
 		try {
147
-			$mtg = new EE_Message_Generated_From_Token( $token, 'html', self::$_message_resource_manager );
148
-			self::$_MSG_PROCESSOR->generate_and_send_now( $mtg );
149
-		} catch( EE_Error $e ) {
150
-			$error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' );
147
+			$mtg = new EE_Message_Generated_From_Token($token, 'html', self::$_message_resource_manager);
148
+			self::$_MSG_PROCESSOR->generate_and_send_now($mtg);
149
+		} catch (EE_Error $e) {
150
+			$error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso');
151 151
 			// add specific message for developers if WP_DEBUG in on
152
-			$error_msg .= '||' . $e->getMessage();
153
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
152
+			$error_msg .= '||'.$e->getMessage();
153
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
154 154
 		}
155 155
 	}
156 156
 
@@ -166,20 +166,20 @@  discard block
 block discarded – undo
166 166
 	 * @since 4.9.0
167 167
 	 * @param $WP
168 168
 	 */
169
-	public function browser_error_trigger( $WP ) {
170
-		$token = EE_Registry::instance()->REQ->get( 'token' );
171
-		if ( $token ) {
172
-			$message = EEM_Message::instance()->get_one_by_token( $token );
173
-			if ( $message instanceof EE_Message ) {
174
-				header( 'HTTP/1.1 200 OK' );
175
-				$error_msg = nl2br( $message->error_message() );
169
+	public function browser_error_trigger($WP) {
170
+		$token = EE_Registry::instance()->REQ->get('token');
171
+		if ($token) {
172
+			$message = EEM_Message::instance()->get_one_by_token($token);
173
+			if ($message instanceof EE_Message) {
174
+				header('HTTP/1.1 200 OK');
175
+				$error_msg = nl2br($message->error_message());
176 176
 				?>
177 177
 				<!DOCTYPE html>
178 178
 				<html>
179 179
 					<head></head>
180 180
 					<body>
181
-						<?php echo empty( $error_msg )
182
-						? esc_html__( 'Unfortunately, we were unable to capture the error message for this message.', 'event_espresso' )
181
+						<?php echo empty($error_msg)
182
+						? esc_html__('Unfortunately, we were unable to capture the error message for this message.', 'event_espresso')
183 183
 						: wp_kses(
184 184
 							$error_msg,
185 185
 							array(
@@ -214,19 +214,19 @@  discard block
 block discarded – undo
214 214
 	 * @throws EE_Error
215 215
 	 * @return    void
216 216
 	 */
217
-	public function run( $WP ) {
217
+	public function run($WP) {
218 218
 		//ensure controller is loaded
219 219
 		self::_load_controller();
220 220
 		// attempt to process message
221 221
 		try {
222 222
 			/** @type EE_Message_To_Generate_From_Request $message_to_generate */
223
-			$message_to_generate = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' );
224
-			self::$_MSG_PROCESSOR->generate_and_send_now( $message_to_generate );
225
-		} catch ( EE_Error $e ) {
226
-			$error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' );
223
+			$message_to_generate = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request');
224
+			self::$_MSG_PROCESSOR->generate_and_send_now($message_to_generate);
225
+		} catch (EE_Error $e) {
226
+			$error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso');
227 227
 			// add specific message for developers if WP_DEBUG in on
228
-			$error_msg .= '||' . $e->getMessage();
229
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
228
+			$error_msg .= '||'.$e->getMessage();
229
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
230 230
 		}
231 231
 	}
232 232
 
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
 	 * This is triggered by the 'msg_cron_trigger' route.
236 236
 	 * @param WP $WP
237 237
 	 */
238
-	public function execute_batch_request( $WP ) {
238
+	public function execute_batch_request($WP) {
239 239
 		$this->run_cron();
240
-		header( 'HTTP/1.1 200 OK' );
240
+		header('HTTP/1.1 200 OK');
241 241
 		exit();
242 242
 	}
243 243
 
@@ -251,35 +251,35 @@  discard block
 block discarded – undo
251 251
 	public function run_cron() {
252 252
 		self::_load_controller();
253 253
 		//get required vars
254
-		$cron_type = EE_Registry::instance()->REQ->get( 'type' );
255
-		$transient_key = EE_Registry::instance()->REQ->get( 'key' );
254
+		$cron_type = EE_Registry::instance()->REQ->get('type');
255
+		$transient_key = EE_Registry::instance()->REQ->get('key');
256 256
 
257 257
 		//now let's verify transient, if not valid exit immediately
258
-		if ( ! get_transient( $transient_key ) ) {
258
+		if ( ! get_transient($transient_key)) {
259 259
 			/**
260 260
 			 * trigger error so this gets in the error logs.  This is important because it happens on a non-user request.
261 261
 			 */
262
-			trigger_error( esc_attr__( 'Invalid Request (Transient does not exist)', 'event_espresso' ) );
262
+			trigger_error(esc_attr__('Invalid Request (Transient does not exist)', 'event_espresso'));
263 263
 		}
264 264
 
265 265
 		//if made it here, lets' delete the transient to keep the db clean
266
-		delete_transient( $transient_key );
266
+		delete_transient($transient_key);
267 267
 
268
-		if ( apply_filters( 'FHEE__EED_Messages__run_cron__use_wp_cron', true ) ) {
268
+		if (apply_filters('FHEE__EED_Messages__run_cron__use_wp_cron', true)) {
269 269
 
270
-			$method = 'batch_' . $cron_type . '_from_queue';
271
-			if ( method_exists( self::$_MSG_PROCESSOR, $method ) ) {
270
+			$method = 'batch_'.$cron_type.'_from_queue';
271
+			if (method_exists(self::$_MSG_PROCESSOR, $method)) {
272 272
 				self::$_MSG_PROCESSOR->$method();
273 273
 			} else {
274 274
 				//no matching task
275 275
 				/**
276 276
 				 * trigger error so this gets in the error logs.  This is important because it happens on a non user request.
277 277
 				 */
278
-				trigger_error( esc_attr( sprintf( __( 'There is no task corresponding to this route %s', 'event_espresso' ), $cron_type ) ) );
278
+				trigger_error(esc_attr(sprintf(__('There is no task corresponding to this route %s', 'event_espresso'), $cron_type)));
279 279
 			}
280 280
 		}
281 281
 
282
-		do_action( 'FHEE__EED_Messages__run_cron__end' );
282
+		do_action('FHEE__EED_Messages__run_cron__end');
283 283
 	}
284 284
 
285 285
 
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
 	 *
296 296
 	 * @return EE_Messages_Template_Pack
297 297
 	 */
298
-	public static function get_template_pack( $template_pack_name ) {
299
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
300
-		return EEH_MSG_Template::get_template_pack( $template_pack_name );
298
+	public static function get_template_pack($template_pack_name) {
299
+		EE_Registry::instance()->load_helper('MSG_Template');
300
+		return EEH_MSG_Template::get_template_pack($template_pack_name);
301 301
 	}
302 302
 
303 303
 
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
 	 * @return EE_Messages_Template_Pack[]
312 312
 	 */
313 313
 	public static function get_template_packs() {
314
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
314
+		EE_Registry::instance()->load_helper('MSG_Template');
315 315
 
316 316
 		//for backward compat, let's make sure this returns in the same format as originally.
317 317
 		$template_pack_collection = EEH_MSG_Template::get_template_pack_collection();
318 318
 		$template_pack_collection->rewind();
319 319
 		$template_packs = array();
320
-		while ( $template_pack_collection->valid() ) {
321
-			$template_packs[ $template_pack_collection->current()->dbref ] = $template_pack_collection->current();
320
+		while ($template_pack_collection->valid()) {
321
+			$template_packs[$template_pack_collection->current()->dbref] = $template_pack_collection->current();
322 322
 			$template_pack_collection->next();
323 323
 		}
324 324
 		return $template_packs;
@@ -334,14 +334,14 @@  discard block
 block discarded – undo
334 334
 	 * @return void
335 335
 	 */
336 336
 	public static function set_autoloaders() {
337
-		if ( empty( self::$_MSG_PATHS ) ) {
337
+		if (empty(self::$_MSG_PATHS)) {
338 338
 			self::_set_messages_paths();
339
-			foreach ( self::$_MSG_PATHS as $path ) {
340
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path );
339
+			foreach (self::$_MSG_PATHS as $path) {
340
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path);
341 341
 			}
342 342
 			// add aliases
343
-			EEH_Autoloader::add_alias( 'EE_messages', 'EE_messages' );
344
-			EEH_Autoloader::add_alias( 'EE_messenger', 'EE_messenger' );
343
+			EEH_Autoloader::add_alias('EE_messages', 'EE_messages');
344
+			EEH_Autoloader::add_alias('EE_messenger', 'EE_messenger');
345 345
 		}
346 346
 	}
347 347
 
@@ -369,10 +369,10 @@  discard block
 block discarded – undo
369 369
 			'shortcodes',
370 370
 			);
371 371
 		$paths = array();
372
-		foreach ( $dir_ref as $index => $dir ) {
373
-			$paths[ $index ] = EE_LIBRARIES . $dir;
372
+		foreach ($dir_ref as $index => $dir) {
373
+			$paths[$index] = EE_LIBRARIES.$dir;
374 374
 		}
375
-		self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths );
375
+		self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths);
376 376
 	}
377 377
 
378 378
 
@@ -383,12 +383,12 @@  discard block
 block discarded – undo
383 383
 	 * @return void
384 384
 	 */
385 385
 	protected static function _load_controller() {
386
-		if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor ) {
387
-			EE_Registry::instance()->load_core( 'Request_Handler' );
386
+		if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor) {
387
+			EE_Registry::instance()->load_core('Request_Handler');
388 388
 			self::set_autoloaders();
389
-			self::$_EEMSG = EE_Registry::instance()->load_lib( 'messages' );
390
-			self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib( 'Messages_Processor' );
391
-			self::$_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
389
+			self::$_EEMSG = EE_Registry::instance()->load_lib('messages');
390
+			self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib('Messages_Processor');
391
+			self::$_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
392 392
 		}
393 393
 	}
394 394
 
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
 	/**
398 398
 	 * @param EE_Transaction $transaction
399 399
 	 */
400
-	public static function payment_reminder( EE_Transaction $transaction ) {
400
+	public static function payment_reminder(EE_Transaction $transaction) {
401 401
 		self::_load_controller();
402
-		$data = array( $transaction, null );
403
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'payment_reminder', $data );
402
+		$data = array($transaction, null);
403
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('payment_reminder', $data);
404 404
 	}
405 405
 
406 406
 
@@ -411,14 +411,14 @@  discard block
 block discarded – undo
411 411
 	 * @param  EE_Payment object
412 412
 	 * @return void
413 413
 	 */
414
-	public static function payment( EE_Transaction $transaction, EE_Payment $payment ) {
414
+	public static function payment(EE_Transaction $transaction, EE_Payment $payment) {
415 415
 		self::_load_controller();
416
-		$data = array( $transaction, $payment );
417
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
418
-		$message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() );
416
+		$data = array($transaction, $payment);
417
+		EE_Registry::instance()->load_helper('MSG_Template');
418
+		$message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
419 419
 		//if payment amount is less than 0 then switch to payment_refund message type.
420 420
 		$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
421
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data );
421
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
422 422
 	}
423 423
 
424 424
 
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 	/**
427 427
 	 * @param EE_Transaction $transaction
428 428
 	 */
429
-	public static function cancelled_registration( EE_Transaction $transaction ) {
429
+	public static function cancelled_registration(EE_Transaction $transaction) {
430 430
 		self::_load_controller();
431
-		$data = array( $transaction, null );
432
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'cancelled_registration', $data );
431
+		$data = array($transaction, null);
432
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('cancelled_registration', $data);
433 433
 	}
434 434
 
435 435
 
@@ -442,9 +442,9 @@  discard block
 block discarded – undo
442 442
 	 * @param array $extra_details
443 443
 	 * @return void
444 444
 	 */
445
-	public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) {
445
+	public static function maybe_registration(EE_Registration $registration, $extra_details = array()) {
446 446
 
447
-		if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) {
447
+		if ( ! self::_verify_registration_notification_send($registration, $extra_details)) {
448 448
 			//no messages please
449 449
 			return;
450 450
 		}
@@ -459,22 +459,22 @@  discard block
 block discarded – undo
459 459
 		$mtgs = array();
460 460
 
461 461
 		//loop through registrations and trigger messages once per status.
462
-		foreach ( $all_registrations as $reg ) {
462
+		foreach ($all_registrations as $reg) {
463 463
 
464 464
 			//already triggered?
465
-			if ( in_array( $reg->status_ID(), $statuses_sent ) ) {
465
+			if (in_array($reg->status_ID(), $statuses_sent)) {
466 466
 				continue;
467 467
 			}
468 468
 
469
-			$message_type = EEH_MSG_Template::convert_reg_status_to_message_type( $reg->status_ID() );
470
-			$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) );
469
+			$message_type = EEH_MSG_Template::convert_reg_status_to_message_type($reg->status_ID());
470
+			$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers($message_type, array($registration->transaction(), null, $reg->status_ID()));
471 471
 			$statuses_sent[] = $reg->status_ID();
472 472
 		}
473 473
 
474
-		$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( 'registration_summary', array( $registration->transaction(), null ) );
474
+		$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers('registration_summary', array($registration->transaction(), null));
475 475
 
476 476
 		//batch queue and initiate request
477
-		self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $mtgs );
477
+		self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($mtgs);
478 478
 		self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
479 479
 	}
480 480
 
@@ -489,39 +489,39 @@  discard block
 block discarded – undo
489 489
 	 *
490 490
 	 * @return bool          true = send away, false = nope halt the presses.
491 491
 	 */
492
-	protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) {
492
+	protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) {
493 493
 		 //self::log(
494 494
 		 //	__CLASS__, __FUNCTION__, __LINE__,
495 495
 		 //	$registration->transaction(),
496 496
 		 //	array( '$extra_details' => $extra_details )
497 497
 		 //);
498 498
 		// currently only using this to send messages for the primary registrant
499
-		if ( ! $registration->is_primary_registrant() ) {
499
+		if ( ! $registration->is_primary_registrant()) {
500 500
 			return false;
501 501
 		}
502 502
 		// first we check if we're in admin and not doing front ajax
503
-		if ( is_admin() && ! EE_FRONT_AJAX ) {
503
+		if (is_admin() && ! EE_FRONT_AJAX) {
504 504
 			//make sure appropriate admin params are set for sending messages
505
-			if ( empty( $_REQUEST['txn_reg_status_change']['send_notifications'] ) || ! absint( $_REQUEST['txn_reg_status_change']['send_notifications'] ) ) {
505
+			if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) {
506 506
 				//no messages sent please.
507 507
 				return false;
508 508
 			}
509 509
 		} else {
510 510
 			// frontend request (either regular or via AJAX)
511 511
 			// TXN is NOT finalized ?
512
-			if ( ! isset( $extra_details['finalized'] ) || $extra_details['finalized'] === false ) {
512
+			if ( ! isset($extra_details['finalized']) || $extra_details['finalized'] === false) {
513 513
 				return false;
514 514
 			}
515 515
 			// return visit but nothing changed ???
516 516
 			if (
517
-				isset( $extra_details['revisit'], $extra_details['status_updates'] ) &&
517
+				isset($extra_details['revisit'], $extra_details['status_updates']) &&
518 518
 				$extra_details['revisit'] && ! $extra_details['status_updates']
519 519
 			) {
520 520
 				return false;
521 521
 			}
522 522
 			// NOT sending messages && reg status is something other than "Not-Approved"
523 523
 			if (
524
-				! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) &&
524
+				! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) &&
525 525
 				$registration->status_ID() !== EEM_Registration::status_id_not_approved
526 526
 			) {
527 527
 				return false;
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
 	 *
544 544
 	 * @return array
545 545
 	 */
546
-	protected static function _get_reg_status_array( $reg_status = '' ) {
547
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
548
-		return EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status )
549
-			? EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status )
546
+	protected static function _get_reg_status_array($reg_status = '') {
547
+		EE_Registry::instance()->load_helper('MSG_Template');
548
+		return EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
549
+			? EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
550 550
 			: EEH_MSG_Template::reg_status_to_message_type_array();
551 551
 	}
552 552
 
@@ -562,10 +562,10 @@  discard block
 block discarded – undo
562 562
 	 *
563 563
 	 * @return string|bool The payment message type slug matching the status or false if no match.
564 564
 	 */
565
-	protected static function _get_payment_message_type( $payment_status ) {
566
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
567
-		return EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status )
568
-			? EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status )
565
+	protected static function _get_payment_message_type($payment_status) {
566
+		EE_Registry::instance()->load_helper('MSG_Template');
567
+		return EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
568
+			? EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
569 569
 			: false;
570 570
 	}
571 571
 
@@ -579,33 +579,33 @@  discard block
 block discarded – undo
579 579
 	 * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages
580 580
 	 * @return bool          success/fail
581 581
 	 */
582
-	public static function process_resend( $req_data ) {
582
+	public static function process_resend($req_data) {
583 583
 		self::_load_controller();
584 584
 
585 585
 		//if $msgID in this request then skip to the new resend_message
586
-		if ( EE_Registry::instance()->REQ->get( 'MSG_ID' ) ) {
586
+		if (EE_Registry::instance()->REQ->get('MSG_ID')) {
587 587
 			return self::resend_message();
588 588
 		}
589 589
 
590 590
 		//make sure any incoming request data is set on the REQ so that it gets picked up later.
591 591
 		$req_data = (array) $req_data;
592
-		foreach( $req_data as $request_key => $request_value ) {
593
-			EE_Registry::instance()->REQ->set( $request_key, $request_value );
592
+		foreach ($req_data as $request_key => $request_value) {
593
+			EE_Registry::instance()->REQ->set($request_key, $request_value);
594 594
 		}
595 595
 
596
-		if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request() ) {
596
+		if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request()) {
597 597
 			return false;
598 598
 		}
599 599
 
600 600
 		try {
601
-			self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $messages_to_send );
601
+			self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($messages_to_send);
602 602
 			self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
603
-		} catch( EE_Error $e ) {
604
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
603
+		} catch (EE_Error $e) {
604
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
605 605
 			return false;
606 606
 		}
607 607
 		EE_Error::add_success(
608
-			__( 'Messages have been successfully queued for generation and sending.', 'event_espresso' )
608
+			__('Messages have been successfully queued for generation and sending.', 'event_espresso')
609 609
 		);
610 610
 		return true; //everything got queued.
611 611
 	}
@@ -618,17 +618,17 @@  discard block
 block discarded – undo
618 618
 	public static function resend_message() {
619 619
 		self::_load_controller();
620 620
 
621
-		$msgID = EE_Registry::instance()->REQ->get( 'MSG_ID' );
622
-		if ( ! $msgID ) {
623
-			EE_Error::add_error( __( 'Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
621
+		$msgID = EE_Registry::instance()->REQ->get('MSG_ID');
622
+		if ( ! $msgID) {
623
+			EE_Error::add_error(__('Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
624 624
 			return false;
625 625
 		}
626 626
 
627
-		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( (array) $msgID );
627
+		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send((array) $msgID);
628 628
 
629 629
 		//setup success message.
630
-		$count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend );
631
-		EE_Error::add_success( sprintf(
630
+		$count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
631
+		EE_Error::add_success(sprintf(
632 632
 			_n(
633 633
 				'There was %d message queued for resending.',
634 634
 				'There were %d messages queued for resending.',
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 				'event_espresso'
637 637
 			),
638 638
 			$count_ready_for_resend
639
-		) );
639
+		));
640 640
 		return true;
641 641
 	}
642 642
 
@@ -649,13 +649,13 @@  discard block
 block discarded – undo
649 649
 	 * @param  EE_Payment $payment EE_payment object
650 650
 	 * @return bool              success/fail
651 651
 	 */
652
-	public static function process_admin_payment( EE_Payment $payment ) {
653
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
652
+	public static function process_admin_payment(EE_Payment $payment) {
653
+		EE_Registry::instance()->load_helper('MSG_Template');
654 654
 		//we need to get the transaction object
655 655
 		$transaction = $payment->transaction();
656
-		if ( $transaction instanceof EE_Transaction ) {
657
-			$data = array( $transaction, $payment );
658
-			$message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() );
656
+		if ($transaction instanceof EE_Transaction) {
657
+			$data = array($transaction, $payment);
658
+			$message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
659 659
 
660 660
 			//if payment amount is less than 0 then switch to payment_refund message type.
661 661
 			$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
@@ -665,22 +665,22 @@  discard block
 block discarded – undo
665 665
 
666 666
 			self::_load_controller();
667 667
 
668
-			self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data );
668
+			self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
669 669
 
670 670
 			//get count of queued for generation
671
-			$count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( array( EEM_Message::status_incomplete, EEM_Message::status_idle ) );
671
+			$count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(array(EEM_Message::status_incomplete, EEM_Message::status_idle));
672 672
 
673
-			if ( $count_to_generate > 0 && self::$_MSG_PROCESSOR->get_queue()->get_message_repository()->count() !== 0 ) {
674
-				add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' );
673
+			if ($count_to_generate > 0 && self::$_MSG_PROCESSOR->get_queue()->get_message_repository()->count() !== 0) {
674
+				add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true');
675 675
 				return true;
676 676
 			} else {
677
-				$count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::instance()->stati_indicating_failed_sending() );
677
+				$count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::instance()->stati_indicating_failed_sending());
678 678
 				/**
679 679
 				 * Verify that there are actually errors.  If not then we return a success message because the queue might have been emptied due to successful
680 680
 				 * IMMEDIATE generation.
681 681
 				 */
682
-				if ( $count_failed > 0 ) {
683
-					EE_Error::add_error( sprintf(
682
+				if ($count_failed > 0) {
683
+					EE_Error::add_error(sprintf(
684 684
 						_n(
685 685
 							'The payment notification generation failed.',
686 686
 							'%d payment notifications failed being sent.',
@@ -688,11 +688,11 @@  discard block
 block discarded – undo
688 688
 							'event_espresso'
689 689
 						),
690 690
 						$count_failed
691
-					), __FILE__, __FUNCTION__, __LINE__ );
691
+					), __FILE__, __FUNCTION__, __LINE__);
692 692
 
693 693
 					return false;
694 694
 				} else {
695
-					add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' );
695
+					add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true');
696 696
 					return true;
697 697
 				}
698 698
 			}
@@ -716,11 +716,11 @@  discard block
 block discarded – undo
716 716
 	 * @param  int      	      $grp_id     a specific message template group id.
717 717
 	 * @return void
718 718
 	 */
719
-	public static function send_newsletter_message( $registrations, $grp_id ) {
719
+	public static function send_newsletter_message($registrations, $grp_id) {
720 720
 		//make sure mtp is id and set it in the EE_Request Handler later messages setup.
721
-		EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id );
721
+		EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id);
722 722
 		self::_load_controller();
723
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'newsletter', $registrations );
723
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('newsletter', $registrations);
724 724
 	}
725 725
 
726 726
 
@@ -735,9 +735,9 @@  discard block
 block discarded – undo
735 735
 	 * @param string 	$message_type
736 736
 	 * @return 	string
737 737
 	 */
738
-	public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) {
738
+	public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') {
739 739
 		// whitelist $messenger
740
-		switch ( $messenger ) {
740
+		switch ($messenger) {
741 741
 			case 'pdf' :
742 742
 				$sending_messenger = 'pdf';
743 743
 				$generating_messenger = 'html';
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 				break;
750 750
 		}
751 751
 		// whitelist $message_type
752
-		switch ( $message_type ) {
752
+		switch ($message_type) {
753 753
 			case 'receipt' :
754 754
 				$message_type = 'receipt';
755 755
 				break;
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 				break;
760 760
 		}
761 761
 		// verify that both the messenger AND the message type are active
762
-		if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type ) ) {
762
+		if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) {
763 763
 			//need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?)
764 764
 			$template_query_params = array(
765 765
 				'MTP_is_active' => true,
@@ -768,16 +768,16 @@  discard block
 block discarded – undo
768 768
 				'Event.EVT_ID' => $registration->event_ID()
769 769
 			);
770 770
 			//get the message template group.
771
-			$msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) );
771
+			$msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params));
772 772
 			//if we don't have an EE_Message_Template_Group then return
773
-			if ( ! $msg_template_group instanceof EE_Message_Template_Group ) {
773
+			if ( ! $msg_template_group instanceof EE_Message_Template_Group) {
774 774
 				// remove EVT_ID from query params so that global templates get picked up
775
-				unset( $template_query_params['Event.EVT_ID'] );
775
+				unset($template_query_params['Event.EVT_ID']);
776 776
 				//get global template as the fallback
777
-				$msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) );
777
+				$msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params));
778 778
 			}
779 779
 			//if we don't have an EE_Message_Template_Group then return
780
-			if ( ! $msg_template_group instanceof EE_Message_Template_Group ) {
780
+			if ( ! $msg_template_group instanceof EE_Message_Template_Group) {
781 781
 				return '';
782 782
 			}
783 783
 			// generate the URL
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 	 * @param bool 	  $send true we will do a test send using the messenger delivery, false we just do a regular preview
807 807
 	 * @return string|bool          The body of the message or if send is requested, sends.
808 808
 	 */
809
-	public static function preview_message( $type, $context, $messenger, $send = false ) {
809
+	public static function preview_message($type, $context, $messenger, $send = false) {
810 810
 		self::_load_controller();
811 811
 		$mtg = new EE_Message_To_Generate(
812 812
 			$messenger,
@@ -815,8 +815,8 @@  discard block
 block discarded – undo
815 815
 			$context,
816 816
 			true
817 817
 		);
818
-		$generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview( $mtg, $send );
819
-		if ( $generated_preview_queue instanceof EE_Messages_Queue ) {
818
+		$generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview($mtg, $send);
819
+		if ($generated_preview_queue instanceof EE_Messages_Queue) {
820 820
 			return $generated_preview_queue->get_message_repository()->current()->content();
821 821
 		} else {
822 822
 			return $generated_preview_queue;
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 	 *
844 844
 	 * @return bool          success or fail.
845 845
 	 */
846
-	public static function send_message_with_messenger_only( $messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '' ) {
846
+	public static function send_message_with_messenger_only($messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '') {
847 847
 		self::_load_controller();
848 848
 		/** @type EE_Message_To_Generate_From_Queue $message_to_generate */
849 849
 		$message_to_generate = EE_Registry::instance()->load_lib(
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 				$custom_subject,
856 856
 			)
857 857
 		);
858
-		return self::$_MSG_PROCESSOR->queue_for_sending( $message_to_generate );
858
+		return self::$_MSG_PROCESSOR->queue_for_sending($message_to_generate);
859 859
 	}
860 860
 
861 861
 
@@ -868,24 +868,24 @@  discard block
 block discarded – undo
868 868
 	 * @param array     $message_ids An array of message ids
869 869
 	 * @return bool | EE_Messages_Queue     false if nothing was generated, EE_Messages_Queue containing generated messages.
870 870
 	 */
871
-	public static function generate_now( $message_ids ) {
871
+	public static function generate_now($message_ids) {
872 872
 		self::_load_controller();
873 873
 		$messages = EEM_Message::instance()->get_all(
874 874
 			array(
875 875
 				0 => array(
876
-					'MSG_ID' => array( 'IN', $message_ids ),
876
+					'MSG_ID' => array('IN', $message_ids),
877 877
 					'STS_ID' => EEM_Message::status_incomplete,
878 878
 				)
879 879
 			)
880 880
 		);
881 881
 		$generated_queue = false;
882
-		if ( $messages ) {
883
-			$generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue( $messages );
882
+		if ($messages) {
883
+			$generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue($messages);
884 884
 		}
885 885
 
886
-		if ( ! $generated_queue instanceof EE_Messages_Queue ) {
886
+		if ( ! $generated_queue instanceof EE_Messages_Queue) {
887 887
 			EE_Error::add_error(
888
-				__( 'The messages were not generated. This could mean there is already a batch being generated on a separate request, or because the selected messages are not ready for generation. Please wait a minute or two and try again.', 'event_espresso' ),
888
+				__('The messages were not generated. This could mean there is already a batch being generated on a separate request, or because the selected messages are not ready for generation. Please wait a minute or two and try again.', 'event_espresso'),
889 889
 				__FILE__, __FUNCTION__, __LINE__
890 890
 			);
891 891
 		}
@@ -904,30 +904,30 @@  discard block
 block discarded – undo
904 904
 	 *
905 905
 	 * @return bool | EE_Messages_Queue  false if no messages sent.
906 906
 	 */
907
-	public static function send_now( $message_ids ) {
907
+	public static function send_now($message_ids) {
908 908
 		self::_load_controller();
909 909
 		$messages = EEM_Message::instance()->get_all(
910 910
 			array(
911 911
 				0 => array(
912
-					'MSG_ID' => array( 'IN', $message_ids ),
913
-					'STS_ID' => array( 'IN', array( EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry ) )
912
+					'MSG_ID' => array('IN', $message_ids),
913
+					'STS_ID' => array('IN', array(EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry))
914 914
 				)
915 915
 			)
916 916
 		);
917 917
 		$sent_queue = false;
918
-		if ( $messages ) {
919
-			$sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue( $messages );
918
+		if ($messages) {
919
+			$sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue($messages);
920 920
 		}
921 921
 
922
-		if ( ! $sent_queue instanceof EE_Messages_Queue ) {
922
+		if ( ! $sent_queue instanceof EE_Messages_Queue) {
923 923
 			EE_Error::add_error(
924
-				__( 'The messages were not sent. This could mean there is already a batch being sent on a separate request, or because the selected messages are not sendable. Please wait a minute or two and try again.', 'event_espresso' ),
924
+				__('The messages were not sent. This could mean there is already a batch being sent on a separate request, or because the selected messages are not sendable. Please wait a minute or two and try again.', 'event_espresso'),
925 925
 				__FILE__, __FUNCTION__, __LINE__
926 926
 			);
927 927
 		} else {
928 928
 			//can count how many sent by using the messages in the queue
929
-			$sent_count = $sent_queue->count_STS_in_queue( EEM_Message::instance()->stati_indicating_sent() );
930
-			if ( $sent_count > 0 ) {
929
+			$sent_count = $sent_queue->count_STS_in_queue(EEM_Message::instance()->stati_indicating_sent());
930
+			if ($sent_count > 0) {
931 931
 				EE_Error::add_success(
932 932
 					sprintf(
933 933
 						_n(
@@ -942,8 +942,8 @@  discard block
 block discarded – undo
942 942
 			} else {
943 943
 				EE_Error::overwrite_errors();
944 944
 				EE_Error::add_error(
945
-					__( 'No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error.
946
-					If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso' ),
945
+					__('No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error.
946
+					If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso'),
947 947
 					__FILE__, __FUNCTION__, __LINE__
948 948
 				);
949 949
 			}
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
 	 *
965 965
 	 * @return bool  true means messages were successfully queued for resending, false means none were queued for resending.
966 966
 	 */
967
-	public static function queue_for_resending( $message_ids ) {
967
+	public static function queue_for_resending($message_ids) {
968 968
 		self::_load_controller();
969
-		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( $message_ids );
969
+		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send($message_ids);
970 970
 
971 971
 		//get queue and count
972
-		$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend );
972
+		$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
973 973
 
974 974
 		if (
975 975
 			$queue_count > 0
@@ -989,11 +989,11 @@  discard block
 block discarded – undo
989 989
 		 * @see filter usage in EE_Messages_Queue::initiate_request_by_priority
990 990
 		 */
991 991
 		} elseif (
992
-			apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', true )
992
+			apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', true)
993 993
 			|| EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
994 994
 		) {
995
-			$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_sent );
996
-			if ( $queue_count > 0 ) {
995
+			$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_sent);
996
+			if ($queue_count > 0) {
997 997
 				EE_Error::add_success(
998 998
 					sprintf(
999 999
 						_n(
@@ -1007,13 +1007,13 @@  discard block
 block discarded – undo
1007 1007
 				);
1008 1008
 			} else {
1009 1009
 				EE_Error::add_error(
1010
-					__( 'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso' ),
1010
+					__('No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso'),
1011 1011
 					__FILE__, __FUNCTION__, __LINE__
1012 1012
 				);
1013 1013
 			}
1014 1014
 		} else {
1015 1015
 			EE_Error::add_error(
1016
-				__( 'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso' ),
1016
+				__('No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso'),
1017 1017
 				__FILE__, __FUNCTION__, __LINE__
1018 1018
 			);
1019 1019
 		}
@@ -1035,16 +1035,16 @@  discard block
 block discarded – undo
1035 1035
 	 * @param array $info
1036 1036
 	 * @param bool $display_request
1037 1037
 	 */
1038
-	protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) {
1039
-		if ( WP_DEBUG && false ) {
1040
-			if ( $transaction instanceof EE_Transaction ) {
1038
+	protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) {
1039
+		if (WP_DEBUG && false) {
1040
+			if ($transaction instanceof EE_Transaction) {
1041 1041
 				// don't serialize objects
1042
-				$info = EEH_Debug_Tools::strip_objects( $info );
1042
+				$info = EEH_Debug_Tools::strip_objects($info);
1043 1043
 				$info['TXN_status'] = $transaction->status_ID();
1044 1044
 				$info['TXN_reg_steps'] = $transaction->reg_steps();
1045
-				if ( $transaction->ID() ) {
1046
-					$index = 'EE_Transaction: ' . $transaction->ID();
1047
-					EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index );
1045
+				if ($transaction->ID()) {
1046
+					$index = 'EE_Transaction: '.$transaction->ID();
1047
+					EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index);
1048 1048
 				}
1049 1049
 			}
1050 1050
 		}
Please login to merge, or discard this patch.
templates/txn_admin_details_main_meta_box_attendees.template.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -5,25 +5,25 @@
 block discarded – undo
5 5
 		<table class="admin-primary-mbox-tbl">
6 6
 			<thead>
7 7
 				<tr>
8
-					<th class="jst-left"><?php _e( '#', 'event_espresso' );?></th>
9
-					<th class="jst-left"><?php _e( 'Event Name and Ticket', 'event_espresso' );?></th>
10
-					<th class="jst-left"><?php _e( 'Registrant', 'event_espresso' );?></th>
11
-					<th class="jst-left"><?php _e( 'Ticket Price', 'event_espresso' );?></th>
12
-					<th class="jst-left"><?php _e( 'Email', 'event_espresso' );?></th>
13
-					<th class="jst-left"><?php _e( 'Address', 'event_espresso' );?></th>
8
+					<th class="jst-left"><?php _e('#', 'event_espresso'); ?></th>
9
+					<th class="jst-left"><?php _e('Event Name and Ticket', 'event_espresso'); ?></th>
10
+					<th class="jst-left"><?php _e('Registrant', 'event_espresso'); ?></th>
11
+					<th class="jst-left"><?php _e('Ticket Price', 'event_espresso'); ?></th>
12
+					<th class="jst-left"><?php _e('Email', 'event_espresso'); ?></th>
13
+					<th class="jst-left"><?php _e('Address', 'event_espresso'); ?></th>
14 14
 				</tr>
15 15
 			</thead>
16 16
 			<tbody>
17
-		<?php if ( isset( $event_attendees ) && is_array( $event_attendees )) : ?>
18
-			<?php foreach ( $event_attendees as $registration => $attendee ) : ?>
17
+		<?php if (isset($event_attendees) && is_array($event_attendees)) : ?>
18
+			<?php foreach ($event_attendees as $registration => $attendee) : ?>
19 19
 				<tr>
20
-					<td class="jst-left"><?php echo $attendee['att_num'];?></td>
21
-					<td class="jst-left"><?php echo $attendee['event_ticket_name'];?></td>
20
+					<td class="jst-left"><?php echo $attendee['att_num']; ?></td>
21
+					<td class="jst-left"><?php echo $attendee['event_ticket_name']; ?></td>
22 22
 					<td class="jst-left">
23 23
 						<?php
24
-						$att_link = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration), REG_ADMIN_URL );
24
+						$att_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration), REG_ADMIN_URL);
25 25
 						?>
26
-						<a href="<?php echo $att_link; ?>" title="<?php _e( 'View details for this registrant', 'event_espresso' );?>">
26
+						<a href="<?php echo $att_link; ?>" title="<?php _e('View details for this registrant', 'event_espresso'); ?>">
27 27
 							<?php echo $attendee['attendee']?>
28 28
 						</a>
29 29
 					</td>
Please login to merge, or discard this patch.
core/db_classes/EE_Registration.class.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -649,8 +649,9 @@
 block discarded – undo
649 649
 	 * @return EE_Registration
650 650
 	 */
651 651
 	public function get_primary_registration()  {
652
-		if ( $this->is_primary_registrant() )
653
-			return $this;
652
+		if ( $this->is_primary_registrant() ) {
653
+					return $this;
654
+		}
654 655
 
655 656
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
656 657
 		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
Please login to merge, or discard this patch.
Spacing   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\EntityNotFoundException;
2 2
 
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 /**
7 7
  * EE_Registration class
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	 *                             		    date_format and the second value is the time format
44 44
 	 * @return EE_Registration
45 45
 	 */
46
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
47
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
48
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
46
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
47
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
48
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
49 49
 	}
50 50
 
51 51
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 *                          		the website will be used.
57 57
 	 * @return EE_Registration
58 58
 	 */
59
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
60
-		return new self( $props_n_values, TRUE, $timezone );
59
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
60
+		return new self($props_n_values, TRUE, $timezone);
61 61
 	}
62 62
 
63 63
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @access        public
69 69
 	 * @param        int $EVT_ID Event ID
70 70
 	 */
71
-	public function set_event( $EVT_ID = 0 ) {
72
-		$this->set( 'EVT_ID', $EVT_ID );
71
+	public function set_event($EVT_ID = 0) {
72
+		$this->set('EVT_ID', $EVT_ID);
73 73
 	}
74 74
 
75 75
 
@@ -80,18 +80,18 @@  discard block
 block discarded – undo
80 80
 	 * @param mixed  $field_value
81 81
 	 * @param bool   $use_default
82 82
 	 */
83
-	public function set( $field_name, $field_value, $use_default = FALSE ) {
84
-		switch( $field_name ) {
83
+	public function set($field_name, $field_value, $use_default = FALSE) {
84
+		switch ($field_name) {
85 85
 			case 'REG_code' :
86
-				if ( ! empty( $field_value ) && $this->reg_code() == '' ) {
87
-					$this->set_reg_code( $field_value, $use_default );
86
+				if ( ! empty($field_value) && $this->reg_code() == '') {
87
+					$this->set_reg_code($field_value, $use_default);
88 88
 				}
89 89
 				break;
90 90
 			case 'STS_ID' :
91
-				$this->set_status( $field_value, $use_default );
91
+				$this->set_status($field_value, $use_default);
92 92
 				break;
93 93
 			default :
94
-				parent::set( $field_name, $field_value, $use_default );
94
+				parent::set($field_name, $field_value, $use_default);
95 95
 		}
96 96
 	}
97 97
 
@@ -109,42 +109,42 @@  discard block
 block discarded – undo
109 109
 	 * @return bool
110 110
 	 * @throws \EE_Error
111 111
 	 */
112
-	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
112
+	public function set_status($new_STS_ID = NULL, $use_default = FALSE) {
113 113
 		// get current REG_Status
114 114
 		$old_STS_ID = $this->status_ID();
115 115
 		// if status has changed
116 116
 		if (
117 117
 			$this->ID() // ensure registration is in the db
118 118
 			&& $old_STS_ID != $new_STS_ID // and that status has actually changed
119
-			&& ! empty( $old_STS_ID ) // and that old status is actually set
120
-			&& ! empty( $new_STS_ID ) // as well as the new status
119
+			&& ! empty($old_STS_ID) // and that old status is actually set
120
+			&& ! empty($new_STS_ID) // as well as the new status
121 121
 		) {
122 122
 			// TO approved
123
-			if ( $new_STS_ID === EEM_Registration::status_id_approved ) {
123
+			if ($new_STS_ID === EEM_Registration::status_id_approved) {
124 124
 				// reserve a space by incrementing ticket and datetime sold values
125 125
 				$this->_reserve_registration_space();
126
-				do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID );
126
+				do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID);
127 127
 			// OR FROM  approved
128
-			} else if ( $old_STS_ID === EEM_Registration::status_id_approved ) {
128
+			} else if ($old_STS_ID === EEM_Registration::status_id_approved) {
129 129
 				// release a space by decrementing ticket and datetime sold values
130 130
 				$this->_release_registration_space();
131
-				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
131
+				do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID);
132 132
 			}
133 133
 			// update status
134
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
134
+			parent::set('STS_ID', $new_STS_ID, $use_default);
135 135
 			/** @type EE_Registration_Processor $registration_processor */
136
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
136
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
137 137
 			/** @type EE_Transaction_Processor $transaction_processor */
138
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
138
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
139 139
 			/** @type EE_Transaction_Payments $transaction_payments */
140
-			$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
140
+			$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
141 141
 			// these reg statuses should not be considered in any calculations involving monies owing
142
-			$closed_reg_statuses = ! empty( $closed_reg_statuses )
142
+			$closed_reg_statuses = ! empty($closed_reg_statuses)
143 143
 				? $closed_reg_statuses
144 144
 				: EEM_Registration::closed_reg_statuses();
145 145
 			if (
146
-				in_array( $new_STS_ID, $closed_reg_statuses )
147
-				&& ! in_array( $old_STS_ID, $closed_reg_statuses )
146
+				in_array($new_STS_ID, $closed_reg_statuses)
147
+				&& ! in_array($old_STS_ID, $closed_reg_statuses)
148 148
 			) {
149 149
 				// cancelled or declined registration
150 150
 				$registration_processor->update_registration_after_being_canceled_or_declined(
@@ -157,24 +157,24 @@  discard block
 block discarded – undo
157 157
 					false
158 158
 				);
159 159
 			} else if (
160
-				in_array( $old_STS_ID, $closed_reg_statuses )
161
-				&& ! in_array( $new_STS_ID, $closed_reg_statuses )
160
+				in_array($old_STS_ID, $closed_reg_statuses)
161
+				&& ! in_array($new_STS_ID, $closed_reg_statuses)
162 162
 			) {
163 163
 				// reinstating cancelled or declined registration
164 164
 				$registration_processor->update_canceled_or_declined_registration_after_being_reinstated(
165 165
 					$this,
166 166
 					$closed_reg_statuses
167 167
 				);
168
-				$transaction_processor->update_transaction_after_reinstating_canceled_registration( $this );
168
+				$transaction_processor->update_transaction_after_reinstating_canceled_registration($this);
169 169
 			}
170
-			$transaction_payments->recalculate_transaction_total( $this->transaction(), false );
171
-			$transaction_payments->update_transaction_status_based_on_total_paid( $this->transaction(), true );
172
-			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
170
+			$transaction_payments->recalculate_transaction_total($this->transaction(), false);
171
+			$transaction_payments->update_transaction_status_based_on_total_paid($this->transaction(), true);
172
+			do_action('AHEE__EE_Registration__set_status__after_update', $this);
173 173
 			return TRUE;
174 174
 		} else {
175 175
 			//even though the old value matches the new value, it's still good to
176 176
 			//allow the parent set method to have a say
177
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
177
+			parent::set('STS_ID', $new_STS_ID, $use_default);
178 178
 			return TRUE;
179 179
 		}
180 180
 	}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @access        public
187 187
 	 */
188 188
 	public function status_ID() {
189
-		return $this->get( 'STS_ID' );
189
+		return $this->get('STS_ID');
190 190
 	}
191 191
 
192 192
 
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
 	 * @param boolean $include_archived whether to include archived tickets or not.
212 212
 	 * @return EE_Ticket
213 213
 	 */
214
-	public function ticket( $include_archived = TRUE ) {
214
+	public function ticket($include_archived = TRUE) {
215 215
 		$query_params = array();
216
-		if ( $include_archived ) {
217
-			$query_params[ 'default_where_conditions' ] = 'none';
216
+		if ($include_archived) {
217
+			$query_params['default_where_conditions'] = 'none';
218 218
 		}
219
-		return $this->get_first_related( 'Ticket', $query_params );
219
+		return $this->get_first_related('Ticket', $query_params);
220 220
 	}
221 221
 
222 222
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function wp_user() {
246 246
 		$event = $this->event();
247
-		if ( $event instanceof EE_Event ) {
247
+		if ($event instanceof EE_Event) {
248 248
 			return $event->wp_user();
249 249
 		}
250 250
 		return 0;
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 * @access        public
271 271
 	 * @param        int $ATT_ID Attendee ID
272 272
 	 */
273
-	public function set_attendee_id( $ATT_ID = 0 ) {
274
-		$this->set( 'ATT_ID', $ATT_ID );
273
+	public function set_attendee_id($ATT_ID = 0) {
274
+		$this->set('ATT_ID', $ATT_ID);
275 275
 	}
276 276
 
277 277
 
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 	 * @access        public
283 283
 	 * @param        int $TXN_ID Transaction ID
284 284
 	 */
285
-	public function set_transaction_id( $TXN_ID = 0 ) {
286
-		$this->set( 'TXN_ID', $TXN_ID );
285
+	public function set_transaction_id($TXN_ID = 0) {
286
+		$this->set('TXN_ID', $TXN_ID);
287 287
 	}
288 288
 
289 289
 
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
 	 * @access    public
295 295
 	 * @param    string $REG_session PHP Session ID
296 296
 	 */
297
-	public function set_session( $REG_session = '' ) {
298
-		$this->set( 'REG_session', $REG_session );
297
+	public function set_session($REG_session = '') {
298
+		$this->set('REG_session', $REG_session);
299 299
 	}
300 300
 
301 301
 
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
 	 * @access    public
307 307
 	 * @param    string $REG_url_link Registration URL Link
308 308
 	 */
309
-	public function set_reg_url_link( $REG_url_link = '' ) {
310
-		$this->set( 'REG_url_link', $REG_url_link );
309
+	public function set_reg_url_link($REG_url_link = '') {
310
+		$this->set('REG_url_link', $REG_url_link);
311 311
 	}
312 312
 
313 313
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 	 * @access        public
319 319
 	 * @param        int $REG_count Primary Attendee
320 320
 	 */
321
-	public function set_count( $REG_count = 1 ) {
322
-		$this->set( 'REG_count', $REG_count );
321
+	public function set_count($REG_count = 1) {
322
+		$this->set('REG_count', $REG_count);
323 323
 	}
324 324
 
325 325
 
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 	 * @access        public
331 331
 	 * @param        boolean $REG_group_size Group Registration
332 332
 	 */
333
-	public function set_group_size( $REG_group_size = FALSE ) {
334
-		$this->set( 'REG_group_size', $REG_group_size );
333
+	public function set_group_size($REG_group_size = FALSE) {
334
+		$this->set('REG_group_size', $REG_group_size);
335 335
 	}
336 336
 
337 337
 
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 	 * @access        public
415 415
 	 * @param        mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date
416 416
 	 */
417
-	public function set_reg_date( $REG_date = FALSE ) {
418
-		$this->set( 'REG_date', $REG_date );
417
+	public function set_reg_date($REG_date = FALSE) {
418
+		$this->set('REG_date', $REG_date);
419 419
 	}
420 420
 
421 421
 
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 	 * @access    public
427 427
 	 * @param    float $REG_final_price
428 428
 	 */
429
-	public function set_final_price( $REG_final_price = 0.00 ) {
430
-		$this->set( 'REG_final_price', $REG_final_price );
429
+	public function set_final_price($REG_final_price = 0.00) {
430
+		$this->set('REG_final_price', $REG_final_price);
431 431
 	}
432 432
 
433 433
 
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 	 * @access    public
439 439
 	 * @param    float $REG_paid
440 440
 	 */
441
-	public function set_paid( $REG_paid = 0.00 ) {
442
-		$this->set( 'REG_paid', $REG_paid );
441
+	public function set_paid($REG_paid = 0.00) {
442
+		$this->set('REG_paid', $REG_paid);
443 443
 	}
444 444
 
445 445
 
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 	 * @access        public
451 451
 	 * @param        boolean $REG_att_is_going Attendee Is Going
452 452
 	 */
453
-	public function set_att_is_going( $REG_att_is_going = FALSE ) {
454
-		$this->set( 'REG_att_is_going', $REG_att_is_going );
453
+	public function set_att_is_going($REG_att_is_going = FALSE) {
454
+		$this->set('REG_att_is_going', $REG_att_is_going);
455 455
 	}
456 456
 
457 457
 
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	 * @return EE_Attendee
462 462
 	 */
463 463
 	public function attendee() {
464
-		return $this->get_first_related( 'Attendee' );
464
+		return $this->get_first_related('Attendee');
465 465
 	}
466 466
 
467 467
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 * @access        public
472 472
 	 */
473 473
 	public function event_ID() {
474
-		return $this->get( 'EVT_ID' );
474
+		return $this->get('EVT_ID');
475 475
 	}
476 476
 
477 477
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 	 */
483 483
 	public function event_name() {
484 484
 		$event = $this->event_obj();
485
-		if ( $event ) {
485
+		if ($event) {
486 486
 			return $event->name();
487 487
 		} else {
488 488
 			return NULL;
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 * @return EE_Event
497 497
 	 */
498 498
 	public function event_obj() {
499
-		return $this->get_first_related( 'Event' );
499
+		return $this->get_first_related('Event');
500 500
 	}
501 501
 
502 502
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	 * @access        public
507 507
 	 */
508 508
 	public function attendee_ID() {
509
-		return $this->get( 'ATT_ID' );
509
+		return $this->get('ATT_ID');
510 510
 	}
511 511
 
512 512
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	 * @access        public
517 517
 	 */
518 518
 	public function session_ID() {
519
-		return $this->get( 'REG_session' );
519
+		return $this->get('REG_session');
520 520
 	}
521 521
 
522 522
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
527 527
 	 * @return string
528 528
 	 */
529
-	public function receipt_url( $messenger = 'html' ) {
529
+	public function receipt_url($messenger = 'html') {
530 530
 
531 531
 		/**
532 532
 		 * The below will be deprecated one version after this.  We check first if there is a custom receipt template already in use on old system.  If there is then we just return the standard url for it.
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
 		 * @since 4.5.0
535 535
 		 */
536 536
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php';
537
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
537
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
538 538
 
539
-		if ( $has_custom ) {
540
-			return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) );
539
+		if ($has_custom) {
540
+			return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch'));
541 541
 		}
542
-		return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' );
542
+		return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt');
543 543
 	}
544 544
 
545 545
 
@@ -550,28 +550,28 @@  discard block
 block discarded – undo
550 550
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
551 551
 	 * @return string
552 552
 	 */
553
-	public function invoice_url( $messenger = 'html' ) {
553
+	public function invoice_url($messenger = 'html') {
554 554
 		/**
555 555
 		 * The below will be deprecated one version after this.  We check first if there is a custom invoice template already in use on old system.  If there is then we just return the standard url for it.
556 556
 		 *
557 557
 		 * @since 4.5.0
558 558
 		 */
559 559
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php';
560
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
560
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
561 561
 
562
-		if ( $has_custom ) {
563
-			if ( $messenger == 'html' ) {
564
-				return $this->invoice_url( 'launch' );
562
+		if ($has_custom) {
563
+			if ($messenger == 'html') {
564
+				return $this->invoice_url('launch');
565 565
 			}
566 566
 			$route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice';
567 567
 
568
-			$query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() );
569
-			if ( $messenger == 'html' ) {
568
+			$query_args = array('ee' => $route, 'id' => $this->reg_url_link());
569
+			if ($messenger == 'html') {
570 570
 				$query_args['html'] = TRUE;
571 571
 			}
572
-			return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) );
572
+			return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
573 573
 		}
574
-		return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' );
574
+		return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice');
575 575
 	}
576 576
 
577 577
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 	 * @throws \EE_Error
585 585
 	 */
586 586
 	public function reg_url_link() {
587
-		return (string)$this->get( 'REG_url_link' );
587
+		return (string) $this->get('REG_url_link');
588 588
 	}
589 589
 
590 590
 
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
 	 * @param string $type 'download','launch', or 'html' (default is 'launch')
595 595
 	 * @return void
596 596
 	 */
597
-	public function e_invoice_url( $type = 'launch' ) {
598
-		echo $this->invoice_url( $type );
597
+	public function e_invoice_url($type = 'launch') {
598
+		echo $this->invoice_url($type);
599 599
 	}
600 600
 
601 601
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @return string
616 616
 	 */
617 617
 	public function payment_overview_url() {
618
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
618
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
619 619
 	}
620 620
 
621 621
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 	 * @return string
627 627
 	 */
628 628
 	public function edit_attendee_information_url() {
629
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
629
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
630 630
 	}
631 631
 
632 632
 
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 	 * @return string
637 637
 	 */
638 638
 	public function get_admin_edit_url() {
639
-		return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) );
639
+		return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php'));
640 640
 	}
641 641
 
642 642
 
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 * @access        public
647 647
 	 */
648 648
 	public function is_primary_registrant() {
649
-		return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE;
649
+		return $this->get('REG_count') == 1 ? TRUE : FALSE;
650 650
 	}
651 651
 
652 652
 
@@ -655,12 +655,12 @@  discard block
 block discarded – undo
655 655
 	 * This returns the primary registration object for this registration group (which may be this object).
656 656
 	 * @return EE_Registration
657 657
 	 */
658
-	public function get_primary_registration()  {
659
-		if ( $this->is_primary_registrant() )
658
+	public function get_primary_registration() {
659
+		if ($this->is_primary_registrant())
660 660
 			return $this;
661 661
 
662 662
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
663
-		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
663
+		$primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1)));
664 664
 		return $primary_registrant;
665 665
 	}
666 666
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	* 		@access		public
672 672
 	*/
673 673
 	public function count() {
674
-		return $this->get( 'REG_count' );
674
+		return $this->get('REG_count');
675 675
 	}
676 676
 
677 677
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	 * @access        public
682 682
 	 */
683 683
 	public function group_size() {
684
-		return $this->get( 'REG_group_size' );
684
+		return $this->get('REG_group_size');
685 685
 	}
686 686
 
687 687
 
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	 * @access        public
692 692
 	 */
693 693
 	public function date() {
694
-		return $this->get( 'REG_date' );
694
+		return $this->get('REG_date');
695 695
 	}
696 696
 
697 697
 
@@ -702,8 +702,8 @@  discard block
 block discarded – undo
702 702
 	 * @param string $time_format
703 703
 	 * @return string
704 704
 	 */
705
-	public function pretty_date( $date_format = NULL, $time_format = NULL ) {
706
-		return $this->get_datetime( 'REG_date', $date_format, $time_format );
705
+	public function pretty_date($date_format = NULL, $time_format = NULL) {
706
+		return $this->get_datetime('REG_date', $date_format, $time_format);
707 707
 	}
708 708
 
709 709
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 	 * @return    float
717 717
 	 */
718 718
 	public function final_price() {
719
-		return $this->get( 'REG_final_price' );
719
+		return $this->get('REG_final_price');
720 720
 	}
721 721
 
722 722
 
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	 * @return string
728 728
 	 */
729 729
 	public function pretty_final_price() {
730
-		return $this->get_pretty( 'REG_final_price' );
730
+		return $this->get_pretty('REG_final_price');
731 731
 	}
732 732
 
733 733
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 	 * @return 	float
739 739
 	 */
740 740
 	public function paid() {
741
-		return $this->get( 'REG_paid' );
741
+		return $this->get('REG_paid');
742 742
 	}
743 743
 
744 744
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	 * @return 	float
750 750
 	 */
751 751
 	public function pretty_paid() {
752
-		return $this->get_pretty( 'REG_paid' );
752
+		return $this->get_pretty('REG_paid');
753 753
 	}
754 754
 
755 755
 
@@ -761,11 +761,11 @@  discard block
 block discarded – undo
761 761
 	 * @param array $requires_payment
762 762
 	 * @return bool
763 763
 	 */
764
-	public function owes_monies_and_can_pay( $requires_payment = array()) {
764
+	public function owes_monies_and_can_pay($requires_payment = array()) {
765 765
 		// these reg statuses require payment (if event is not free)
766
-		$requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
766
+		$requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
767 767
 		if (
768
-			in_array( $this->status_ID(), $requires_payment ) &&
768
+			in_array($this->status_ID(), $requires_payment) &&
769 769
 			$this->final_price() != 0 &&
770 770
 			$this->final_price() != $this->paid()
771 771
 		) {
@@ -782,8 +782,8 @@  discard block
 block discarded – undo
782 782
 	 * @param bool $show_icons
783 783
 	 * @return void
784 784
 	 */
785
-	public function e_pretty_status( $show_icons = FALSE ) {
786
-		echo $this->pretty_status( $show_icons );
785
+	public function e_pretty_status($show_icons = FALSE) {
786
+		echo $this->pretty_status($show_icons);
787 787
 	}
788 788
 
789 789
 
@@ -794,10 +794,10 @@  discard block
 block discarded – undo
794 794
 	 * @param bool $show_icons
795 795
 	 * @return string
796 796
 	 */
797
-	public function pretty_status( $show_icons = FALSE ) {
798
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
797
+	public function pretty_status($show_icons = FALSE) {
798
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
799 799
 		$icon = '';
800
-		switch ( $this->status_ID() ) {
800
+		switch ($this->status_ID()) {
801 801
 			case EEM_Registration::status_id_approved:
802 802
 				$icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : '';
803 803
 				break;
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 				$icon = $show_icons ? '<span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>' : '';
821 821
 				break;
822 822
 		}
823
-		return $icon . $status[ $this->status_ID() ];
823
+		return $icon.$status[$this->status_ID()];
824 824
 	}
825 825
 
826 826
 
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 	 * @access        public
831 831
 	 */
832 832
 	public function att_is_going() {
833
-		return $this->get( 'REG_att_is_going' );
833
+		return $this->get('REG_att_is_going');
834 834
 	}
835 835
 
836 836
 
@@ -840,8 +840,8 @@  discard block
 block discarded – undo
840 840
 	 * @param array $query_params like EEM_Base::get_all
841 841
 	 * @return EE_Answer[]
842 842
 	 */
843
-	public function answers( $query_params = NULL ) {
844
-		return $this->get_many_related( 'Answer', $query_params );
843
+	public function answers($query_params = NULL) {
844
+		return $this->get_many_related('Answer', $query_params);
845 845
 	}
846 846
 
847 847
 
@@ -855,9 +855,9 @@  discard block
 block discarded – undo
855 855
 	 * (because the answer might be an array of answer values, so passing pretty_value=true
856 856
 	 * will convert it into some kind of string)
857 857
 	 */
858
-	public function answer_value_to_question( $question, $pretty_value=true ) {
858
+	public function answer_value_to_question($question, $pretty_value = true) {
859 859
 		$question_id = EEM_Question::instance()->ensure_is_ID($question);
860
-		return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value);
860
+		return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value);
861 861
 	}
862 862
 
863 863
 
@@ -870,13 +870,13 @@  discard block
 block discarded – undo
870 870
 	 */
871 871
 	public function question_groups() {
872 872
 		$question_groups = array();
873
-		if ( $this->event() instanceof EE_Event ) {
873
+		if ($this->event() instanceof EE_Event) {
874 874
 			$question_groups = $this->event()->question_groups(
875 875
 				array(
876 876
 					array(
877 877
 						'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false
878 878
 					),
879
-					'order_by' => array( 'QSG_order' => 'ASC' )
879
+					'order_by' => array('QSG_order' => 'ASC')
880 880
 				)
881 881
 			);
882 882
 		}
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 	 */
894 894
 	public function count_question_groups() {
895 895
 		$qg_count = 0;
896
-		if ( $this->event() instanceof EE_Event ) {
896
+		if ($this->event() instanceof EE_Event) {
897 897
 			$qg_count = $this->event()->count_related(
898 898
 				'Question_Group',
899 899
 				array(
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 	 * @return string
915 915
 	 */
916 916
 	public function reg_date() {
917
-		return $this->get_datetime( 'REG_date' );
917
+		return $this->get_datetime('REG_date');
918 918
 	}
919 919
 
920 920
 
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 	 * @return EE_Datetime_Ticket
927 927
 	 */
928 928
 	public function datetime_ticket() {
929
-		return $this->get_first_related( 'Datetime_Ticket' );
929
+		return $this->get_first_related('Datetime_Ticket');
930 930
 	}
931 931
 
932 932
 
@@ -936,15 +936,15 @@  discard block
 block discarded – undo
936 936
 	 * @param EE_Datetime_Ticket $datetime_ticket
937 937
 	 * @return EE_Datetime_Ticket
938 938
 	 */
939
-	public function set_datetime_ticket( $datetime_ticket ) {
940
-		return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' );
939
+	public function set_datetime_ticket($datetime_ticket) {
940
+		return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket');
941 941
 	}
942 942
 	/**
943 943
 	 * Gets deleted
944 944
 	 * @return boolean
945 945
 	 */
946 946
 	public function deleted() {
947
-		return $this->get( 'REG_deleted' );
947
+		return $this->get('REG_deleted');
948 948
 	}
949 949
 
950 950
 	/**
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 	 * @return boolean
954 954
 	 */
955 955
 	public function set_deleted($deleted) {
956
-		$this->set( 'REG_deleted', $deleted );
956
+		$this->set('REG_deleted', $deleted);
957 957
 	}
958 958
 
959 959
 
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 	 * @return EE_Status
964 964
 	 */
965 965
 	public function status_obj() {
966
-		return $this->get_first_related( 'Status' );
966
+		return $this->get_first_related('Status');
967 967
 	}
968 968
 
969 969
 
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 	 * @return int
975 975
 	 */
976 976
 	public function count_checkins() {
977
-		return $this->get_model()->count_related( $this, 'Checkin' );
977
+		return $this->get_model()->count_related($this, 'Checkin');
978 978
 	}
979 979
 
980 980
 
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 	 * @return int
985 985
 	 */
986 986
 	public function count_checkins_not_checkedout() {
987
-		return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) );
987
+		return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1)));
988 988
 	}
989 989
 
990 990
 
@@ -997,20 +997,20 @@  discard block
 block discarded – undo
997 997
 	 *
998 998
 	 * @return bool
999 999
 	 */
1000
-	public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) {
1001
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
1000
+	public function can_checkin($DTT_OR_ID, $check_approved = TRUE) {
1001
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
1002 1002
 
1003 1003
 		//first check registration status
1004
-		if (  ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) {
1004
+		if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) {
1005 1005
 			return false;
1006 1006
 		}
1007 1007
 		//is there a datetime ticket that matches this dtt_ID?
1008
-		if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) {
1008
+		if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) {
1009 1009
 			return false;
1010 1010
 		}
1011 1011
 
1012 1012
 		//final check is against TKT_uses
1013
-		return $this->verify_can_checkin_against_TKT_uses( $DTT_ID );
1013
+		return $this->verify_can_checkin_against_TKT_uses($DTT_ID);
1014 1014
 	}
1015 1015
 
1016 1016
 
@@ -1023,10 +1023,10 @@  discard block
 block discarded – undo
1023 1023
 	 * @param int | EE_Datetime  $DTT_OR_ID  The datetime the registration is being checked against
1024 1024
 	 * @return bool   true means can checkin.  false means cannot checkin.
1025 1025
 	 */
1026
-	public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) {
1027
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
1026
+	public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) {
1027
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
1028 1028
 
1029
-		if ( ! $DTT_ID ) {
1029
+		if ( ! $DTT_ID) {
1030 1030
 			return false;
1031 1031
 		}
1032 1032
 
@@ -1034,23 +1034,23 @@  discard block
 block discarded – undo
1034 1034
 
1035 1035
 		// if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in
1036 1036
 		// or not.
1037
-		if ( ! $max_uses || $max_uses === EE_INF ) {
1037
+		if ( ! $max_uses || $max_uses === EE_INF) {
1038 1038
 			return true;
1039 1039
 		}
1040 1040
 
1041 1041
 		//does this datetime have a checkin record?  If so, then the dtt count has already been verified so we can just
1042 1042
 		//go ahead and toggle.
1043
-		if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) {
1043
+		if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) {
1044 1044
 			return true;
1045 1045
 		}
1046 1046
 
1047 1047
 		//made it here so the last check is whether the number of checkins per unique datetime on this registration
1048 1048
 		//disallows further check-ins.
1049
-		$count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true );
1049
+		$count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true);
1050 1050
 		// checkins have already reached their max number of uses
1051 1051
 		// so registrant can NOT checkin
1052
-		if ( $count_unique_dtt_checkins >= $max_uses ) {
1053
-			EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1052
+		if ($count_unique_dtt_checkins >= $max_uses) {
1053
+			EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1054 1054
 			return false;
1055 1055
 		}
1056 1056
 		return true;
@@ -1071,15 +1071,15 @@  discard block
 block discarded – undo
1071 1071
 	 * @param  bool $verify  If true then can_checkin() is used to verify whether the person can be checked in or not.  Otherwise this forces change in checkin status.
1072 1072
 	 * @return int|BOOL            the chk_in status toggled to OR false if nothing got changed.
1073 1073
 	 */
1074
-	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1075
-		if ( empty( $DTT_ID ) ) {
1074
+	public function toggle_checkin_status($DTT_ID = null, $verify = false) {
1075
+		if (empty($DTT_ID)) {
1076 1076
 			$datetime = $this->get_related_primary_datetime();
1077 1077
 			$DTT_ID = $datetime->ID();
1078 1078
 		// verify the registration can checkin for the given DTT_ID
1079
-		} elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) {
1079
+		} elseif ( ! $this->can_checkin($DTT_ID, $verify)) {
1080 1080
 			EE_Error::add_error(
1081 1081
 					sprintf(
1082
-						__( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1082
+						__('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1083 1083
 						$this->ID(),
1084 1084
 						$DTT_ID
1085 1085
 					),
@@ -1093,8 +1093,8 @@  discard block
 block discarded – undo
1093 1093
 			EE_Registration::checkin_status_out => EE_Registration::checkin_status_in
1094 1094
 		);
1095 1095
 		//start by getting the current status so we know what status we'll be changing to.
1096
-		$cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL );
1097
-		$status_to = $status_paths[ $cur_status ];
1096
+		$cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL);
1097
+		$status_to = $status_paths[$cur_status];
1098 1098
 		// database only records true for checked IN or false for checked OUT
1099 1099
 		// no record ( null ) means checked in NEVER, but we obviously don't save that
1100 1100
 		$new_status = $status_to == EE_Registration::checkin_status_in ? true : false;
@@ -1102,24 +1102,24 @@  discard block
 block discarded – undo
1102 1102
 		// because we are keeping track of Check-ins over time.
1103 1103
 		// Eventually we'll probably want to show a list table
1104 1104
 		// for the individual Check-ins so that they can be managed.
1105
-		$checkin = EE_Checkin::new_instance( array(
1105
+		$checkin = EE_Checkin::new_instance(array(
1106 1106
 				'REG_ID' => $this->ID(),
1107 1107
 				'DTT_ID' => $DTT_ID,
1108 1108
 				'CHK_in' => $new_status
1109
-		) );
1109
+		));
1110 1110
 		// if the record could not be saved then return false
1111
-		if ( $checkin->save() === 0 ) {
1112
-			if ( WP_DEBUG ) {
1111
+		if ($checkin->save() === 0) {
1112
+			if (WP_DEBUG) {
1113 1113
 				global $wpdb;
1114 1114
 				$error = sprintf(
1115
-					__( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ),
1115
+					__('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'),
1116 1116
 					'<br />',
1117 1117
 					$wpdb->last_error
1118 1118
 				);
1119 1119
 			} else {
1120
-				$error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' );
1120
+				$error = __('Registration check in update failed because of an unknown database error', 'event_espresso');
1121 1121
 			}
1122
-			EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
1122
+			EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
1123 1123
 			return false;
1124 1124
 		}
1125 1125
 		return $status_to;
@@ -1143,19 +1143,19 @@  discard block
 block discarded – undo
1143 1143
 	 * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1144 1144
 	 * @return int            Integer representing Check-in status.
1145 1145
 	 */
1146
-	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) {
1147
-		if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) {
1146
+	public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) {
1147
+		if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) {
1148 1148
 			$datetime = $this->get_related_primary_datetime();
1149
-			if ( ! $datetime instanceof EE_Datetime ) {
1149
+			if ( ! $datetime instanceof EE_Datetime) {
1150 1150
 				return 0;
1151 1151
 			}
1152 1152
 			$DTT_ID = $datetime->ID();
1153 1153
 		//verify the registration can checkin for the given DTT_ID
1154 1154
 		}
1155 1155
 		//get checkin object (if exists)
1156
-		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) );
1157
-		if ( $checkin instanceof EE_Checkin ) {
1158
-			if ( $checkin->get( 'CHK_in' ) ) {
1156
+		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC')));
1157
+		if ($checkin instanceof EE_Checkin) {
1158
+			if ($checkin->get('CHK_in')) {
1159 1159
 				return EE_Registration::checkin_status_in; //checked in
1160 1160
 			} else {
1161 1161
 				return EE_Registration::checkin_status_out; //had checked in but is now checked out.
@@ -1173,28 +1173,28 @@  discard block
 block discarded – undo
1173 1173
 	 * @param bool $error  This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name.
1174 1174
 	 * @return string         internationalized message
1175 1175
 	 */
1176
-	public function get_checkin_msg( $DTT_ID, $error = FALSE ) {
1176
+	public function get_checkin_msg($DTT_ID, $error = FALSE) {
1177 1177
 		//let's get the attendee first so we can include the name of the attendee
1178
-		$attendee = $this->get_first_related( 'Attendee' );
1179
-		if ( $attendee instanceof EE_Attendee ) {
1180
-			if ( $error ) {
1181
-				return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() );
1178
+		$attendee = $this->get_first_related('Attendee');
1179
+		if ($attendee instanceof EE_Attendee) {
1180
+			if ($error) {
1181
+				return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name());
1182 1182
 			}
1183
-			$cur_status = $this->check_in_status_for_datetime( $DTT_ID );
1183
+			$cur_status = $this->check_in_status_for_datetime($DTT_ID);
1184 1184
 			//what is the status message going to be?
1185
-			switch ( $cur_status ) {
1185
+			switch ($cur_status) {
1186 1186
 				case EE_Registration::checkin_status_never :
1187
-					return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() );
1187
+					return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name());
1188 1188
 					break;
1189 1189
 				case EE_Registration::checkin_status_in :
1190
-					return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() );
1190
+					return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name());
1191 1191
 					break;
1192 1192
 				case EE_Registration::checkin_status_out :
1193
-					return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() );
1193
+					return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name());
1194 1194
 					break;
1195 1195
 			}
1196 1196
 		}
1197
-		return __( "The check-in status could not be determined.", "event_espresso" );
1197
+		return __("The check-in status could not be determined.", "event_espresso");
1198 1198
 	}
1199 1199
 
1200 1200
 
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 	 * @access        public
1220 1220
 	 */
1221 1221
 	public function reg_code() {
1222
-		return $this->get( 'REG_code' );
1222
+		return $this->get('REG_code');
1223 1223
 	}
1224 1224
 
1225 1225
 
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 	 * @access        public
1230 1230
 	 */
1231 1231
 	public function transaction_ID() {
1232
-		return $this->get( 'TXN_ID' );
1232
+		return $this->get('TXN_ID');
1233 1233
 	}
1234 1234
 
1235 1235
 
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 	 * @return int
1239 1239
 	 */
1240 1240
 	public function ticket_ID() {
1241
-		return $this->get( 'TKT_ID' );
1241
+		return $this->get('TKT_ID');
1242 1242
 	}
1243 1243
 
1244 1244
 
@@ -1250,17 +1250,17 @@  discard block
 block discarded – undo
1250 1250
 	 * @param    string $REG_code Registration Code
1251 1251
 	 * @param	boolean $use_default
1252 1252
 	 */
1253
-	public function set_reg_code( $REG_code, $use_default = FALSE ) {
1254
-		if ( empty( $REG_code )) {
1255
-			EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1253
+	public function set_reg_code($REG_code, $use_default = FALSE) {
1254
+		if (empty($REG_code)) {
1255
+			EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1256 1256
 			return;
1257 1257
 		}
1258
-		if ( ! $this->reg_code() ) {
1259
-			parent::set( 'REG_code', $REG_code, $use_default );
1258
+		if ( ! $this->reg_code()) {
1259
+			parent::set('REG_code', $REG_code, $use_default);
1260 1260
 		} else {
1261 1261
 			EE_Error::doing_it_wrong(
1262
-				__CLASS__ . '::' . __FUNCTION__,
1263
-				__( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ),
1262
+				__CLASS__.'::'.__FUNCTION__,
1263
+				__('Can not change a registration REG_code once it has been set.', 'event_espresso'),
1264 1264
 				'4.6.0'
1265 1265
 			);
1266 1266
 		}
@@ -1280,17 +1280,17 @@  discard block
 block discarded – undo
1280 1280
 	 * @return EE_Registration[]  or empty array if this isn't a group registration.
1281 1281
 	 */
1282 1282
 	public function get_all_other_registrations_in_group() {
1283
-		if ( $this->group_size() < 2 ) {
1283
+		if ($this->group_size() < 2) {
1284 1284
 			return array();
1285 1285
 		}
1286 1286
 
1287 1287
 		$query[0] = array(
1288 1288
 			'TXN_ID' => $this->transaction_ID(),
1289
-			'REG_ID' => array( '!=', $this->ID() ),
1289
+			'REG_ID' => array('!=', $this->ID()),
1290 1290
 			'TKT_ID' => $this->ticket_ID()
1291 1291
 			);
1292 1292
 
1293
-		$registrations = $this->get_model()->get_all( $query );
1293
+		$registrations = $this->get_model()->get_all($query);
1294 1294
 		return $registrations;
1295 1295
 	}
1296 1296
 
@@ -1299,14 +1299,14 @@  discard block
 block discarded – undo
1299 1299
 	 * @return string
1300 1300
 	 */
1301 1301
 	public function get_admin_details_link() {
1302
-		EE_Registry::instance()->load_helper( 'URL' );
1302
+		EE_Registry::instance()->load_helper('URL');
1303 1303
 		return EEH_URL::add_query_args_and_nonce(
1304 1304
 			array(
1305 1305
 				'page' => 'espresso_registrations',
1306 1306
 				'action' => 'view_registration',
1307 1307
 				'_REG_ID' => $this->ID()
1308 1308
 			),
1309
-			admin_url( 'admin.php' )
1309
+			admin_url('admin.php')
1310 1310
 		);
1311 1311
 	}
1312 1312
 
@@ -1331,12 +1331,12 @@  discard block
 block discarded – undo
1331 1331
 	 * @return string
1332 1332
 	 */
1333 1333
 	public function get_admin_overview_link() {
1334
-		EE_Registry::instance()->load_helper( 'URL' );
1334
+		EE_Registry::instance()->load_helper('URL');
1335 1335
 		return EEH_URL::add_query_args_and_nonce(
1336 1336
 			array(
1337 1337
 				'page' => 'espresso_registrations'
1338 1338
 			),
1339
-			admin_url( 'admin.php' )
1339
+			admin_url('admin.php')
1340 1340
 		);
1341 1341
 	}
1342 1342
 
@@ -1347,8 +1347,8 @@  discard block
 block discarded – undo
1347 1347
 	 * @return \EE_Registration[]
1348 1348
 	 * @throws \EE_Error
1349 1349
 	 */
1350
-	public function payments( $query_params = array() ) {
1351
-		return $this->get_many_related( 'Payment', $query_params );
1350
+	public function payments($query_params = array()) {
1351
+		return $this->get_many_related('Payment', $query_params);
1352 1352
 	}
1353 1353
 
1354 1354
 
@@ -1358,8 +1358,8 @@  discard block
 block discarded – undo
1358 1358
 	 * @return \EE_Registration_Payment[]
1359 1359
 	 * @throws \EE_Error
1360 1360
 	 */
1361
-	public function registration_payments( $query_params = array() ) {
1362
-		return $this->get_many_related( 'Registration_Payment', $query_params );
1361
+	public function registration_payments($query_params = array()) {
1362
+		return $this->get_many_related('Registration_Payment', $query_params);
1363 1363
 	}
1364 1364
 
1365 1365
 
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
 	 * @return EE_Payment_Method|null
1373 1373
 	 */
1374 1374
 	public function payment_method() {
1375
-		return EEM_Payment_Method::instance()->get_last_used_for_registration( $this );
1375
+		return EEM_Payment_Method::instance()->get_last_used_for_registration($this);
1376 1376
 	}
1377 1377
 
1378 1378
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 	/**
951 951
 	 * Sets deleted
952 952
 	 * @param boolean $deleted
953
-	 * @return boolean
953
+	 * @return boolean|null
954 954
 	 */
955 955
 	public function set_deleted($deleted) {
956 956
 		$this->set( 'REG_deleted', $deleted );
@@ -994,6 +994,7 @@  discard block
 block discarded – undo
994 994
 	 *
995 995
 	 * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against
996 996
 	 * @param bool   $check_approved   This is used to indicate whether the caller wants can_checkin to also consider registration status as well as datetime access.
997
+	 * @param integer $DTT_OR_ID
997 998
 	 *
998 999
 	 * @return bool
999 1000
 	 */
@@ -1369,7 +1370,7 @@  discard block
 block discarded – undo
1369 1370
 	 * This grabs the payment method corresponding to the last payment made for the amount owing on the registration.
1370 1371
 	 * Note: if there are no payments on the registration there will be no payment method returned.
1371 1372
 	 *
1372
-	 * @return EE_Payment_Method|null
1373
+	 * @return null|EE_Base_Class
1373 1374
 	 */
1374 1375
 	public function payment_method() {
1375 1376
 		return EEM_Payment_Method::instance()->get_last_used_for_registration( $this );
Please login to merge, or discard this patch.
line_item_filters/EE_Specific_Registrations_Line_Item_Filter.class.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
  */
19 19
 class EE_Specific_Registrations_Line_Item_Filter extends EE_Line_Item_Filter_Base {
20 20
 /**
21
-	 * array of line item codes and their corresponding quantities for registrations
22
-	 *
21
+ * array of line item codes and their corresponding quantities for registrations
22
+ *
23 23
 *@type array $_line_item_registrations
24
-	 */
24
+ */
25 25
 	protected $_line_item_registrations = array();
26 26
 
27 27
 	/**
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	 * EE_Billable_Line_Item_Filter constructor.
43 43
 	 * @param EE_Registration[] $registrations
44 44
 	 */
45
-	public function __construct( $registrations ) {
45
+	public function __construct($registrations) {
46 46
 		$this->_registrations = $registrations;
47
-		$this->_calculate_registrations_per_line_item_code( $registrations );
47
+		$this->_calculate_registrations_per_line_item_code($registrations);
48 48
 		// these reg statuses should NOT increment the line item quantity
49 49
 		$this->_closed_reg_statuses = EEM_Registration::closed_reg_statuses();
50 50
 	}
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
 	 * @param EE_Registration[] $registrations
56 56
 	 * @return void
57 57
 	 */
58
-	protected function _calculate_registrations_per_line_item_code( $registrations ) {
59
-		foreach( $registrations as $registration ) {
58
+	protected function _calculate_registrations_per_line_item_code($registrations) {
59
+		foreach ($registrations as $registration) {
60 60
 			$line_item_code = EEM_Line_Item::instance()->get_var(
61 61
 				EEM_Line_Item::instance()->line_item_for_registration_query_params(
62 62
 					$registration,
63
-					array( 'limit' => 1 )
63
+					array('limit' => 1)
64 64
 				),
65 65
 				'LIN_code'
66 66
 			);
67
-			if( $line_item_code ) {
68
-				if( ! isset( $this->_line_item_registrations[ $line_item_code ] ) ) {
69
-					$this->_line_item_registrations[ $line_item_code ] = array();
67
+			if ($line_item_code) {
68
+				if ( ! isset($this->_line_item_registrations[$line_item_code])) {
69
+					$this->_line_item_registrations[$line_item_code] = array();
70 70
 				}
71
-				$this->_line_item_registrations[ $line_item_code ][ $registration->ID() ] = $registration;
71
+				$this->_line_item_registrations[$line_item_code][$registration->ID()] = $registration;
72 72
 			}
73 73
 		}
74 74
 	}
@@ -81,61 +81,61 @@  discard block
 block discarded – undo
81 81
 	 * @param EEI_Line_Item      $line_item
82 82
 	 * @return \EEI_Line_Item
83 83
 	 */
84
-	public function process( EEI_Line_Item $line_item ) {
85
-		$this->_adjust_line_item_quantity( $line_item );
86
-		if( ! $line_item->children() ) {
84
+	public function process(EEI_Line_Item $line_item) {
85
+		$this->_adjust_line_item_quantity($line_item);
86
+		if ( ! $line_item->children()) {
87 87
 			return $line_item;
88 88
 		}
89 89
 		//the original running total (taking ALL tickets into account)
90 90
 		$running_total_of_children = 0;
91 91
 		//the new running total (only taking the specified ticket quantities into account)
92 92
 		$running_total_of_children_under_consideration = 0;
93
-		foreach ( $line_item->children() as $child_line_item ) {
94
-			if( $child_line_item->is_percent() ) {
93
+		foreach ($line_item->children() as $child_line_item) {
94
+			if ($child_line_item->is_percent()) {
95 95
 				$original_li_total = $running_total_of_children * $child_line_item->percent() / 100;
96
-			}else{
96
+			} else {
97 97
 				$original_li_total = $child_line_item->unit_price() * $child_line_item->quantity();
98 98
 			}
99 99
 
100
-			$this->process( $child_line_item );
100
+			$this->process($child_line_item);
101 101
 			/*
102 102
 			 * If this line item is a normal line item that isn't for a ticket
103 103
 			 * we want to modify its total (and unit price if not a percentage line item)
104 104
 			 * so it reflects only that portion of the surcharge/discount shared by these
105 105
 			 * registrations
106 106
 			 */
107
-			if(
107
+			if (
108 108
 				$child_line_item->type() === EEM_Line_Item::type_line_item
109 109
 				&& $child_line_item->OBJ_type() !== 'Ticket'
110 110
 			) {
111
-				if( $running_total_of_children ) {
111
+				if ($running_total_of_children) {
112 112
 					$percent_of_running_total = $original_li_total / $running_total_of_children;
113 113
 				} else {
114 114
 					$percent_of_running_total = 0;
115 115
 				}
116 116
 
117
-				$child_line_item->set_total( $running_total_of_children_under_consideration * $percent_of_running_total );
118
-				if( ! $child_line_item->is_percent() ) {
119
-					$child_line_item->set_unit_price( $child_line_item->total() / $child_line_item->quantity() );
117
+				$child_line_item->set_total($running_total_of_children_under_consideration * $percent_of_running_total);
118
+				if ( ! $child_line_item->is_percent()) {
119
+					$child_line_item->set_unit_price($child_line_item->total() / $child_line_item->quantity());
120 120
 				}
121 121
 			} else if (
122 122
 				$line_item->type() === EEM_Line_Item::type_line_item
123 123
 				&& $line_item->OBJ_type() === 'Ticket'
124 124
 			) {
125 125
 				//make sure this item's quantity matches its parent
126
-				if( ! $child_line_item->is_percent() ) {
127
-					$child_line_item->set_quantity( $line_item->quantity() );
128
-					$child_line_item->set_total( $child_line_item->unit_price() * $child_line_item->quantity() );
126
+				if ( ! $child_line_item->is_percent()) {
127
+					$child_line_item->set_quantity($line_item->quantity());
128
+					$child_line_item->set_total($child_line_item->unit_price() * $child_line_item->quantity());
129 129
 				}
130 130
 			}
131 131
 			$running_total_of_children += $original_li_total;
132 132
 			$running_total_of_children_under_consideration += $child_line_item->total();
133 133
 		}
134
-		$line_item->set_total( $running_total_of_children_under_consideration );
135
-		if( $line_item->quantity() ) {
136
-			$line_item->set_unit_price( $running_total_of_children_under_consideration / $line_item->quantity() );
134
+		$line_item->set_total($running_total_of_children_under_consideration);
135
+		if ($line_item->quantity()) {
136
+			$line_item->set_unit_price($running_total_of_children_under_consideration / $line_item->quantity());
137 137
 		} else {
138
-			$line_item->set_unit_price( 0 );
138
+			$line_item->set_unit_price(0);
139 139
 		}
140 140
 		return $line_item;
141 141
 	}
@@ -148,27 +148,27 @@  discard block
 block discarded – undo
148 148
 	 * @param EEI_Line_Item $line_item
149 149
 	 * @return EEI_Line_Item
150 150
 	 */
151
-	protected function _adjust_line_item_quantity( EEI_Line_Item $line_item ) {
151
+	protected function _adjust_line_item_quantity(EEI_Line_Item $line_item) {
152 152
 		// is this a ticket ?
153
-		if ( $line_item->type() === EEM_Line_Item::type_line_item && $line_item->OBJ_type() == 'Ticket' ) {
153
+		if ($line_item->type() === EEM_Line_Item::type_line_item && $line_item->OBJ_type() == 'Ticket') {
154 154
 			$quantity = 0;
155 155
 			// if this ticket is billable at this moment, then we should have a positive quantity
156 156
 			if (
157
-				isset( $this->_line_item_registrations[ $line_item->code() ] )
158
-				&& is_array( $this->_line_item_registrations[ $line_item->code() ] )
157
+				isset($this->_line_item_registrations[$line_item->code()])
158
+				&& is_array($this->_line_item_registrations[$line_item->code()])
159 159
 			) {
160 160
 				// set quantity based on number of open registrations for this ticket
161
-				foreach ( $this->_line_item_registrations[ $line_item->code() ] as $registration ) {
161
+				foreach ($this->_line_item_registrations[$line_item->code()] as $registration) {
162 162
 					if (
163 163
 						$registration instanceof EE_Registration
164
-						&& ! in_array( $registration->status_ID(), $this->_closed_reg_statuses )
164
+						&& ! in_array($registration->status_ID(), $this->_closed_reg_statuses)
165 165
 					) {
166 166
 						$quantity++;
167 167
 					}
168 168
 				}
169 169
 			}
170
-			$line_item->set_quantity( $quantity );
171
-			$line_item->set_total( $line_item->unit_price() * $line_item->quantity() );
170
+			$line_item->set_quantity($quantity);
171
+			$line_item->set_total($line_item->unit_price() * $line_item->quantity());
172 172
 		}
173 173
 		return $line_item;
174 174
 	}
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/db_models/fields/EE_Model_Field_Base.php 1 patch
Spacing   +25 added lines, -25 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
  *
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  * @subpackage    /core/db_models/fields/EE_Model_Field_Base.php
19 19
  * @author 				Michael Nelson
20 20
  */
21
-abstract class EE_Model_Field_Base{
21
+abstract class EE_Model_Field_Base {
22 22
 	var $_table_alias;
23 23
 	var $_table_column;
24 24
 	var $_name;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param      $nullable
35 35
 	 * @param null $default_value
36 36
 	 */
37
-	function __construct($table_column, $nicename, $nullable, $default_value = null){
37
+	function __construct($table_column, $nicename, $nullable, $default_value = null) {
38 38
 		$this->_table_column = $table_column;
39 39
 		$this->_nicename = $nicename;
40 40
 		$this->_nullable = $nullable;
@@ -48,27 +48,27 @@  discard block
 block discarded – undo
48 48
 	 * @param $name
49 49
 	 * @param $model_name
50 50
 	 */
51
-	function _construct_finalize($table_alias, $name, $model_name){
51
+	function _construct_finalize($table_alias, $name, $model_name) {
52 52
 		$this->_table_alias = $table_alias;
53 53
 		$this->_name = $name;
54 54
 		$this->_model_name = $model_name;
55 55
 		/**
56 56
 		 * allow for changing the defaults
57 57
 		 */
58
-		$this->_nicename = apply_filters( 'FHEE__EE_Model_Field_Base___construct_finalize___nicename', $this->_nicename, $this );
59
-		$this->_default_value = apply_filters( 'FHEE__EE_Model_Field_Base___construct_finalize___default_value', $this->_default_value, $this );
58
+		$this->_nicename = apply_filters('FHEE__EE_Model_Field_Base___construct_finalize___nicename', $this->_nicename, $this);
59
+		$this->_default_value = apply_filters('FHEE__EE_Model_Field_Base___construct_finalize___default_value', $this->_default_value, $this);
60 60
 	}
61
-	function get_table_alias(){
61
+	function get_table_alias() {
62 62
 		return $this->_table_alias;
63 63
 	}
64
-	function get_table_column(){
64
+	function get_table_column() {
65 65
 		return $this->_table_column;
66 66
 	}
67 67
 	/**
68 68
 	 * Returns the name of the model this field is on. Eg 'Event' or 'Ticket_Datetime'
69 69
 	 * @return string
70 70
 	 */
71
-	function get_model_name(){
71
+	function get_model_name() {
72 72
 		return $this->_model_name;
73 73
 	}
74 74
 
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
 	 * @throws \EE_Error
77 77
 	 * @return string
78 78
 	 */
79
-	function get_name(){
80
-		if($this->_name){
79
+	function get_name() {
80
+		if ($this->_name) {
81 81
 			return $this->_name;
82
-		}else{
83
-			throw new EE_Error(sprintf(__("Model field '%s' has no name set. Did you make a model and forget to call the parent model constructor?", "event_espresso"),get_class($this)));
82
+		} else {
83
+			throw new EE_Error(sprintf(__("Model field '%s' has no name set. Did you make a model and forget to call the parent model constructor?", "event_espresso"), get_class($this)));
84 84
 		}
85 85
 	}
86
-	function get_nicename(){
86
+	function get_nicename() {
87 87
 		return $this->_nicename;
88 88
 	}
89
-	function is_nullable(){
89
+	function is_nullable() {
90 90
 		return $this->_nullable;
91 91
 	}
92 92
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * on insertion it can be null. However, on updates it must be present.
95 95
 	 * @return boolean
96 96
 	 */
97
-	function is_auto_increment(){
97
+	function is_auto_increment() {
98 98
 		return false;
99 99
 	}
100 100
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * value domains at the top of EEM_Base
103 103
 	 * @return mixed
104 104
 	 */
105
-	function get_default_value(){
105
+	function get_default_value() {
106 106
 		return $this->_default_value;
107 107
 	}
108 108
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * in the current query
114 114
 	 * @return string
115 115
 	 */
116
-	function get_qualified_column(){
116
+	function get_qualified_column() {
117 117
 		return $this->get_table_alias().".".$this->get_table_column();
118 118
 	}
119 119
 	/**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @param mixed $value_of_field_on_model_object
125 125
 	 * @return mixed
126 126
 	 */
127
-	function prepare_for_get($value_of_field_on_model_object){
127
+	function prepare_for_get($value_of_field_on_model_object) {
128 128
 		return $value_of_field_on_model_object;
129 129
 	}
130 130
 	/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @param mixed $value_of_field_on_model_object
135 135
 	 * @return mixed
136 136
 	 */
137
-	function prepare_for_use_in_db($value_of_field_on_model_object){
137
+	function prepare_for_use_in_db($value_of_field_on_model_object) {
138 138
 		return $value_of_field_on_model_object;
139 139
 	}
140 140
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @param mixed $value_inputted_for_field_on_model_object
146 146
 	 * @return mixed
147 147
 	 */
148
-	function prepare_for_set($value_inputted_for_field_on_model_object){
148
+	function prepare_for_set($value_inputted_for_field_on_model_object) {
149 149
 		return $value_inputted_for_field_on_model_object;
150 150
 	}
151 151
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 * @param mixed $value_found_in_db_for_model_object
157 157
 	 * @return mixed
158 158
 	 */
159
-	function prepare_for_set_from_db($value_found_in_db_for_model_object){
159
+	function prepare_for_set_from_db($value_found_in_db_for_model_object) {
160 160
 		return $this->prepare_for_set($value_found_in_db_for_model_object);
161 161
 	}
162 162
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @param mixed $value_on_field_to_be_outputted
168 168
 	 * @return mixed
169 169
 	 */
170
-	function prepare_for_pretty_echoing( $value_on_field_to_be_outputted ){
170
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted) {
171 171
 		return $value_on_field_to_be_outputted;
172 172
 	}
173 173
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * By default, all fields aren't db-only.
183 183
 	 * @return boolean
184 184
 	 */
185
-	function is_db_only_field(){
185
+	function is_db_only_field() {
186 186
 		return false;
187 187
 	}
188 188
 }
189 189
\ No newline at end of file
Please login to merge, or discard this patch.
caffeinated/payment_methods/Paypal_Pro/EEG_Paypal_Pro.gateway.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEG_Paypal_Pro extends EE_Onsite_Gateway{
28
+class EEG_Paypal_Pro extends EE_Onsite_Gateway {
29 29
 	/**
30 30
 	 *
31 31
 	 * @var $_paypal_api_username string
@@ -88,25 +88,25 @@  discard block
 block discarded – undo
88 88
 	 * } @see parent::do_direct_payment for more info
89 89
 	 * @return \EE_Payment|\EEI_Payment
90 90
 	 */
91
-	public function do_direct_payment($payment,$billing_info = null){
91
+	public function do_direct_payment($payment, $billing_info = null) {
92 92
 		$transaction = $payment->transaction();
93 93
 		$primary_registrant = $transaction->primary_registration();
94
-		$order_description  = sprintf(__("Event Registrations from %s", "event_espresso"),get_bloginfo('name'));
94
+		$order_description  = sprintf(__("Event Registrations from %s", "event_espresso"), get_bloginfo('name'));
95 95
 		//charge for the full amount. Show itemized list
96
-		if( $this->_can_easily_itemize_transaction_for( $payment ) ){
96
+		if ($this->_can_easily_itemize_transaction_for($payment)) {
97 97
 			$item_num = 1;
98 98
 			$total_line_item = $transaction->total_line_item();
99 99
 			$order_items = array();
100 100
 			foreach ($total_line_item->get_items() as $line_item) {
101 101
 				//ignore line items with a quantity of 0
102
-				if( $line_item->quantity() == 0 ) {
102
+				if ($line_item->quantity() == 0) {
103 103
 					continue;
104 104
 				}
105 105
 				$item = array(
106 106
 						// Item Name.  127 char max.
107
-						'l_name' => substr($line_item->name(),0,127),
107
+						'l_name' => substr($line_item->name(), 0, 127),
108 108
 						// Item description.  127 char max.
109
-						'l_desc' => substr($line_item->desc(),0,127),
109
+						'l_desc' => substr($line_item->desc(), 0, 127),
110 110
 						// Cost of individual item.
111 111
 						'l_amt' => $line_item->unit_price(),
112 112
 						// Item Number.  127 char max.
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 			}
128 128
 			$item_amount = $total_line_item->get_items_total();
129 129
 			$tax_amount = $total_line_item->get_total_tax();
130
-		}else{
130
+		} else {
131 131
 			$order_items = array();
132 132
 			$item_amount = $payment->amount();
133
-			$single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code());
133
+			$single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code());
134 134
 			$tax_amount = 0;
135
-			array_push($order_items,array(
135
+			array_push($order_items, array(
136 136
 				// Item Name.  127 char max.
137
-				'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'),$primary_registrant->reg_code()),
137
+				'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'), $primary_registrant->reg_code()),
138 138
 				// Item description.  127 char max.
139 139
 				'l_desc' => $single_item_desc,
140 140
 				// Cost of individual item.
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 			// Payer's salutation.  20 char max.
182 182
 			'salutation' => '',
183 183
 			// Payer's first name.  25 char max.
184
-			'firstname' => substr($billing_info['first_name'],0,25),
184
+			'firstname' => substr($billing_info['first_name'], 0, 25),
185 185
 			// Payer's middle name.  25 char max.
186 186
 			'middlename' => '',
187 187
 			// Payer's last name.  25 char max.
188
-			'lastname' => substr($billing_info['last_name'],0,25),
188
+			'lastname' => substr($billing_info['last_name'], 0, 25),
189 189
 			// Payer's suffix.  12 char max.
190 190
 			'suffix' => ''
191 191
 		);
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 			// Required.  Name of City.
199 199
 			'city' => $billing_info['city'],
200 200
 			// Required. Name of State or Province.
201
-			'state' => substr( $billing_info['state'], 0, 40 ),
201
+			'state' => substr($billing_info['state'], 0, 40),
202 202
 			// Required.  Country code.
203 203
 			'countrycode' => $billing_info['country'],
204 204
 			// Required.  Postal code of payer.
205 205
 			'zip' => $billing_info['zip'],
206 206
 			// Phone Number of payer.  20 char max.
207
-			'shiptophonenum' => substr($billing_info['phone'],0,20)
207
+			'shiptophonenum' => substr($billing_info['phone'], 0, 20)
208 208
 		);
209 209
 
210 210
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 			// Required.  Three-letter currency code.  Default is USD.
215 215
 			'currencycode' => $payment->currency_code(),
216 216
 			// Required if you include itemized cart details. (L_AMTn, etc.)  Subtotal of items not including S&H, or tax.
217
-			'itemamt' => $this->format_currency($item_amount),//
217
+			'itemamt' => $this->format_currency($item_amount), //
218 218
 			// Total shipping costs for the order.  If you specify shippingamt, you must also specify itemamt.
219 219
 			'shippingamt' => '',
220 220
 			// Total handling costs for the order.  If you specify handlingamt, you must also specify itemamt.
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 			// Free-form field for your own use.  256 char max.
227 227
 			'custom' => $primary_registrant ? $primary_registrant->ID() : '',
228 228
 			// Your own invoice or tracking number
229
-			'invnum' => wp_generate_password(12,false),//$transaction->ID(),
229
+			'invnum' => wp_generate_password(12, false), //$transaction->ID(),
230 230
 			// URL for receiving Instant Payment Notifications.  This overrides what your profile is set to use.
231 231
 			'notifyurl' => '',
232
-			'buttonsource' => 'EventEspresso_SP',//EE will blow up if you change this
232
+			'buttonsource' => 'EventEspresso_SP', //EE will blow up if you change this
233 233
 		);
234 234
 		// Wrap all data arrays into a single, "master" array which will be passed into the class function.
235 235
 		$PayPalRequestData = array(
@@ -242,32 +242,32 @@  discard block
 block discarded – undo
242 242
 				'OrderItems' => $order_items,
243 243
 		);
244 244
 		$this->_log_clean_request($PayPalRequestData, $payment);
245
-		try{
245
+		try {
246 246
 			$PayPalResult = $this->prep_and_curl_request($PayPalRequestData);
247 247
 			//remove PCI-sensitive data so it doesn't get stored
248
-			$PayPalResult = $this->_log_clean_response($PayPalResult,$payment);
248
+			$PayPalResult = $this->_log_clean_response($PayPalResult, $payment);
249 249
 
250 250
 			$message = isset($PayPalResult['L_LONGMESSAGE0']) ? $PayPalResult['L_LONGMESSAGE0'] : $PayPalResult['ACK'];
251
-			if( empty($PayPalResult[ 'RAWRESPONSE' ] ) ) {
252
-				$payment->set_status( $this->_pay_model->failed_status() ) ;
253
-				$payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) );
251
+			if (empty($PayPalResult['RAWRESPONSE'])) {
252
+				$payment->set_status($this->_pay_model->failed_status());
253
+				$payment->set_gateway_response(__('No response received from Paypal Pro', 'event_espresso'));
254 254
 				$payment->set_details($PayPalResult);
255
-			}else{
256
-				if($this->_APICallSuccessful($PayPalResult)){
255
+			} else {
256
+				if ($this->_APICallSuccessful($PayPalResult)) {
257 257
 					$payment->set_status($this->_pay_model->approved_status());
258
-				}else{
258
+				} else {
259 259
 					$payment->set_status($this->_pay_model->declined_status());
260 260
 				}
261 261
 				//make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
262
-				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval( $PayPalResult['AMT'] ) : 0);
262
+				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0);
263 263
 				$payment->set_gateway_response($message);
264
-				$payment->set_txn_id_chq_nmbr(isset( $PayPalResult['TRANSACTIONID'] )? $PayPalResult['TRANSACTIONID'] : null);
264
+				$payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) ? $PayPalResult['TRANSACTIONID'] : null);
265 265
 
266 266
 				$primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : '';
267 267
 				$payment->set_extra_accntng($primary_registration_code);
268 268
 				$payment->set_details($PayPalResult);
269 269
 			}
270
-		}catch(Exception $e){
270
+		} catch (Exception $e) {
271 271
 			$payment->set_status($this->_pay_model->failed_status());
272 272
 			$payment->set_gateway_response($e->getMessage());
273 273
 		}
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 * @param EEI_Payment $payment
285 285
 	 * @return array
286 286
 	 */
287
-	private function _log_clean_request($request,$payment){
287
+	private function _log_clean_request($request, $payment) {
288 288
 		$cleaned_request_data = $request;
289 289
 		unset($cleaned_request_data['CCDetails']['acct']);
290 290
 		unset($cleaned_request_data['CCDetails']['cvv2']);
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 	 * @param EEI_Payment $payment
301 301
 	 * @return array cleaned
302 302
 	 */
303
-	private function _log_clean_response($response,$payment){
303
+	private function _log_clean_response($response, $payment) {
304 304
 		unset($response['REQUESTDATA']['CREDITCARDTYPE']);
305 305
 		unset($response['REQUESTDATA']['ACCT']);
306 306
 		unset($response['REQUESTDATA']['EXPDATE']);
307 307
 		unset($response['REQUESTDATA']['CVV2']);
308 308
 		unset($response['RAWREQUEST']);
309
-		$this->log(array('Paypal Response'=>$response),$payment);
309
+		$this->log(array('Paypal Response'=>$response), $payment);
310 310
 		return $response;
311 311
 	}
312 312
 
@@ -331,32 +331,32 @@  discard block
 block discarded – undo
331 331
 		// DP Fields
332 332
 		$DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array();
333 333
 		foreach ($DPFields as $DPFieldsVar => $DPFieldsVal)
334
-			$DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal);
334
+			$DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal);
335 335
 
336 336
 		// CC Details Fields
337 337
 		$CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array();
338 338
 		foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal)
339
-			$CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal);
339
+			$CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal);
340 340
 
341 341
 		// PayerInfo Type Fields
342 342
 		$PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array();
343 343
 		foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal)
344
-			$PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal);
344
+			$PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal);
345 345
 
346 346
 		// Payer Name Fields
347 347
 		$PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array();
348 348
 		foreach ($PayerName as $PayerNameVar => $PayerNameVal)
349
-			$PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal);
349
+			$PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal);
350 350
 
351 351
 		// Address Fields (Billing)
352 352
 		$BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array();
353 353
 		foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal)
354
-			$BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal);
354
+			$BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal);
355 355
 
356 356
 		// Payment Details Type Fields
357 357
 		$PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array();
358 358
 		foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal)
359
-			$PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal);
359
+			$PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal);
360 360
 
361 361
 		// Payment Details Item Type Fields
362 362
 		$OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array();
@@ -364,22 +364,22 @@  discard block
 block discarded – undo
364 364
 		foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) {
365 365
 			$CurrentItem = $OrderItems[$OrderItemsVar];
366 366
 			foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal)
367
-				$OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal);
367
+				$OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal);
368 368
 			$n++;
369 369
 		}
370 370
 
371 371
 		// Ship To Address Fields
372 372
 		$ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array();
373 373
 		foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal)
374
-			$ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal);
374
+			$ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal);
375 375
 
376 376
 		// 3D Secure Fields
377 377
 		$Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array();
378 378
 		foreach ($Secure3D as $Secure3DVar => $Secure3DVal)
379
-			$Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal);
379
+			$Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal);
380 380
 
381 381
 		// Now that we have each chunk we need to go ahead and append them all together for our entire NVP string
382
-		$NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP;
382
+		$NVPRequest = 'USER='.$this->_username.'&PWD='.$this->_password.'&VERSION=64.0'.'&SIGNATURE='.$this->_signature.$DPFieldsNVP.$CCDetailsNVP.$PayerInfoNVP.$PayerNameNVP.$BillingAddressNVP.$PaymentDetailsNVP.$OrderItemsNVP.$ShippingAddressNVP.$Secure3DNVP;
383 383
 		$NVPResponse = $this->_CURLRequest($NVPRequest);
384 384
 		$NVPRequestArray = $this->_NVPToArray($NVPRequest);
385 385
 		$NVPResponseArray = $this->_NVPToArray($NVPResponse);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	private function _CURLRequest($Request) {
404 404
 		$EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp';
405 405
 		$curl = curl_init();
406
-		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE ) );
406
+		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE));
407 407
 		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
408 408
 		curl_setopt($curl, CURLOPT_TIMEOUT, 60);
409 409
 		curl_setopt($curl, CURLOPT_URL, $EndPointURL);
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
 	private function _APICallSuccessful($PayPalResult) {
454 454
 		$approved = false;
455 455
 		// check main response message from PayPal
456
-		if (isset($PayPalResult['ACK']) && !empty($PayPalResult['ACK'])) {
456
+		if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) {
457 457
 			$ack = strtoupper($PayPalResult['ACK']);
458
-			$approved = ( $ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS' ) ? true : false;
458
+			$approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false;
459 459
 		}
460 460
 
461 461
 		return $approved;
@@ -471,11 +471,11 @@  discard block
 block discarded – undo
471 471
 
472 472
 		$Errors = array();
473 473
 		$n = 0;
474
-		while (isset($DataArray['L_ERRORCODE' . $n . ''])) {
475
-			$LErrorCode = isset($DataArray['L_ERRORCODE' . $n . '']) ? $DataArray['L_ERRORCODE' . $n . ''] : '';
476
-			$LShortMessage = isset($DataArray['L_SHORTMESSAGE' . $n . '']) ? $DataArray['L_SHORTMESSAGE' . $n . ''] : '';
477
-			$LLongMessage = isset($DataArray['L_LONGMESSAGE' . $n . '']) ? $DataArray['L_LONGMESSAGE' . $n . ''] : '';
478
-			$LSeverityCode = isset($DataArray['L_SEVERITYCODE' . $n . '']) ? $DataArray['L_SEVERITYCODE' . $n . ''] : '';
474
+		while (isset($DataArray['L_ERRORCODE'.$n.''])) {
475
+			$LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : '';
476
+			$LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) ? $DataArray['L_SHORTMESSAGE'.$n.''] : '';
477
+			$LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) ? $DataArray['L_LONGMESSAGE'.$n.''] : '';
478
+			$LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) ? $DataArray['L_SEVERITYCODE'.$n.''] : '';
479 479
 
480 480
 			$CurrentItem = array(
481 481
 					'L_ERRORCODE' => $LErrorCode,
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 				elseif ($CurrentErrorVar == 'L_SEVERITYCODE')
516 516
 					$CurrentVarName = 'Severity Code';
517 517
 
518
-				$error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal;
518
+				$error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal;
519 519
 			}
520 520
 		}
521 521
 		return $error;
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Phone_Input.input.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -15,18 +15,18 @@  discard block
 block discarded – undo
15 15
  * @author				Mike Nelson
16 16
  *
17 17
  */
18
-class EE_Phone_Input extends EE_Text_Input{
18
+class EE_Phone_Input extends EE_Text_Input {
19 19
 	/**
20 20
 	 * @param array $options
21 21
 	 */
22
-	function __construct($options = array()){
22
+	function __construct($options = array()) {
23 23
 		$this->_add_validation_strategy(
24 24
 			new EE_Text_Validation_Strategy(
25
-				__( 'Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso' ),
25
+				__('Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso'),
26 26
 				'~^([\d]{10})|([\d]{3}-[\d]{3}-[\d]{4})$~'
27 27
 			)
28 28
 		);
29
-		parent::__construct( $options );
29
+		parent::__construct($options);
30 30
 	}
31 31
 
32 32
 
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Select_Display_Strategy.strategy.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,48 +11,48 @@  discard block
 block discarded – undo
11 11
  * @since 				$VID:$
12 12
  *
13 13
  */
14
-class EE_Select_Display_Strategy extends EE_Display_Strategy_Base{
14
+class EE_Select_Display_Strategy extends EE_Display_Strategy_Base {
15 15
 
16 16
 	/**
17 17
 	 *
18 18
 	 * @throws EE_Error
19 19
 	 * @return string of html to display the field
20 20
 	 */
21
-	function display(){
22
-		if( ! $this->_input instanceof EE_Form_Input_With_Options_Base){
23
-			throw new EE_Error( sprintf( __( 'Cannot use Select Display Strategy with an input that doesn\'t have options', 'event_espresso' )));
21
+	function display() {
22
+		if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) {
23
+			throw new EE_Error(sprintf(__('Cannot use Select Display Strategy with an input that doesn\'t have options', 'event_espresso')));
24 24
 		}
25 25
 		EE_Registry::instance()->load_helper('Array');
26 26
 
27
-		$html = EEH_HTML::nl( 0, 'select' );
27
+		$html = EEH_HTML::nl(0, 'select');
28 28
 		$html .= '<select';
29
-		$html .= ' id="' . $this->_input->html_id() . '"';
30
-		$html .= ' name="' . $this->_input->html_name() . '"';
31
-		$class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class();
32
-		$html .= ' class="' . $class . '"';
29
+		$html .= ' id="'.$this->_input->html_id().'"';
30
+		$html .= ' name="'.$this->_input->html_name().'"';
31
+		$class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class();
32
+		$html .= ' class="'.$class.'"';
33 33
 		// add html5 required
34 34
 
35 35
 		$html .= $this->_input->required() ? ' required' : '';
36
-		$html .= ' style="' . $this->_input->html_style() . '"';
37
-		$html .= ' ' . $this->_input->other_html_attributes();
36
+		$html .= ' style="'.$this->_input->html_style().'"';
37
+		$html .= ' '.$this->_input->other_html_attributes();
38 38
 		$html .= '>';
39 39
 
40 40
 //		EEH_HTML::indent( 1, 'select' );
41
-		if ( EEH_Array::is_multi_dimensional_array( $this->_input->options() )) {
42
-			EEH_HTML::indent( 1, 'optgroup' );
43
-			foreach( $this->_input->options() as $opt_group_label => $opt_group ){
44
-				$html .= EEH_HTML::nl( 0, 'optgroup' ) . '<optgroup label="' . esc_attr( $opt_group_label ) . '">';
45
-				EEH_HTML::indent( 1, 'option' );
46
-				$html .= $this->_display_options( $opt_group );
41
+		if (EEH_Array::is_multi_dimensional_array($this->_input->options())) {
42
+			EEH_HTML::indent(1, 'optgroup');
43
+			foreach ($this->_input->options() as $opt_group_label => $opt_group) {
44
+				$html .= EEH_HTML::nl(0, 'optgroup').'<optgroup label="'.esc_attr($opt_group_label).'">';
45
+				EEH_HTML::indent(1, 'option');
46
+				$html .= $this->_display_options($opt_group);
47 47
 				$html .= EEH_HTML::indent( -1, 'option' );
48
-				$html .= EEH_HTML::nl( 0, 'optgroup' ) . '</optgroup>';
48
+				$html .= EEH_HTML::nl(0, 'optgroup').'</optgroup>';
49 49
 			}
50 50
 			EEH_HTML::indent( -1, 'optgroup' );
51 51
 		} else {
52
-			$html.=$this->_display_options( $this->_input->options() );
52
+			$html .= $this->_display_options($this->_input->options());
53 53
 		}
54 54
 
55
-		$html.= EEH_HTML::nl( 0, 'select' ) . '</select>';
55
+		$html .= EEH_HTML::nl(0, 'select').'</select>';
56 56
 //		$html.= EEH_HTML::nl( -1, 'select' ) . '</select>';
57 57
 		return $html;
58 58
 	}
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
 	 * @param array $options
65 65
 	 * @return string
66 66
 	 */
67
-	protected function _display_options($options){
67
+	protected function _display_options($options) {
68 68
 		$html = '';
69
-		EEH_HTML::indent( 1, 'option' );
70
-		foreach( $options as $value => $display_text ){
71
-			$unnormalized_value = $this->_input->get_normalization_strategy()->unnormalize_one( $value );
72
-			$selected = $this->_check_if_option_selected( $unnormalized_value ) ? ' selected="selected"' : '';
73
-			$html.= EEH_HTML::nl( 0, 'option' ) . '<option value="' . esc_attr( $unnormalized_value ) . '"' . $selected . '>' . $display_text . '</option>';
69
+		EEH_HTML::indent(1, 'option');
70
+		foreach ($options as $value => $display_text) {
71
+			$unnormalized_value = $this->_input->get_normalization_strategy()->unnormalize_one($value);
72
+			$selected = $this->_check_if_option_selected($unnormalized_value) ? ' selected="selected"' : '';
73
+			$html .= EEH_HTML::nl(0, 'option').'<option value="'.esc_attr($unnormalized_value).'"'.$selected.'>'.$display_text.'</option>';
74 74
 		}
75 75
 		EEH_HTML::indent( -1, 'option' );
76 76
 		return $html;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param string|int $value unnormalized value option (string)
84 84
 	 * @return string
85 85
 	 */
86
-	protected function _check_if_option_selected( $value ){
86
+	protected function _check_if_option_selected($value) {
87 87
 		return $this->_input->raw_value() == $value ? TRUE : FALSE;
88 88
 	}
89 89
 
Please login to merge, or discard this patch.
strategies/display/EE_Select_Multiple_Display_Strategy.strategy.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_Select_Multiple_Display_Strategy extends EE_Select_Display_Strategy{
28
+class EE_Select_Multiple_Display_Strategy extends EE_Select_Display_Strategy {
29 29
 
30 30
 	/**
31 31
 	 *
@@ -34,31 +34,31 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function display() {
36 36
 
37
-		if( ! $this->_input instanceof EE_Form_Input_With_Options_Base){
37
+		if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) {
38 38
 			throw new EE_Error(sprintf(__('Cannot use Select Multiple Display Strategy with an input that doesn\'t have options', "event_espresso")));
39 39
 		}
40 40
 
41
-		$html = EEH_HTML::nl( 0, 'select' );
41
+		$html = EEH_HTML::nl(0, 'select');
42 42
 		$html .= '<select multiple';
43
-		$html .= ' id="' . $this->_input->html_id() . '"';
44
-		$html .= ' name="' . $this->_input->html_name() . '[]"';
45
-		$class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class();
46
-		$html .= ' class="' . $class . '"';
43
+		$html .= ' id="'.$this->_input->html_id().'"';
44
+		$html .= ' name="'.$this->_input->html_name().'[]"';
45
+		$class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class();
46
+		$html .= ' class="'.$class.'"';
47 47
 		// add html5 required
48 48
 		$html .= $this->_input->required() ? ' required' : '';
49
-		$html .= ' style="' . $this->_input->html_style() . '"';
50
-		$html .= ' ' . $this->_input->other_html_attributes();
49
+		$html .= ' style="'.$this->_input->html_style().'"';
50
+		$html .= ' '.$this->_input->other_html_attributes();
51 51
 		$html .= '>';
52 52
 
53 53
 		EE_Registry::instance()->load_helper('Array');
54
-		EEH_HTML::indent( 1, 'select' );
55
-		if( EEH_Array::is_multi_dimensional_array( $this->_input->options() )){
54
+		EEH_HTML::indent(1, 'select');
55
+		if (EEH_Array::is_multi_dimensional_array($this->_input->options())) {
56 56
 			throw new EE_Error(sprintf(__("Select multiple display strategy does not allow for nested arrays of options.", "event_espresso")));
57
-		}else{
58
-			$html.=$this->_display_options( $this->_input->options() );
57
+		} else {
58
+			$html .= $this->_display_options($this->_input->options());
59 59
 		}
60 60
 
61
-		$html.= EEH_HTML::nl( -1, 'select' ) . "</select>";
61
+		$html .= EEH_HTML::nl( -1, 'select' )."</select>";
62 62
 		return $html;
63 63
 	}
64 64
 
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
 	 * @param string|int $value unnormalized value option (string)
70 70
 	 * @return boolean
71 71
 	 */
72
-	protected function _check_if_option_selected( $value ){
72
+	protected function _check_if_option_selected($value) {
73 73
 		$selected_options = $this->_input->raw_value();
74
-		if ( empty( $selected_options )){
74
+		if (empty($selected_options)) {
75 75
 			return FALSE;
76 76
 		}
77
-		return in_array( $value, $selected_options ) ? TRUE : FALSE;
77
+		return in_array($value, $selected_options) ? TRUE : FALSE;
78 78
 	}
79 79
 
80 80
 
Please login to merge, or discard this patch.