Completed
Branch BUG-9540-thnx-page-html (c38d43)
by
unknown
523:49 queued 509:10
created
espresso_thank_you/templates/thank-you-page-overview.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  discard block
 block discarded – undo
3 3
 /** @var boolean $revisit */
4 4
 /** @var string $order_conf_desc */
5 5
 
6
-do_action( 'AHEE__thank_you_page_overview_template__top', $transaction );
6
+do_action('AHEE__thank_you_page_overview_template__top', $transaction);
7 7
 
8 8
 ?>
9 9
 
10 10
 <div id="espresso-thank-you-page-overview-dv" class="width-100" >
11 11
 
12
-	<?php if ( ! $revisit ) : ?>
12
+	<?php if ( ! $revisit) : ?>
13 13
 	<div class="ee-attention">
14 14
 		<div class="extra-padding-sides">
15 15
 			<?php echo apply_filters(
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 					'<br />'
22 22
 				)
23 23
 			);
24
-			if ( ! empty( $TXN_receipt_url )) : ?>
24
+			if ( ! empty($TXN_receipt_url)) : ?>
25 25
 			<br/>
26 26
 			<div class="jst-rght">
27
-				<a class="ee-button ee-roundish indented-text big-text" href="<?php echo $TXN_receipt_url;?>"><span class="ee-icon ee-icon-PDF-file-type"></span><?php echo apply_filters( 'FHEE__thank_you_page_overview_template__order_conf_button_text', __( 'View Full Order Confirmation Receipt', 'event_espresso' )); ?></a>
27
+				<a class="ee-button ee-roundish indented-text big-text" href="<?php echo $TXN_receipt_url; ?>"><span class="ee-icon ee-icon-PDF-file-type"></span><?php echo apply_filters('FHEE__thank_you_page_overview_template__order_conf_button_text', __('View Full Order Confirmation Receipt', 'event_espresso')); ?></a>
28 28
 			</div>
29 29
 			<?php endif; ?>
30 30
 		</div>
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	<?php endif; ?>
34 34
 	<br/>
35 35
 
36
-	<?php  do_action( 'AHEE__thank_you_page_overview_template__content', $transaction ); ?>
36
+	<?php  do_action('AHEE__thank_you_page_overview_template__content', $transaction); ?>
37 37
 
38 38
 </div>
39 39
 <!-- end of espresso-thank-you-page-overview-dv -->
40 40
 
41
-<?php  do_action( 'AHEE__thank_you_page_overview_template__bottom', $transaction ); ?>
41
+<?php  do_action('AHEE__thank_you_page_overview_template__bottom', $transaction); ?>
Please login to merge, or discard this patch.
shortcodes/espresso_thank_you/EES_Espresso_Thank_You.shortcode.php 1 patch
Spacing   +138 added lines, -138 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
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @return    void
92 92
 	 */
93 93
 	public static function set_hooks() {
94
-		add_action( 'wp_loaded', array( 'EES_Espresso_Thank_You', 'set_definitions' ), 2 );
94
+		add_action('wp_loaded', array('EES_Espresso_Thank_You', 'set_definitions'), 2);
95 95
 	}
96 96
 
97 97
 
@@ -104,22 +104,22 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public static function set_hooks_admin() {
106 106
 		// AJAX for IPN monitoring
107
-		add_filter( 'heartbeat_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 );
107
+		add_filter('heartbeat_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3);
108 108
 		add_filter(
109 109
 			'heartbeat_nopriv_received',
110
-			array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ),
110
+			array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'),
111 111
 			10,
112 112
 			3
113 113
 		);
114 114
 		add_action(
115 115
 			'wp_ajax_espresso_resend_reg_confirmation_email',
116
-			array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ),
116
+			array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'),
117 117
 			10,
118 118
 			2
119 119
 		);
120 120
 		add_action(
121 121
 			'wp_ajax_nopriv_espresso_resend_reg_confirmation_email',
122
-			array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ),
122
+			array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'),
123 123
 			10,
124 124
 			2
125 125
 		);
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	 * @return    void
135 135
 	 */
136 136
 	public static function set_definitions() {
137
-		define( 'THANK_YOU_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
138
-		define( 'THANK_YOU_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ ) ) . 'templates' . DS );
137
+		define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
138
+		define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
139 139
 	}
140 140
 
141 141
 
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 	 * @return    EE_Transaction
148 148
 	 */
149 149
 	public function get_txn() {
150
-		if ( $this->_current_txn instanceof EE_Transaction ) {
150
+		if ($this->_current_txn instanceof EE_Transaction) {
151 151
 			return $this->_current_txn;
152 152
 		}
153
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
154
-		if ( ! $TXN_model instanceof EEM_Transaction ) {
153
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
154
+		if ( ! $TXN_model instanceof EEM_Transaction) {
155 155
 			EE_Error::add_error(
156
-				__( 'The transaction model could not be established.', 'event_espresso' ),
156
+				__('The transaction model could not be established.', 'event_espresso'),
157 157
 				__FILE__,
158 158
 				__FUNCTION__,
159 159
 				__LINE__
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 			return null;
162 162
 		}
163 163
 		//get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request
164
-		$this->_current_txn = $TXN_model->get_transaction_from_reg_url_link( $this->_reg_url_link );
164
+		$this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link);
165 165
 		// verify TXN
166
-		if ( WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction ) {
166
+		if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) {
167 167
 			EE_Error::add_error(
168 168
 				__(
169 169
 					'No transaction information could be retrieved or the transaction data is not of the correct type.',
@@ -187,16 +187,16 @@  discard block
 block discarded – undo
187 187
 	 * @param int $since
188 188
 	 * @return    mixed array of EE_Payment || FALSE
189 189
 	 */
190
-	public function get_txn_payments( $since = 0 ) {
191
-		if ( ! $this->get_txn() ) {
190
+	public function get_txn_payments($since = 0) {
191
+		if ( ! $this->get_txn()) {
192 192
 			return false;
193 193
 		}
194
-		$args = array( 'order_by' => array( 'PAY_timestamp' => 'ASC' ) );
195
-		if ( $since > 0 ) {
196
-			$args[0] = array( 'PAY_timestamp' => array( '>', $since ) );
194
+		$args = array('order_by' => array('PAY_timestamp' => 'ASC'));
195
+		if ($since > 0) {
196
+			$args[0] = array('PAY_timestamp' => array('>', $since));
197 197
 		}
198 198
 		// get array of payments with most recent first
199
-		return $this->_current_txn->payments( $args );
199
+		return $this->_current_txn->payments($args);
200 200
 	}
201 201
 
202 202
 
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	 * @return    void
209 209
 	 */
210 210
 	private function _get_reg_url_link() {
211
-		if ( ! empty( $this->_reg_url_link ) ) {
211
+		if ( ! empty($this->_reg_url_link)) {
212 212
 			return;
213 213
 		}
214 214
 		// only do thank you page stuff if we have a REG_url_link in the url
215
-		if ( WP_DEBUG && ! EE_Registry::instance()->REQ->is_set( 'e_reg_url_link' ) ) {
215
+		if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) {
216 216
 			EE_Error::add_error(
217 217
 				__(
218 218
 					'No transaction information could be retrieved because the registration URL link is missing or invalid.',
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			return;
226 226
 		}
227 227
 		// check for reg_url_link
228
-		$this->_reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link' );
228
+		$this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link');
229 229
 	}
230 230
 
231 231
 
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 * @param    string $reg_url_link
238 238
 	 * @return    string
239 239
 	 */
240
-	public function set_reg_url_link( $reg_url_link = null ) {
241
-		$this->_reg_url_link = ! empty( $reg_url_link ) ? $reg_url_link : $this->_reg_url_link;
240
+	public function set_reg_url_link($reg_url_link = null) {
241
+		$this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link;
242 242
 	}
243 243
 
244 244
 
@@ -251,28 +251,28 @@  discard block
 block discarded – undo
251 251
 	 * @param    WP $WP
252 252
 	 * @return    void
253 253
 	 */
254
-	public function run( WP $WP ) {
254
+	public function run(WP $WP) {
255 255
 		// remove site_url() from thank you page URL
256
-		$thank_you_page_URL = substr( EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen( home_url() ) );
256
+		$thank_you_page_URL = substr(EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen(home_url()));
257 257
 		// remove other non-essential details from URL
258
-		$thank_you_page_URL = trim( parse_url( $thank_you_page_URL, PHP_URL_PATH ), '/' );
258
+		$thank_you_page_URL = trim(parse_url($thank_you_page_URL, PHP_URL_PATH), '/');
259 259
 		// ensure this shortcode doesn't trigger on anything BUT the thank you page
260
-		if ( isset( $WP->request ) && trim( $WP->request, '/' ) !== $thank_you_page_URL ) {
260
+		if (isset($WP->request) && trim($WP->request, '/') !== $thank_you_page_URL) {
261 261
 			return;
262 262
 		} else if (
263
-			isset( $WP->query_vars['page_id'] )
264
-			&& (int)$WP->query_vars['page_id'] !== (int)EE_Registry::instance()->CFG->core->thank_you_page_id
263
+			isset($WP->query_vars['page_id'])
264
+			&& (int) $WP->query_vars['page_id'] !== (int) EE_Registry::instance()->CFG->core->thank_you_page_id
265 265
 		) {
266 266
 			return;
267 267
 		}
268 268
 		$this->_get_reg_url_link();
269 269
 		// resend_reg_confirmation_email ?
270
-		if ( EE_Registry::instance()->REQ->is_set( 'resend' ) ) {
270
+		if (EE_Registry::instance()->REQ->is_set('resend')) {
271 271
 			EES_Espresso_Thank_You::resend_reg_confirmation_email();
272 272
 		}
273 273
 		// load assets
274
-		add_action( 'wp_enqueue_scripts', array( $this, 'load_js' ), 10 );
275
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
274
+		add_action('wp_enqueue_scripts', array($this, 'load_js'), 10);
275
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
276 276
 		$this->_translate_strings();
277 277
 	}
278 278
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	public function load_js() {
327 327
 		wp_register_script(
328 328
 			'thank_you_page',
329
-			THANK_YOU_ASSETS_URL . 'thank_you_page.js',
330
-			array( 'espresso_core', 'heartbeat' ),
329
+			THANK_YOU_ASSETS_URL.'thank_you_page.js',
330
+			array('espresso_core', 'heartbeat'),
331 331
 			EVENT_ESPRESSO_VERSION,
332 332
 			true
333 333
 		);
334
-		wp_enqueue_script( 'thank_you_page' );
334
+		wp_enqueue_script('thank_you_page');
335 335
 	}
336 336
 
337 337
 
@@ -345,10 +345,10 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	public function init() {
347 347
 		$this->_get_reg_url_link();
348
-		if ( ! $this->get_txn() ) {
349
-			EE_Registry::instance()->load_helper( 'HTML' );
348
+		if ( ! $this->get_txn()) {
349
+			EE_Registry::instance()->load_helper('HTML');
350 350
 			echo EEH_HTML::div(
351
-				EEH_HTML::h4( __( 'We\'re sorry...', 'event_espresso' ), '', '' ) .
351
+				EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '').
352 352
 				sprintf(
353 353
 					__(
354 354
 						'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s',
@@ -362,8 +362,8 @@  discard block
 block discarded – undo
362 362
 			return null;
363 363
 		}
364 364
 		// if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete"
365
-		if ( $this->_current_txn->status_ID() === EEM_Transaction::failed_status_code ) {
366
-			$this->_current_txn->set_status( EEM_Transaction::incomplete_status_code );
365
+		if ($this->_current_txn->status_ID() === EEM_Transaction::failed_status_code) {
366
+			$this->_current_txn->set_status(EEM_Transaction::incomplete_status_code);
367 367
 			$this->_current_txn->save();
368 368
 		}
369 369
 		$this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration
@@ -376,15 +376,15 @@  discard block
 block discarded – undo
376 376
 		);
377 377
 		$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
378 378
 		// txn status ?
379
-		if ( $this->_current_txn->is_completed() ) {
379
+		if ($this->_current_txn->is_completed()) {
380 380
 			$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
381 381
 		} else if (
382 382
 			$this->_current_txn->is_incomplete()
383
-			&& ( $this->_primary_registrant->is_approved()
384
-			|| $this->_primary_registrant->is_pending_payment() )
383
+			&& ($this->_primary_registrant->is_approved()
384
+			|| $this->_primary_registrant->is_pending_payment())
385 385
 		) {
386 386
 			$this->_show_try_pay_again_link = true;
387
-		} else if ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() ) {
387
+		} else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) {
388 388
 			// its pending
389 389
 			$this->_show_try_pay_again_link = isset(
390 390
 				EE_Registry::instance()->CFG->registration->show_pending_payment_options
@@ -410,23 +410,23 @@  discard block
 block discarded – undo
410 410
 		}
411 411
 		// link to SPCO
412 412
 		$revisit_spco_url = add_query_arg(
413
-			array( 'ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link ),
413
+			array('ee' => '_register', 'revisit' => true, 'e_reg_url_link' => $this->_reg_url_link),
414 414
 			EE_Registry::instance()->CFG->core->reg_page_url()
415 415
 		);
416 416
 		// link to SPCO payment_options
417 417
 		$this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration
418 418
 			? $this->_primary_registrant->payment_overview_url()
419 419
 			: add_query_arg(
420
-				array( 'step' => 'payment_options' ),
420
+				array('step' => 'payment_options'),
421 421
 				$revisit_spco_url
422 422
 			);
423 423
 		// link to SPCO attendee_information
424 424
 		$this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration
425 425
 			? $this->_primary_registrant->edit_attendee_information_url()
426 426
 			: false;
427
-		EE_Registry::instance()->load_helper( 'Template' );
428
-		EE_Registry::instance()->load_helper( 'Template_Validator' );
429
-		do_action( 'AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn );
427
+		EE_Registry::instance()->load_helper('Template');
428
+		EE_Registry::instance()->load_helper('Template_Validator');
429
+		do_action('AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn);
430 430
 		// set no cache headers and constants
431 431
 		EE_System::do_not_cache();
432 432
 	}
@@ -441,16 +441,16 @@  discard block
 block discarded – undo
441 441
 	 * @return    string
442 442
 	 * @throws \EE_Error
443 443
 	 */
444
-	public function process_shortcode( $attributes = array() ) {
444
+	public function process_shortcode($attributes = array()) {
445 445
 		$this->init();
446
-		if ( ! $this->_current_txn instanceof EE_Transaction ) {
446
+		if ( ! $this->_current_txn instanceof EE_Transaction) {
447 447
 			return EE_Error::get_notices();
448 448
 		}
449 449
 		//EE_Registry::instance()->load_helper( 'Debug_Tools' );
450 450
 		//EEH_Debug_Tools::log( __CLASS__, __FUNCTION__, __LINE__, array( $this->_current_txn ), true, 	'EE_Transaction: ' . $this->_current_txn->ID() );
451 451
 		// link to receipt
452
-		$template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url( 'html' );
453
-		if ( ! empty( $template_args['TXN_receipt_url'] ) ) {
452
+		$template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html');
453
+		if ( ! empty($template_args['TXN_receipt_url'])) {
454 454
 			$template_args['order_conf_desc'] = __(
455 455
 				'%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.',
456 456
 				'event_espresso'
@@ -462,13 +462,13 @@  discard block
 block discarded – undo
462 462
 			);
463 463
 		}
464 464
 		$template_args['transaction'] = $this->_current_txn;
465
-		$template_args['revisit'] = EE_Registry::instance()->REQ->get( 'revisit', false );
466
-		add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_registration_details' ) );
467
-		if ( $this->_is_primary && ! $this->_current_txn->is_free() ) {
468
-			add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_ajax_content' ) );
465
+		$template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', false);
466
+		add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details'));
467
+		if ($this->_is_primary && ! $this->_current_txn->is_free()) {
468
+			add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content'));
469 469
 		}
470 470
 		return EEH_Template::locate_template(
471
-			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php',
471
+			THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php',
472 472
 			$template_args,
473 473
 			true,
474 474
 			true
@@ -489,15 +489,15 @@  discard block
 block discarded – undo
489 489
 	 * @return    array
490 490
 	 * @throws \EE_Error
491 491
 	 */
492
-	public static function thank_you_page_IPN_monitor( $response = array(), $data = array() ) {
492
+	public static function thank_you_page_IPN_monitor($response = array(), $data = array()) {
493 493
 		// does this heartbeat contain our data ?
494
-		if ( ! isset( $data['espresso_thank_you_page'] ) ) {
494
+		if ( ! isset($data['espresso_thank_you_page'])) {
495 495
 			return $response;
496 496
 		}
497 497
 		// check for reg_url_link in the incoming heartbeat data
498
-		if ( ! isset( $data['espresso_thank_you_page']['e_reg_url_link'] ) ) {
498
+		if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) {
499 499
 			$response['espresso_thank_you_page'] = array(
500
-			'errors' => ! empty( $notices['errors'] )
500
+			'errors' => ! empty($notices['errors'])
501 501
 				? $notices['errors']
502 502
 				: __(
503 503
 					'No transaction information could be retrieved because the registration URL link is missing or invalid.',
@@ -512,15 +512,15 @@  discard block
 block discarded – undo
512 512
 		EES_Espresso_Thank_You::set_definitions();
513 513
 		/** @var $espresso_thank_you_page EES_Espresso_Thank_You */
514 514
 		$espresso_thank_you_page = EES_Espresso_Thank_You::instance();
515
-		$espresso_thank_you_page->set_reg_url_link( $data['espresso_thank_you_page']['e_reg_url_link'] );
515
+		$espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']);
516 516
 		$espresso_thank_you_page->init();
517 517
 		//get TXN
518 518
 		$TXN = $espresso_thank_you_page->get_txn();
519 519
 		// no TXN? then get out
520
-		if ( ! $TXN instanceof EE_Transaction ) {
520
+		if ( ! $TXN instanceof EE_Transaction) {
521 521
 			$notices = EE_Error::get_notices();
522 522
 			$response['espresso_thank_you_page'] = array(
523
-			'errors' => ! empty( $notices['errors'] )
523
+			'errors' => ! empty($notices['errors'])
524 524
 				? $notices['errors']
525 525
 				: sprintf(
526 526
 					__(
@@ -533,13 +533,13 @@  discard block
 block discarded – undo
533 533
 			return $response;
534 534
 		}
535 535
 		// grab transient of TXN's status
536
-		$txn_status = isset( $data['espresso_thank_you_page']['txn_status'] )
536
+		$txn_status = isset($data['espresso_thank_you_page']['txn_status'])
537 537
 			? $data['espresso_thank_you_page']['txn_status']
538 538
 			: null;
539 539
 		// has the TXN status changed since we last checked (or empty because this is the first time running through this code)?
540
-		if ( $txn_status !== $TXN->status_ID() ) {
540
+		if ($txn_status !== $TXN->status_ID()) {
541 541
 			// switch between two possible basic outcomes
542
-			switch ( $TXN->status_ID() ) {
542
+			switch ($TXN->status_ID()) {
543 543
 				// TXN has been updated in some way
544 544
 				case EEM_Transaction::overpaid_status_code:
545 545
 				case EEM_Transaction::complete_status_code:
@@ -554,25 +554,25 @@  discard block
 block discarded – undo
554 554
 				case EEM_Transaction::failed_status_code:
555 555
 				default:
556 556
 					// keep on waiting...
557
-					return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] );
557
+					return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
558 558
 			}
559 559
 			// or is the TXN still failed (never been updated) ???
560
-		} else if ( $TXN->failed() ) {
560
+		} else if ($TXN->failed()) {
561 561
 			// keep on waiting...
562
-			return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] );
562
+			return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']);
563 563
 		}
564 564
 		// TXN is happening so let's get the payments now
565 565
 		// if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked
566
-		$since = isset( $data['espresso_thank_you_page']['get_payments_since'] )
566
+		$since = isset($data['espresso_thank_you_page']['get_payments_since'])
567 567
 			? $data['espresso_thank_you_page']['get_payments_since']
568 568
 			: 0;
569 569
 		// then check for payments
570
-		$payments = $espresso_thank_you_page->get_txn_payments( $since );
570
+		$payments = $espresso_thank_you_page->get_txn_payments($since);
571 571
 		// has a payment been processed ?
572
-		if ( ! empty( $payments ) || $espresso_thank_you_page->_is_offline_payment_method ) {
573
-			if ( $since ) {
572
+		if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) {
573
+			if ($since) {
574 574
 				$response['espresso_thank_you_page'] = array(
575
-					'new_payments'        => $espresso_thank_you_page->get_new_payments( $payments ),
575
+					'new_payments'        => $espresso_thank_you_page->get_new_payments($payments),
576 576
 					'transaction_details' => $espresso_thank_you_page->get_transaction_details(),
577 577
 					'txn_status'          => $TXN->status_ID()
578 578
 				);
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
 	 * @param    array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data
599 599
 	 * @return    array
600 600
 	 */
601
-	private function _update_server_wait_time( $thank_you_page_data = array() ) {
601
+	private function _update_server_wait_time($thank_you_page_data = array()) {
602 602
 		$response['espresso_thank_you_page'] = array(
603
-			'still_waiting' => isset( $thank_you_page_data['initial_access'] )
603
+			'still_waiting' => isset($thank_you_page_data['initial_access'])
604 604
 				? time() - $thank_you_page_data['initial_access']
605 605
 				: 0,
606 606
 			'txn_status'    => $this->_current_txn->status_ID()
@@ -625,17 +625,17 @@  discard block
 block discarded – undo
625 625
 		$template_args['is_primary'] = $this->_is_primary;
626 626
 		$template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url;
627 627
 		$template_args['resend_reg_confirmation_url'] = add_query_arg(
628
-			array( 'token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true' ),
628
+			array('token' => $this->_reg_url_link, 'resend_reg_confirmation' => 'true'),
629 629
 			EE_Registry::instance()->CFG->core->thank_you_page_url()
630 630
 		);
631 631
 		// verify template arguments
632
-		EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' );
632
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
633 633
 		EEH_Template_Validator::verify_isnt_null(
634 634
 			$template_args['SPCO_attendee_information_url'],
635 635
 			'$SPCO_attendee_information_url'
636 636
 		);
637 637
 		echo EEH_Template::locate_template(
638
-			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php',
638
+			THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php',
639 639
 			$template_args,
640 640
 			true,
641 641
 			true
@@ -648,16 +648,16 @@  discard block
 block discarded – undo
648 648
 	 *    resend_reg_confirmation_email
649 649
 	 */
650 650
 	public static function resend_reg_confirmation_email() {
651
-		EE_Registry::instance()->load_core( 'Request_Handler' );
652
-		$reg_url_link = EE_Registry::instance()->REQ->get( 'token' );
651
+		EE_Registry::instance()->load_core('Request_Handler');
652
+		$reg_url_link = EE_Registry::instance()->REQ->get('token');
653 653
 		// was a REG_ID passed ?
654
-		if ( $reg_url_link ) {
655
-			$registration = EE_Registry::instance()->load_model( 'Registration' )->get_one(
656
-				array( array( 'REG_url_link' => $reg_url_link ) )
654
+		if ($reg_url_link) {
655
+			$registration = EE_Registry::instance()->load_model('Registration')->get_one(
656
+				array(array('REG_url_link' => $reg_url_link))
657 657
 			);
658
-			if ( $registration instanceof EE_Registration ) {
658
+			if ($registration instanceof EE_Registration) {
659 659
 				// resend email
660
-				EED_Messages::process_resend( array( '_REG_ID' => $registration->ID() ) );
660
+				EED_Messages::process_resend(array('_REG_ID' => $registration->ID()));
661 661
 			} else {
662 662
 				EE_Error::add_error(
663 663
 					__(
@@ -681,16 +681,16 @@  discard block
 block discarded – undo
681 681
 			);
682 682
 		}
683 683
 		// request sent via AJAX ?
684
-		if ( EE_FRONT_AJAX ) {
685
-			echo json_encode( EE_Error::get_notices( false ) );
684
+		if (EE_FRONT_AJAX) {
685
+			echo json_encode(EE_Error::get_notices(false));
686 686
 			die();
687 687
 			// or was JS disabled ?
688 688
 		} else {
689 689
 			// save errors so that they get picked up on the next request
690
-			EE_Error::get_notices( true, true );
690
+			EE_Error::get_notices(true, true);
691 691
 			wp_safe_redirect(
692 692
 				add_query_arg(
693
-					array( 'e_reg_url_link' => $reg_url_link ),
693
+					array('e_reg_url_link' => $reg_url_link),
694 694
 					EE_Registry::instance()->CFG->core->thank_you_page_url()
695 695
 				)
696 696
 			);
@@ -706,26 +706,26 @@  discard block
 block discarded – undo
706 706
 	 * @return    void
707 707
 	 */
708 708
 	public function get_ajax_content() {
709
-		if ( ! $this->get_txn() ) {
709
+		if ( ! $this->get_txn()) {
710 710
 			return;
711 711
 		}
712 712
 		// first determine which event(s) require pre-approval or not
713 713
 		$events = array();
714 714
 		$events_requiring_pre_approval = array();
715
-		foreach ( $this->_current_txn->registrations() as $registration ) {
716
-			if ( $registration instanceof EE_Registration ) {
715
+		foreach ($this->_current_txn->registrations() as $registration) {
716
+			if ($registration instanceof EE_Registration) {
717 717
 				$event = $registration->event();
718
-				if ( $event instanceof EE_Event ) {
719
-					if ( $registration->is_not_approved() && $registration->event() instanceof EE_Event ) {
720
-						$events_requiring_pre_approval[ $event->ID() ] = $event;
718
+				if ($event instanceof EE_Event) {
719
+					if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) {
720
+						$events_requiring_pre_approval[$event->ID()] = $event;
721 721
 					} else {
722
-						$events[ $event->ID() ] = $event;
722
+						$events[$event->ID()] = $event;
723 723
 					}
724 724
 				}
725 725
 			}
726 726
 		}
727
-		$this->display_details_for_events_requiring_pre_approval( $events_requiring_pre_approval );
728
-		$this->display_details_for_events( $events );
727
+		$this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval);
728
+		$this->display_details_for_events($events);
729 729
 	}
730 730
 
731 731
 
@@ -737,8 +737,8 @@  discard block
 block discarded – undo
737 737
 	 * @param EE_Event[] $events
738 738
 	 * @return string
739 739
 	 */
740
-	public function display_details_for_events( $events = array() ) {
741
-		if ( ! empty( $events ) ) {
740
+	public function display_details_for_events($events = array()) {
741
+		if ( ! empty($events)) {
742 742
 			?>
743 743
 			<div id="espresso-thank-you-page-ajax-content-dv">
744 744
 				<div id="espresso-thank-you-page-ajax-transaction-dv"></div>
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 							'event_espresso'
751 751
 							); ?></span>
752 752
 					</div>
753
-					<?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed ) : ?>
753
+					<?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?>
754 754
 						<p id="ee-ajax-loading-pg" class="highlight-bg small-text clear">
755 755
 							<?php echo apply_filters(
756 756
 								'EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg',
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 							); ?>
762 762
 							<br/>
763 763
 							<span class="jst-rght ee-block small-text lt-grey-text">
764
-								<?php _e( 'current wait time ', 'event_espresso' ); ?>
764
+								<?php _e('current wait time ', 'event_espresso'); ?>
765 765
 							<span id="espresso-thank-you-page-ajax-time-dv">00:00:00</span></span>
766 766
 						</p>
767 767
 					<?php endif; ?>
@@ -781,11 +781,11 @@  discard block
 block discarded – undo
781 781
 	 * @param EE_Event[] $events
782 782
 	 * @return string
783 783
 	 */
784
-	public function display_details_for_events_requiring_pre_approval( $events = array() ) {
785
-		if ( ! empty( $events ) ) {
784
+	public function display_details_for_events_requiring_pre_approval($events = array()) {
785
+		if ( ! empty($events)) {
786 786
 			?>
787 787
 			<div id="espresso-thank-you-page-not-approved-message-dv">
788
-				<h4 class="orange-text"><?php _e( 'Important Notice:', 'event_espresso' ); ?></h4>
788
+				<h4 class="orange-text"><?php _e('Important Notice:', 'event_espresso'); ?></h4>
789 789
 				<p id="events-requiring-pre-approval-pg" class="small-text">
790 790
 					<?php echo apply_filters(
791 791
 						'AHEE__EES_Espresso_Thank_You__get_ajax_content__not_approved_message',
@@ -796,8 +796,8 @@  discard block
 block discarded – undo
796 796
 					); ?>
797 797
 				</p>
798 798
 				<ul class="events-requiring-pre-approval-ul">
799
-					<?php foreach ( $events as $event ) {
800
-						if ( $event instanceof EE_Event ) {
799
+					<?php foreach ($events as $event) {
800
+						if ($event instanceof EE_Event) {
801 801
 							echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>',
802 802
 								$event->name(),
803 803
 								'</li>';
@@ -824,12 +824,12 @@  discard block
 block discarded – undo
824 824
 		$template_args = array();
825 825
 		$template_args['transaction'] = $this->_current_txn;
826 826
 		$template_args['reg_url_link'] = $this->_reg_url_link;
827
-		$template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name( true );
827
+		$template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(true);
828 828
 		// link to SPCO payment_options
829 829
 		$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
830 830
 		$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
831 831
 		// verify template arguments
832
-		EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' );
832
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
833 833
 		EEH_Template_Validator::verify_isnt_null(
834 834
 			$template_args['show_try_pay_again_link'],
835 835
 			'$show_try_pay_again_link'
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 			'$SPCO_payment_options_url'
840 840
 		);
841 841
 		return EEH_Template::locate_template(
842
-			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php',
842
+			THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php',
843 843
 			$template_args,
844 844
 			true,
845 845
 			true
@@ -856,9 +856,9 @@  discard block
 block discarded – undo
856 856
 	 * @return    string
857 857
 	 * @throws \EE_Error
858 858
 	 */
859
-	public function get_payment_row_html( $payment = null ) {
859
+	public function get_payment_row_html($payment = null) {
860 860
 		$html = '';
861
-		if ( $payment instanceof EE_Payment ) {
861
+		if ($payment instanceof EE_Payment) {
862 862
 			if (
863 863
 				$payment->payment_method() instanceof EE_Payment_Method
864 864
 				&& $payment->status() === EEM_Payment::status_id_failed
@@ -867,31 +867,31 @@  discard block
 block discarded – undo
867 867
 				// considering the registrant has made it to the Thank You page,
868 868
 				// any failed payments may actually be pending and the IPN is just slow
869 869
 				// so let's
870
-				$payment->set_status( EEM_Payment::status_id_pending );
870
+				$payment->set_status(EEM_Payment::status_id_pending);
871 871
 			}
872 872
 			$payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined
873
-				? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>'
873
+				? '<br /><span class="small-text">'.$payment->gateway_response().'</span>'
874 874
 				: '';
875 875
 			$html .= '
876 876
 				<tr>
877 877
 					<td>
878
-						' . $payment->timestamp() . '
878
+						' . $payment->timestamp().'
879 879
 					</td>
880 880
 					<td>
881 881
 						' . (
882 882
 								$payment->payment_method() instanceof EE_Payment_Method
883 883
 									? $payment->payment_method()->name()
884
-									: __( 'Unknown', 'event_espresso' )
885
-							) . '
884
+									: __('Unknown', 'event_espresso')
885
+							).'
886 886
 					</td>
887 887
 					<td class="jst-rght">
888
-						' . EEH_Template::format_currency( $payment->amount() ) . '
888
+						' . EEH_Template::format_currency($payment->amount()).'
889 889
 					</td>
890 890
 					<td class="jst-rght" style="line-height:1;">
891
-						' . $payment->pretty_status( true ) . $payment_declined_msg . '
891
+						' . $payment->pretty_status(true).$payment_declined_msg.'
892 892
 					</td>
893 893
 				</tr>';
894
-			do_action( 'AHEE__thank_you_page_payment_details_template__after_each_payment', $payment );
894
+			do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment);
895 895
 		}
896 896
 		return $html;
897 897
 	}
@@ -906,14 +906,14 @@  discard block
 block discarded – undo
906 906
 	 * @return    string
907 907
 	 * @throws \EE_Error
908 908
 	 */
909
-	public function get_payment_details( $payments = array() ) {
909
+	public function get_payment_details($payments = array()) {
910 910
 		//prepare variables for displaying
911 911
 		$template_args = array();
912 912
 		$template_args['transaction'] = $this->_current_txn;
913 913
 		$template_args['reg_url_link'] = $this->_reg_url_link;
914 914
 		$template_args['payments'] = array();
915
-		foreach ( $payments as $payment ) {
916
-			$template_args['payments'][] = $this->get_payment_row_html( $payment );
915
+		foreach ($payments as $payment) {
916
+			$template_args['payments'][] = $this->get_payment_row_html($payment);
917 917
 		}
918 918
 		//create a hacky payment object, but dont save it
919 919
 		$payment = EE_Payment::new_instance(
@@ -926,8 +926,8 @@  discard block
 block discarded – undo
926 926
 			)
927 927
 		);
928 928
 		$payment_method = $this->_current_txn->payment_method();
929
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base ) {
930
-			$template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content( $payment );
929
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) {
930
+			$template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment);
931 931
 		} else {
932 932
 			$template_args['gateway_content'] = '';
933 933
 		}
@@ -935,19 +935,19 @@  discard block
 block discarded – undo
935 935
 		$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
936 936
 		$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
937 937
 		// verify template arguments
938
-		EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' );
939
-		EEH_Template_Validator::verify_isnt_null( $template_args['payments'], '$payments' );
938
+		EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
939
+		EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments');
940 940
 		EEH_Template_Validator::verify_isnt_null(
941 941
 			$template_args['show_try_pay_again_link'],
942 942
 			'$show_try_pay_again_link'
943 943
 		);
944
-		EEH_Template_Validator::verify_isnt_null( $template_args['gateway_content'], '$gateway_content' );
944
+		EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content');
945 945
 		EEH_Template_Validator::verify_isnt_null(
946 946
 			$template_args['SPCO_payment_options_url'],
947 947
 			'$SPCO_payment_options_url'
948 948
 		);
949 949
 		return EEH_Template::locate_template(
950
-			THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php',
950
+			THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php',
951 951
 			$template_args,
952 952
 			true,
953 953
 			true
@@ -964,11 +964,11 @@  discard block
 block discarded – undo
964 964
 	 * @return    string
965 965
 	 * @throws \EE_Error
966 966
 	 */
967
-	public function get_new_payments( $payments = array() ) {
967
+	public function get_new_payments($payments = array()) {
968 968
 		$payments_html = '';
969 969
 		//prepare variables for displaying
970
-		foreach ( $payments as $payment ) {
971
-			$payments_html .= $this->get_payment_row_html( $payment );
970
+		foreach ($payments as $payment) {
971
+			$payments_html .= $this->get_payment_row_html($payment);
972 972
 		}
973 973
 		return $payments_html;
974 974
 	}
Please login to merge, or discard this patch.