Completed
Branch BUG-8957-add-countries (49f36b)
by
unknown
33:27 queued 16:54
created
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 4 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -808,7 +808,7 @@
 block discarded – undo
808 808
 
809 809
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
810 810
 
811
-			}  else {
811
+			} else {
812 812
 				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
813 813
 				// remove malformed data
814 814
 				unset( $valid_data[ $reg_url_link ] );
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_SPCO_Reg_Step_Attendee_Information
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_SPCO_Reg_Step_Attendee_Information
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage 	core
10
+  * @author 				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step {
15 15
 
16 16
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 				// generate hidden input
172 172
 				if (
173 173
 					isset( $subsections[ $primary_registrant ] )
174
-				     && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
174
+					 && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
175 175
 				) {
176 176
 					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
177 177
 				}
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 					if ( isset( $valid_data[ $reg_url_link ] ) ) {
903 903
 						// do we need to copy basic info from primary attendee ?
904 904
 						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] )
905
-						                && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0
905
+										&& absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0
906 906
 							? true
907 907
 							: false;
908 908
 						// filter form input data for this registration
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 			? $form_input
1080 1080
 			: $form_input . '-' . $registration->reg_url_link();
1081 1081
 		$answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] )
1082
-		                 && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer
1082
+						 && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer
1083 1083
 			? true
1084 1084
 			: false;
1085 1085
 		//rename form_inputs if they are EE_Attendee properties
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 		}
1320 1320
 		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1321 1321
 			if ( ! isset( $attendee_data[ $critical_attendee_detail ] )
1322
-			     || empty( $attendee_data[ $critical_attendee_detail ] )
1322
+				 || empty( $attendee_data[ $critical_attendee_detail ] )
1323 1323
 			) {
1324 1324
 				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(
1325 1325
 					$critical_attendee_detail
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -91,6 +91,7 @@
 block discarded – undo
91 91
 	 * @param EE_Registration $registration
92 92
 	 * @param EE_Question     $question
93 93
 	 * @param mixed EE_Answer|NULL      $answer
94
+	 * @param EE_Answer $answer
94 95
 	 * @return EE_Form_Input_Base
95 96
 	 */
96 97
 	public function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
Please login to merge, or discard this patch.
Spacing   +229 added lines, -230 removed lines patch added patch discarded remove patch
@@ -41,21 +41,21 @@  discard block
 block discarded – undo
41 41
 	 * @access    public
42 42
 	 * @param    EE_Checkout $checkout
43 43
 	 */
44
-	public function __construct( EE_Checkout $checkout ) {
44
+	public function __construct(EE_Checkout $checkout) {
45 45
 		$this->_slug = 'attendee_information';
46 46
 		$this->_name = __('Attendee Information', 'event_espresso');
47
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php';
47
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php';
48 48
 		$this->checkout = $checkout;
49 49
 		$this->_reset_success_message();
50 50
 		$this->set_instructions(
51
-			__( 'Please answer the following registration questions before proceeding.', 'event_espresso' )
51
+			__('Please answer the following registration questions before proceeding.', 'event_espresso')
52 52
 		);
53 53
 	}
54 54
 
55 55
 
56 56
 
57 57
 	public function translate_js_strings() {
58
-		EE_Registry::$i18n_js_strings['required_field'] = __( ' is a required question.', 'event_espresso' );
58
+		EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso');
59 59
 		EE_Registry::$i18n_js_strings['required_multi_field'] = __(
60 60
 			' is a required question. Please enter a value for at least one of the options.',
61 61
 			'event_espresso'
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		// calculate taxes
116 116
 		$Line_Item_Display->display_line_item(
117 117
 			$this->checkout->cart->get_grand_total(),
118
-			array( 'set_tax_rate' => true )
118
+			array('set_tax_rate' => true)
119 119
 		);
120 120
 		/** @var $subsections EE_Form_Section_Proper[] */
121 121
 		$subsections = array(
@@ -127,51 +127,51 @@  discard block
 block discarded – undo
127 127
 			'ticket_count' 	=> array()
128 128
 		);
129 129
 		// grab the saved registrations from the transaction
130
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
131
-		if ( $registrations ) {
132
-			foreach ( $registrations as $registration ) {
130
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
131
+		if ($registrations) {
132
+			foreach ($registrations as $registration) {
133 133
 				// can this registration be processed during this visit ?
134 134
 				if (
135 135
 					$registration instanceof EE_Registration
136
-					&& $this->checkout->visit_allows_processing_of_this_registration( $registration )
136
+					&& $this->checkout->visit_allows_processing_of_this_registration($registration)
137 137
 				) {
138
-					$subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration );
139
-					if ( ! $this->checkout->admin_request ) {
140
-						$template_args['registrations'][ $registration->reg_url_link() ] = $registration;
141
-						$template_args['ticket_count'][ $registration->ticket()->ID() ] = isset(
142
-							$template_args['ticket_count'][ $registration->ticket()->ID() ]
138
+					$subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration);
139
+					if ( ! $this->checkout->admin_request) {
140
+						$template_args['registrations'][$registration->reg_url_link()] = $registration;
141
+						$template_args['ticket_count'][$registration->ticket()->ID()] = isset(
142
+							$template_args['ticket_count'][$registration->ticket()->ID()]
143 143
 						)
144
-							? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1
144
+							? $template_args['ticket_count'][$registration->ticket()->ID()] + 1
145 145
 							: 1;
146 146
 						$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs(
147 147
 							$this->checkout->cart->get_grand_total(),
148 148
 							'Ticket',
149
-							array( $registration->ticket()->ID() )
149
+							array($registration->ticket()->ID())
150 150
 						);
151
-						$ticket_line_item = is_array( $ticket_line_item )
152
-							? reset( $ticket_line_item )
151
+						$ticket_line_item = is_array($ticket_line_item)
152
+							? reset($ticket_line_item)
153 153
 							: $ticket_line_item;
154
-						$template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item(
154
+						$template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item(
155 155
 							$ticket_line_item
156 156
 						);
157 157
 					}
158
-					if ( $registration->is_primary_registrant() ) {
158
+					if ($registration->is_primary_registrant()) {
159 159
 						$primary_registrant = $registration->reg_url_link();
160 160
 					}
161 161
 				}
162 162
 			}
163 163
 			// print_copy_info ?
164
-			if ( $primary_registrant && ! $this->checkout->admin_request && count( $registrations ) > 1 ) {
164
+			if ($primary_registrant && ! $this->checkout->admin_request && count($registrations) > 1) {
165 165
 				// TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info
166 166
 				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info
167 167
 					? $this->_copy_attendee_info_form()
168 168
 					: $this->_auto_copy_attendee_info();
169 169
 				// generate hidden input
170 170
 				if (
171
-					isset( $subsections[ $primary_registrant ] )
172
-				     && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
171
+					isset($subsections[$primary_registrant])
172
+				     && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper
173 173
 				) {
174
-					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
174
+					$subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false);
175 175
 				}
176 176
 			}
177 177
 
@@ -183,8 +183,7 @@  discard block
 block discarded – undo
183 183
 				'html_id' 					=> $this->reg_form_name(),
184 184
 				'subsections' 			=> $subsections,
185 185
 				'layout_strategy'		=> $this->checkout->admin_request ?
186
-					new EE_Div_Per_Section_Layout() :
187
-					new EE_Template_Layout(
186
+					new EE_Div_Per_Section_Layout() : new EE_Template_Layout(
188 187
 						array(
189 188
 							'layout_template_file' 	=> $this->_template, // layout_template
190 189
 							'template_args' 				=> $template_args
@@ -202,11 +201,11 @@  discard block
 block discarded – undo
202 201
 	 * @return EE_Form_Section_Proper
203 202
 	 * @throws \EE_Error
204 203
 	 */
205
-	private function _registrations_reg_form( EE_Registration $registration ) {
204
+	private function _registrations_reg_form(EE_Registration $registration) {
206 205
 		static $attendee_nmbr = 1;
207 206
 		// array of params to pass to parent constructor
208 207
 		$form_args = array(
209
-			'html_id'         => 'ee-registration-' . $registration->reg_url_link(),
208
+			'html_id'         => 'ee-registration-'.$registration->reg_url_link(),
210 209
 			'html_class'      => 'ee-reg-form-attendee-dv',
211 210
 			'html_style'      => $this->checkout->admin_request
212 211
 				? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'
@@ -215,24 +214,24 @@  discard block
 block discarded – undo
215 214
 			'layout_strategy' => new EE_Fieldset_Section_Layout(
216 215
 				array(
217 216
 					'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text',
218
-					'legend_text'  => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr )
217
+					'legend_text'  => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr)
219 218
 				)
220 219
 			)
221 220
 		);
222 221
 		// verify that registration has valid event
223
-		if ( $registration->event() instanceof EE_Event ) {
222
+		if ($registration->event() instanceof EE_Event) {
224 223
 			$query_params = array(
225 224
 				array(
226 225
 					'Event.EVT_ID' => $registration->event()->ID(),
227 226
 					'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false
228 227
 				),
229
-				'order_by'=>array( 'QSG_order'=>'ASC' )
228
+				'order_by'=>array('QSG_order'=>'ASC')
230 229
 			);
231
-			$question_groups = $registration->event()->question_groups( $query_params );
232
-			if ( $question_groups ) {
233
-				foreach ( $question_groups as $question_group ) {
234
-					if ( $question_group instanceof EE_Question_Group ) {
235
-						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form(
230
+			$question_groups = $registration->event()->question_groups($query_params);
231
+			if ($question_groups) {
232
+				foreach ($question_groups as $question_group) {
233
+					if ($question_group instanceof EE_Question_Group) {
234
+						$form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form(
236 235
 							$registration,
237 236
 							$question_group
238 237
 						);
@@ -245,10 +244,10 @@  discard block
 block discarded – undo
245 244
 				// if we have question groups for additional attendees, then display the copy options
246 245
 				$this->_print_copy_info = $attendee_nmbr > 1 ? true : $this->_print_copy_info;
247 246
 			} else {
248
-				$form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link(
249
-				) ] = new EE_Form_Section_HTML(
247
+				$form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link(
248
+				)] = new EE_Form_Section_HTML(
250 249
 					EEH_Template::locate_template(
251
-						SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php',
250
+						SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php',
252 251
 						apply_filters(
253 252
 							'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args',
254 253
 							array()
@@ -267,12 +266,12 @@  discard block
 block discarded – undo
267 266
 
268 267
 			}
269 268
 		}
270
-		if ( $registration->is_primary_registrant() ) {
269
+		if ($registration->is_primary_registrant()) {
271 270
 			// generate hidden input
272
-			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration );
271
+			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration);
273 272
 		}
274 273
 		$attendee_nmbr++;
275
-		return new EE_Form_Section_Proper( $form_args );
274
+		return new EE_Form_Section_Proper($form_args);
276 275
 	}
277 276
 
278 277
 
@@ -293,7 +292,7 @@  discard block
 block discarded – undo
293 292
 		// generate hidden input
294 293
 		return new EE_Hidden_Input(
295 294
 			array(
296
-				'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),
295
+				'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(),
297 296
 				'default' => $additional_attendee_reg_info
298 297
 			)
299 298
 		);
@@ -307,26 +306,26 @@  discard block
 block discarded – undo
307 306
 	 * @return EE_Form_Section_Proper
308 307
 	 * @throws \EE_Error
309 308
 	 */
310
-	private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){
309
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) {
311 310
 		// array of params to pass to parent constructor
312 311
 		$form_args = array(
313
-			'html_id'         => 'ee-reg-form-qstn-grp-' . $question_group->identifier(),
312
+			'html_id'         => 'ee-reg-form-qstn-grp-'.$question_group->identifier(),
314 313
 			'html_class'      => $this->checkout->admin_request
315 314
 				? 'form-table ee-reg-form-qstn-grp-dv'
316 315
 				: 'ee-reg-form-qstn-grp-dv',
317
-			'html_label_id'   => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl',
316
+			'html_label_id'   => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl',
318 317
 			'subsections'     => array(
319
-				'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group )
318
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group)
320 319
 			),
321 320
 			'layout_strategy' => $this->checkout->admin_request
322 321
 				? new EE_Admin_Two_Column_Layout()
323 322
 				: new EE_Div_Per_Section_Layout()
324 323
 		);
325 324
 		// where params
326
-		$query_params = array( 'QST_deleted' => 0 );
325
+		$query_params = array('QST_deleted' => 0);
327 326
 		// don't load admin only questions on the frontend
328
-		if ( ! $this->checkout->admin_request ) {
329
-			$query_params['QST_admin_only'] = array( '!=', true );
327
+		if ( ! $this->checkout->admin_request) {
328
+			$query_params['QST_admin_only'] = array('!=', true);
330 329
 		}
331 330
 		$questions = $question_group->get_many_related(
332 331
 			'Question',
@@ -348,10 +347,10 @@  discard block
 block discarded – undo
348 347
 			)
349 348
 		);
350 349
 		// loop thru questions
351
-		foreach ( $questions as $question ) {
352
-			if( $question instanceof EE_Question ){
350
+		foreach ($questions as $question) {
351
+			if ($question instanceof EE_Question) {
353 352
 				$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
354
-				$form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question );
353
+				$form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
355 354
 			}
356 355
 		}
357 356
 		$form_args['subsections'] = apply_filters(
@@ -372,7 +371,7 @@  discard block
 block discarded – undo
372 371
 			)
373 372
 		);
374 373
 //		d( $form_args );
375
-		$question_group_reg_form = new EE_Form_Section_Proper( $form_args );
374
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
376 375
 		return apply_filters(
377 376
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',
378 377
 			$question_group_reg_form,
@@ -389,11 +388,11 @@  discard block
 block discarded – undo
389 388
 	 * @param EE_Question_Group $question_group
390 389
 	 * @return 	EE_Form_Section_HTML
391 390
 	 */
392
-	private function _question_group_header( EE_Question_Group $question_group ){
391
+	private function _question_group_header(EE_Question_Group $question_group) {
393 392
 		$html = '';
394 393
 		// group_name
395
-		if ( $question_group->show_group_name() && $question_group->name() !== '' ) {
396
-			if ( $this->checkout->admin_request ) {
394
+		if ($question_group->show_group_name() && $question_group->name() !== '') {
395
+			if ($this->checkout->admin_request) {
397 396
 				$html .= EEH_HTML::br();
398 397
 				$html .= EEH_HTML::h3(
399 398
 					$question_group->name(),
@@ -407,7 +406,7 @@  discard block
 block discarded – undo
407 406
 			}
408 407
 		}
409 408
 		// group_desc
410
-		if ( $question_group->show_group_desc() && $question_group->desc() !== '' ) {
409
+		if ($question_group->show_group_desc() && $question_group->desc() !== '') {
411 410
 			$html .= EEH_HTML::p(
412 411
 				$question_group->desc(),
413 412
 				'',
@@ -417,7 +416,7 @@  discard block
 block discarded – undo
417 416
 			);
418 417
 
419 418
 		}
420
-		return new EE_Form_Section_HTML( $html );
419
+		return new EE_Form_Section_HTML($html);
421 420
 	}
422 421
 
423 422
 
@@ -427,7 +426,7 @@  discard block
 block discarded – undo
427 426
 	 * @return    EE_Form_Section_Proper
428 427
 	 * @throws \EE_Error
429 428
 	 */
430
-	private function _copy_attendee_info_form(){
429
+	private function _copy_attendee_info_form() {
431 430
 		// array of params to pass to parent constructor
432 431
 		return new EE_Form_Section_Proper(
433 432
 			array(
@@ -456,7 +455,7 @@  discard block
 block discarded – undo
456 455
 	private function _auto_copy_attendee_info() {
457 456
 		return new EE_Form_Section_HTML(
458 457
 			EEH_Template::locate_template(
459
-				SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php',
458
+				SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php',
460 459
 				apply_filters(
461 460
 					'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args',
462 461
 					array()
@@ -480,32 +479,32 @@  discard block
 block discarded – undo
480 479
 		$copy_attendee_info_inputs = array();
481 480
 		$prev_ticket = NULL;
482 481
 		// grab the saved registrations from the transaction
483
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
484
-		foreach ( $registrations as $registration ) {
482
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
483
+		foreach ($registrations as $registration) {
485 484
 			// for all  attendees other than the primary attendee
486
-			if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) {
485
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
487 486
 				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
488
-				if ( $registration->ticket()->ID() !== $prev_ticket ) {
487
+				if ($registration->ticket()->ID() !== $prev_ticket) {
489 488
 					$item_name = $registration->ticket()->name();
490 489
 					$item_name .= $registration->ticket()->description() !== ''
491
-						? ' - ' . $registration->ticket()->description()
490
+						? ' - '.$registration->ticket()->description()
492 491
 						: '';
493
-					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML(
494
-						'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
492
+					$copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML(
493
+						'<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
495 494
 					);
496 495
 					$prev_ticket = $registration->ticket()->ID();
497 496
 				}
498 497
 
499
-				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new
498
+				$copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new
500 499
 				EE_Checkbox_Multi_Input(
501 500
 					array(
502 501
 						$registration->ID() => sprintf(
503
-							__( 'Attendee #%s', 'event_espresso' ),
502
+							__('Attendee #%s', 'event_espresso'),
504 503
 							$registration->count()
505 504
 						)
506 505
 					),
507 506
 					array(
508
-						'html_id'                 => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
507
+						'html_id'                 => 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
509 508
 						'html_class'              => 'spco-copy-attendee-chk ee-do-not-validate',
510 509
 						'display_html_label_text' => false
511 510
 					)
@@ -525,7 +524,7 @@  discard block
 block discarded – undo
525 524
 	 * @return    EE_Form_Input_Base
526 525
 	 * @throws \EE_Error
527 526
 	 */
528
-	private function _additional_primary_registrant_inputs( EE_Registration $registration ){
527
+	private function _additional_primary_registrant_inputs(EE_Registration $registration) {
529 528
 		// generate hidden input
530 529
 		return new EE_Hidden_Input(
531 530
 			array(
@@ -544,7 +543,7 @@  discard block
 block discarded – undo
544 543
 	 * @return    EE_Form_Input_Base
545 544
 	 * @throws \EE_Error
546 545
 	 */
547
-	public function reg_form_question( EE_Registration $registration, EE_Question $question ){
546
+	public function reg_form_question(EE_Registration $registration, EE_Question $question) {
548 547
 
549 548
 		// if this question was for an attendee detail, then check for that answer
550 549
 		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value(
@@ -553,32 +552,32 @@  discard block
 block discarded – undo
553 552
 		);
554 553
 		$answer = $answer_value === null
555 554
 			? EEM_Answer::instance()->get_one(
556
-				array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) )
555
+				array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))
557 556
 			)
558 557
 			: null;
559 558
 		// if NOT returning to edit an existing registration
560 559
 		// OR if this question is for an attendee property
561 560
 		// OR we still don't have an EE_Answer object
562
-		if( $answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link() ) {
561
+		if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) {
563 562
 			// create an EE_Answer object for storing everything in
564
-			$answer = EE_Answer::new_instance ( array(
563
+			$answer = EE_Answer::new_instance(array(
565 564
 				'QST_ID'=> $question->ID(),
566 565
 				'REG_ID'=> $registration->ID()
567 566
 			));
568 567
 		}
569 568
 		// verify instance
570
-		if( $answer instanceof EE_Answer ){
571
-			if ( ! empty( $answer_value )) {
572
-				$answer->set( 'ANS_value', $answer_value );
569
+		if ($answer instanceof EE_Answer) {
570
+			if ( ! empty($answer_value)) {
571
+				$answer->set('ANS_value', $answer_value);
573 572
 			}
574
-			$answer->cache( 'Question', $question );
573
+			$answer->cache('Question', $question);
575 574
 			//remember system ID had a bug where sometimes it could be null
576
-			$answer_cache_id =$question->is_system_question()
577
-				? $question->system_ID() . '-' . $registration->reg_url_link()
578
-				: $question->ID() . '-' . $registration->reg_url_link();
579
-			$registration->cache( 'Answer', $answer, $answer_cache_id );
575
+			$answer_cache_id = $question->is_system_question()
576
+				? $question->system_ID().'-'.$registration->reg_url_link()
577
+				: $question->ID().'-'.$registration->reg_url_link();
578
+			$registration->cache('Answer', $answer, $answer_cache_id);
580 579
 		}
581
-		return $this->_generate_question_input( $registration, $question, $answer );
580
+		return $this->_generate_question_input($registration, $question, $answer);
582 581
 
583 582
 	}
584 583
 
@@ -591,46 +590,46 @@  discard block
 block discarded – undo
591 590
 	 * @return EE_Form_Input_Base
592 591
 	 * @throws \EE_Error
593 592
 	 */
594
-	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
593
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) {
595 594
 		$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
596
-		$this->_required_questions[ $identifier ] = $question->required() ? true : false;
595
+		$this->_required_questions[$identifier] = $question->required() ? true : false;
597 596
 		add_filter(
598 597
 			'FHEE__EE_Question__generate_form_input__country_options',
599
-			array( $this, 'use_cached_countries_for_form_input' ),
598
+			array($this, 'use_cached_countries_for_form_input'),
600 599
 			10,
601 600
 			4
602 601
 		);
603 602
 		add_filter(
604 603
 			'FHEE__EE_Question__generate_form_input__state_options',
605
-			array( $this, 'use_cached_states_for_form_input' ),
604
+			array($this, 'use_cached_states_for_form_input'),
606 605
 			10,
607 606
 			4
608 607
 		);
609 608
 		$input_constructor_args = array(
610
-			'html_name'     => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
611
-			'html_id'       => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
612
-			'html_class'    => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
613
-			'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
609
+			'html_name'     => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
610
+			'html_id'       => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
611
+			'html_class'    => 'ee-reg-qstn ee-reg-qstn-'.$identifier,
612
+			'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
614 613
 			'html_label_class'	=> 'ee-reg-qstn',
615 614
 		);
616
-		$input_constructor_args['html_label_id'] 	.= '-lbl';
617
-		if ( $answer instanceof EE_Answer && $answer->ID() ) {
618
-			$input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']';
619
-			$input_constructor_args[ 'html_id' ] .= '-' . $answer->ID();
620
-			$input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID();
615
+		$input_constructor_args['html_label_id'] .= '-lbl';
616
+		if ($answer instanceof EE_Answer && $answer->ID()) {
617
+			$input_constructor_args['html_name'] .= '['.$answer->ID().']';
618
+			$input_constructor_args['html_id'] .= '-'.$answer->ID();
619
+			$input_constructor_args['html_label_id'] .= '-'.$answer->ID();
621 620
 		}
622
-		$form_input =  $question->generate_form_input(
621
+		$form_input = $question->generate_form_input(
623 622
 			$registration,
624 623
 			$answer,
625 624
 			$input_constructor_args
626 625
 		);
627 626
 		remove_filter(
628 627
 			'FHEE__EE_Question__generate_form_input__country_options',
629
-			array( $this, 'use_cached_countries_for_form_input' )
628
+			array($this, 'use_cached_countries_for_form_input')
630 629
 		);
631 630
 		remove_filter(
632 631
 			'FHEE__EE_Question__generate_form_input__state_options',
633
-			array( $this, 'use_cached_states_for_form_input' )
632
+			array($this, 'use_cached_states_for_form_input')
634 633
 		);
635 634
 		return $form_input;
636 635
 	}
@@ -652,22 +651,22 @@  discard block
 block discarded – undo
652 651
 		\EE_Registration $registration = null,
653 652
 		\EE_Answer $answer = null
654 653
 	) {
655
-		$country_options = array( '' => '' );
654
+		$country_options = array('' => '');
656 655
 		// get possibly cached list of countries
657 656
 		$countries = $this->checkout->action === 'process_reg_step'
658 657
 			? EEM_Country::instance()->get_all_countries()
659 658
 			: EEM_Country::instance()->get_all_active_countries();
660
-		if ( ! empty( $countries )) {
661
-			foreach( $countries as $country ){
662
-				if ( $country instanceof EE_Country ) {
663
-					$country_options[ $country->ID() ] = $country->name();
659
+		if ( ! empty($countries)) {
660
+			foreach ($countries as $country) {
661
+				if ($country instanceof EE_Country) {
662
+					$country_options[$country->ID()] = $country->name();
664 663
 				}
665 664
 			}
666 665
 		}
667
-		if( $question instanceof EE_Question
668
-			&& $registration instanceof EE_Registration ) {
666
+		if ($question instanceof EE_Question
667
+			&& $registration instanceof EE_Registration) {
669 668
 			$answer = EEM_Answer::instance()->get_one(
670
-				array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) )
669
+				array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))
671 670
 			);
672 671
 		} else {
673 672
 			$answer = EE_Answer::new_instance();
@@ -700,14 +699,14 @@  discard block
 block discarded – undo
700 699
 		\EE_Registration $registration = null,
701 700
 		\EE_Answer $answer = null
702 701
 	) {
703
-		$state_options = array( '' => array( '' => ''));
702
+		$state_options = array('' => array('' => ''));
704 703
 		$states = $this->checkout->action === 'process_reg_step'
705 704
 			? EEM_State::instance()->get_all_states()
706 705
 			: EEM_State::instance()->get_all_active_states();
707
-		if ( ! empty( $states )) {
708
-			foreach( $states as $state ){
709
-				if ( $state instanceof EE_State ) {
710
-					$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
706
+		if ( ! empty($states)) {
707
+			foreach ($states as $state) {
708
+				if ($state instanceof EE_State) {
709
+					$state_options[$state->country()->name()][$state->ID()] = $state->name();
711 710
 				}
712 711
 			}
713 712
 		}
@@ -735,24 +734,24 @@  discard block
 block discarded – undo
735 734
 	 * @throws \EE_Error
736 735
 	 */
737 736
 	public function process_reg_step() {
738
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
737
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
739 738
 		// grab validated data from form
740 739
 		$valid_data = $this->checkout->current_step->valid_data();
741 740
 		// EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
742 741
 		// EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );
743 742
 		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
744
-		if ( empty( $valid_data ))  {
743
+		if (empty($valid_data)) {
745 744
 			EE_Error::add_error(
746
-				__( 'No valid question responses were received.', 'event_espresso' ),
745
+				__('No valid question responses were received.', 'event_espresso'),
747 746
 				__FILE__,
748 747
 				__FUNCTION__,
749 748
 				__LINE__
750 749
 			);
751 750
 			return false;
752 751
 		}
753
-		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) {
752
+		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
754 753
 			EE_Error::add_error(
755
-				__( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ),
754
+				__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'),
756 755
 				__FILE__,
757 756
 				__FUNCTION__,
758 757
 				__LINE__
@@ -760,11 +759,11 @@  discard block
 block discarded – undo
760 759
 			return false;
761 760
 		}
762 761
 		// get cached registrations
763
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
762
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
764 763
 		// verify we got the goods
765
-		if ( empty( $registrations )) {
764
+		if (empty($registrations)) {
766 765
 			EE_Error::add_error(
767
-				__( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ),
766
+				__('Your form data could not be applied to any valid registrations.', 'event_espresso'),
768 767
 				__FILE__,
769 768
 				__FUNCTION__,
770 769
 				__LINE__
@@ -772,15 +771,15 @@  discard block
 block discarded – undo
772 771
 			return false;
773 772
 		}
774 773
 		// extract attendee info from form data and save to model objects
775
-		$registrations_processed = $this->_process_registrations( $registrations, $valid_data );
774
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
776 775
 		// if first pass thru SPCO,
777 776
 		// then let's check processed registrations against the total number of tickets in the cart
778
-		if ( $registrations_processed === false ) {
777
+		if ($registrations_processed === false) {
779 778
 			// but return immediately if the previous step exited early due to errors
780 779
 			return false;
781
-		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) {
780
+		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
782 781
 			// generate a correctly translated string for all possible singular/plural combinations
783
-			if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) {
782
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
784 783
 				$error_msg = sprintf(
785 784
 					__(
786 785
 						'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed',
@@ -789,7 +788,7 @@  discard block
 block discarded – undo
789 788
 					$this->checkout->total_ticket_count,
790 789
 					$registrations_processed
791 790
 				);
792
-			} else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) {
791
+			} else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
793 792
 				$error_msg = sprintf(
794 793
 					__(
795 794
 						'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed',
@@ -808,17 +807,17 @@  discard block
 block discarded – undo
808 807
 					$registrations_processed
809 808
 				);
810 809
 			}
811
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
810
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
812 811
 			return false;
813 812
 		}
814 813
 		// mark this reg step as completed
815 814
 		$this->set_completed();
816 815
 		$this->_set_success_message(
817
-			__( 'The Attendee Information Step has been successfully completed.', 'event_espresso' )
816
+			__('The Attendee Information Step has been successfully completed.', 'event_espresso')
818 817
 		);
819 818
 		//do action in case a plugin wants to do something with the data submitted in step 1.
820 819
 		//passes EE_Single_Page_Checkout, and it's posted data
821
-		do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data );
820
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
822 821
 		return true;
823 822
 	}
824 823
 
@@ -832,9 +831,9 @@  discard block
 block discarded – undo
832 831
 	 * @return boolean | int
833 832
 	 * @throws \EE_Error
834 833
 	 */
835
-	private function _process_registrations( $registrations = array(), $valid_data = array() ) {
834
+	private function _process_registrations($registrations = array(), $valid_data = array()) {
836 835
 		// load resources and set some defaults
837
-		EE_Registry::instance()->load_model( 'Attendee' );
836
+		EE_Registry::instance()->load_model('Attendee');
838 837
 		// holder for primary registrant attendee object
839 838
 		$this->checkout->primary_attendee_obj = NULL;
840 839
 		// array for tracking reg form data for the primary registrant
@@ -851,9 +850,9 @@  discard block
 block discarded – undo
851 850
 		// attendee counter
852 851
 		$att_nmbr = 0;
853 852
 		// grab the saved registrations from the transaction
854
-		foreach ( $registrations  as $registration ) {
853
+		foreach ($registrations  as $registration) {
855 854
 			// verify EE_Registration object
856
-			if ( ! $registration instanceof EE_Registration ) {
855
+			if ( ! $registration instanceof EE_Registration) {
857 856
 				EE_Error::add_error(
858 857
 					__(
859 858
 						'An invalid Registration object was discovered when attempting to process your registration information.',
@@ -868,12 +867,12 @@  discard block
 block discarded – undo
868 867
 			/** @var string $reg_url_link */
869 868
 			$reg_url_link = $registration->reg_url_link();
870 869
 			// reg_url_link exists ?
871
-			if ( ! empty( $reg_url_link ) ) {
870
+			if ( ! empty($reg_url_link)) {
872 871
 				// should this registration be processed during this visit ?
873
-				if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
872
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
874 873
 					// if NOT revisiting, then let's save the registration now,
875 874
 					// so that we have a REG_ID to use when generating other objects
876
-					if ( ! $this->checkout->revisit ) {
875
+					if ( ! $this->checkout->revisit) {
877 876
 						$registration->save();
878 877
 					}
879 878
 					/**
@@ -883,7 +882,7 @@  discard block
 block discarded – undo
883 882
 					 * @var bool   if true is returned by the plugin then the
884 883
 					 *      		registration processing is halted.
885 884
 					 */
886
-					if ( apply_filters(
885
+					if (apply_filters(
887 886
 						'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process',
888 887
 						false,
889 888
 						$att_nmbr,
@@ -891,38 +890,38 @@  discard block
 block discarded – undo
891 890
 						$registrations,
892 891
 						$valid_data,
893 892
 						$this
894
-					) ) {
893
+					)) {
895 894
 						return false;
896 895
 					}
897 896
 
898 897
 					// Houston, we have a registration!
899 898
 					$att_nmbr++;
900
-					$this->_attendee_data[ $reg_url_link ] = array();
899
+					$this->_attendee_data[$reg_url_link] = array();
901 900
 					// grab any existing related answer objects
902 901
 					$this->_registration_answers = $registration->answers();
903 902
 					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
904
-					if ( isset( $valid_data[ $reg_url_link ] ) ) {
903
+					if (isset($valid_data[$reg_url_link])) {
905 904
 						// do we need to copy basic info from primary attendee ?
906
-						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] )
907
-						                && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0
905
+						$copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info'])
906
+						                && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0
908 907
 							? true
909 908
 							: false;
910 909
 						// filter form input data for this registration
911
-						$valid_data[ $reg_url_link ] = (array)apply_filters(
910
+						$valid_data[$reg_url_link] = (array) apply_filters(
912 911
 							'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',
913
-							$valid_data[ $reg_url_link ]
912
+							$valid_data[$reg_url_link]
914 913
 						);
915 914
 						// EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ );
916
-						if ( isset( $valid_data['primary_attendee'] )) {
917
-							$primary_registrant['line_item_id'] =  ! empty( $valid_data['primary_attendee'] )
915
+						if (isset($valid_data['primary_attendee'])) {
916
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee'])
918 917
 								? $valid_data['primary_attendee']
919 918
 								: false;
920
-							unset( $valid_data['primary_attendee'] );
919
+							unset($valid_data['primary_attendee']);
921 920
 						}
922 921
 						// now loop through our array of valid post data && process attendee reg forms
923
-						foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) {
924
-							if ( ! in_array( $form_section, $non_input_form_sections )) {
925
-								foreach ( $form_inputs as $form_input => $input_value ) {
922
+						foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
923
+							if ( ! in_array($form_section, $non_input_form_sections)) {
924
+								foreach ($form_inputs as $form_input => $input_value) {
926 925
 									// \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ );
927 926
 									// check for critical inputs
928 927
 									if (
@@ -936,16 +935,16 @@  discard block
 block discarded – undo
936 935
 									// store a bit of data about the primary attendee
937 936
 									if (
938 937
 										$att_nmbr === 1
939
-										&& ! empty( $input_value )
938
+										&& ! empty($input_value)
940 939
 										&& $reg_url_link === $primary_registrant['line_item_id']
941 940
 									) {
942
-										$primary_registrant[ $form_input ] = $input_value;
941
+										$primary_registrant[$form_input] = $input_value;
943 942
 									} else if (
944 943
 										$copy_primary
945 944
 										&& $input_value === null
946
-										&& isset( $primary_registrant[ $form_input ] )
945
+										&& isset($primary_registrant[$form_input])
947 946
 									) {
948
-										$input_value = $primary_registrant[ $form_input ];
947
+										$input_value = $primary_registrant[$form_input];
949 948
 									}
950 949
 									// now attempt to save the input data
951 950
 									if (
@@ -987,55 +986,55 @@  discard block
 block discarded – undo
987 986
 						// have we met before?
988 987
 						$attendee = $this->_find_existing_attendee(
989 988
 							$registration,
990
-							$this->_attendee_data[ $reg_url_link ]
989
+							$this->_attendee_data[$reg_url_link]
991 990
 						);
992 991
 						// did we find an already existing record for this attendee ?
993
-						if ( $attendee instanceof EE_Attendee ) {
992
+						if ($attendee instanceof EE_Attendee) {
994 993
 							$attendee = $this->_update_existing_attendee_data(
995 994
 								$attendee,
996
-								$this->_attendee_data[ $reg_url_link ]
995
+								$this->_attendee_data[$reg_url_link]
997 996
 							);
998 997
 						} else {
999 998
 							// ensure critical details are set for additional attendees
1000
-							$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1
999
+							$this->_attendee_data[$reg_url_link] = $att_nmbr > 1
1001 1000
 								? $this->_copy_critical_attendee_details_from_primary_registrant(
1002
-									$this->_attendee_data[ $reg_url_link ]
1001
+									$this->_attendee_data[$reg_url_link]
1003 1002
 								)
1004
-								: $this->_attendee_data[ $reg_url_link ];
1003
+								: $this->_attendee_data[$reg_url_link];
1005 1004
 							$attendee = $this->_create_new_attendee(
1006 1005
 								$registration,
1007
-								$this->_attendee_data[ $reg_url_link ]
1006
+								$this->_attendee_data[$reg_url_link]
1008 1007
 							);
1009 1008
 						}
1010 1009
 						// who's #1 ?
1011
-						if ( $att_nmbr === 1 ) {
1010
+						if ($att_nmbr === 1) {
1012 1011
 							$this->checkout->primary_attendee_obj = $attendee;
1013 1012
 						}
1014 1013
 					}
1015 1014
 					// EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );
1016 1015
 					// add relation to registration, set attendee ID, and cache attendee
1017
-					$this->_associate_attendee_with_registration( $registration, $attendee );
1016
+					$this->_associate_attendee_with_registration($registration, $attendee);
1018 1017
 					// \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ );
1019
-					if ( ! $registration->attendee() instanceof EE_Attendee ) {
1020
-						EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ );
1018
+					if ( ! $registration->attendee() instanceof EE_Attendee) {
1019
+						EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__);
1021 1020
 						return false;
1022 1021
 					}
1023 1022
 					/** @type EE_Registration_Processor $registration_processor */
1024
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1023
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1025 1024
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1026
-					$registration_processor->toggle_incomplete_registration_status_to_default( $registration, false );
1025
+					$registration_processor->toggle_incomplete_registration_status_to_default($registration, false);
1027 1026
 					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1028 1027
 					$this->checkout->transaction->toggle_failed_transaction_status();
1029 1028
 					// if we've gotten this far, then let's save what we have
1030 1029
 					$registration->save();
1031 1030
 					// add relation between TXN and registration
1032
-					$this->_associate_registration_with_transaction( $registration );
1031
+					$this->_associate_registration_with_transaction($registration);
1033 1032
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
1034 1033
 
1035
-			}  else {
1036
-				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1034
+			} else {
1035
+				EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1037 1036
 				// remove malformed data
1038
-				unset( $valid_data[ $reg_url_link ] );
1037
+				unset($valid_data[$reg_url_link]);
1039 1038
 				return false;
1040 1039
 			}
1041 1040
 
@@ -1064,26 +1063,26 @@  discard block
 block discarded – undo
1064 1063
 		// \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );
1065 1064
 		// allow for plugins to hook in and do their own processing of the form input.
1066 1065
 		// For plugins to bypass normal processing here, they just need to return a boolean value.
1067
-		if ( apply_filters(
1066
+		if (apply_filters(
1068 1067
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input',
1069 1068
 			false,
1070 1069
 			$registration,
1071 1070
 			$form_input,
1072 1071
 			$input_value,
1073 1072
 			$this
1074
-		) ) {
1073
+		)) {
1075 1074
 			return true;
1076 1075
 		}
1077 1076
 		// $answer_cache_id is the key used to find the EE_Answer we want
1078 1077
 		$answer_cache_id = $this->checkout->reg_url_link
1079 1078
 			? $form_input
1080
-			: $form_input . '-' . $registration->reg_url_link();
1081
-		$answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] )
1082
-		                 && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer
1079
+			: $form_input.'-'.$registration->reg_url_link();
1080
+		$answer_is_obj = isset($this->_registration_answers[$answer_cache_id])
1081
+		                 && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer
1083 1082
 			? true
1084 1083
 			: false;
1085 1084
 		//rename form_inputs if they are EE_Attendee properties
1086
-		switch( (string)$form_input ) {
1085
+		switch ((string) $form_input) {
1087 1086
 
1088 1087
 			case 'state' :
1089 1088
 			case 'STA_ID' :
@@ -1098,32 +1097,32 @@  discard block
 block discarded – undo
1098 1097
 				break;
1099 1098
 
1100 1099
 			default :
1101
-				$ATT_input = 'ATT_' . $form_input;
1100
+				$ATT_input = 'ATT_'.$form_input;
1102 1101
 				//EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );
1103
-				$attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? true : false;
1104
-				$form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;
1102
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false;
1103
+				$form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;
1105 1104
 		}
1106 1105
 		// EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );
1107 1106
 		// EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );
1108 1107
 		// EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );
1109 1108
 		// if this form input has a corresponding attendee property
1110
-		if ( $attendee_property ) {
1111
-			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
1112
-			if ( $answer_is_obj ) {
1109
+		if ($attendee_property) {
1110
+			$this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
1111
+			if ($answer_is_obj) {
1113 1112
 				// and delete the corresponding answer since we won't be storing this data in that object
1114
-				$registration->_remove_relation_to( $this->_registration_answers[ $answer_cache_id ], 'Answer' );
1115
-				$this->_registration_answers[ $answer_cache_id ]->delete_permanently();
1113
+				$registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer');
1114
+				$this->_registration_answers[$answer_cache_id]->delete_permanently();
1116 1115
 			}
1117 1116
 			return true;
1118
-		} elseif ( $answer_is_obj ) {
1117
+		} elseif ($answer_is_obj) {
1119 1118
 			// save this data to the answer object
1120
-			$this->_registration_answers[ $answer_cache_id ]->set_value( $input_value );
1121
-			$result = $this->_registration_answers[ $answer_cache_id ]->save();
1119
+			$this->_registration_answers[$answer_cache_id]->set_value($input_value);
1120
+			$result = $this->_registration_answers[$answer_cache_id]->save();
1122 1121
 			return $result !== false ? true : false;
1123 1122
 		} else {
1124
-			foreach ( $this->_registration_answers as $answer ) {
1125
-				if ( $answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id ) {
1126
-					$answer->set_value( $input_value );
1123
+			foreach ($this->_registration_answers as $answer) {
1124
+				if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) {
1125
+					$answer->set_value($input_value);
1127 1126
 					$result = $answer->save();
1128 1127
 					return $result !== false ? true : false;
1129 1128
 				}
@@ -1145,15 +1144,15 @@  discard block
 block discarded – undo
1145 1144
 		$form_input = '',
1146 1145
 		$input_value = ''
1147 1146
 	) {
1148
-		if ( empty( $input_value ) ) {
1147
+		if (empty($input_value)) {
1149 1148
 			// if the form input isn't marked as being required, then just return
1150
-			if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) {
1149
+			if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) {
1151 1150
 				return true;
1152 1151
 			}
1153
-			switch ( $form_input ) {
1152
+			switch ($form_input) {
1154 1153
 				case 'fname' :
1155 1154
 					EE_Error::add_error(
1156
-						__( 'First Name is a required value.', 'event_espresso' ),
1155
+						__('First Name is a required value.', 'event_espresso'),
1157 1156
 						__FILE__,
1158 1157
 						__FUNCTION__,
1159 1158
 						__LINE__
@@ -1162,7 +1161,7 @@  discard block
 block discarded – undo
1162 1161
 					break;
1163 1162
 				case 'lname' :
1164 1163
 					EE_Error::add_error(
1165
-						__( 'Last Name is a required value.', 'event_espresso' ),
1164
+						__('Last Name is a required value.', 'event_espresso'),
1166 1165
 						__FILE__,
1167 1166
 						__FUNCTION__,
1168 1167
 						__LINE__
@@ -1171,7 +1170,7 @@  discard block
 block discarded – undo
1171 1170
 					break;
1172 1171
 				case 'email' :
1173 1172
 					EE_Error::add_error(
1174
-						__( 'Please enter a valid email address.', 'event_espresso' ),
1173
+						__('Please enter a valid email address.', 'event_espresso'),
1175 1174
 						__FILE__,
1176 1175
 						__FUNCTION__,
1177 1176
 						__LINE__
@@ -1204,21 +1203,21 @@  discard block
 block discarded – undo
1204 1203
 	 * @param array           $attendee_data
1205 1204
 	 * @return boolean
1206 1205
 	 */
1207
-	private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) {
1206
+	private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) {
1208 1207
 		$existing_attendee = null;
1209 1208
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1210
-		$ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] )
1209
+		$ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname'])
1211 1210
 			? $attendee_data['ATT_fname']
1212 1211
 			: '';
1213
-		$ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] )
1212
+		$ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname'])
1214 1213
 			? $attendee_data['ATT_lname']
1215 1214
 			: '';
1216
-		$ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] )
1215
+		$ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email'])
1217 1216
 			? $attendee_data['ATT_email']
1218 1217
 			: '';
1219 1218
 		// but only if those have values
1220
-		if ( $ATT_fname && $ATT_lname && $ATT_email ) {
1221
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1219
+		if ($ATT_fname && $ATT_lname && $ATT_email) {
1220
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1222 1221
 				'ATT_fname' => $ATT_fname,
1223 1222
 				'ATT_lname' => $ATT_lname,
1224 1223
 				'ATT_email' => $ATT_email
@@ -1242,13 +1241,13 @@  discard block
 block discarded – undo
1242 1241
 	 * @return \EE_Attendee
1243 1242
 	 * @throws \EE_Error
1244 1243
 	 */
1245
-	private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) {
1244
+	private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) {
1246 1245
 		// first remove fname, lname, and email from attendee data
1247
-		$dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1246
+		$dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email');
1248 1247
 		// now loop thru what's left and add to attendee CPT
1249
-		foreach ( $attendee_data as $property_name => $property_value ) {
1250
-			if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) {
1251
-				$existing_attendee->set( $property_name, $property_value );
1248
+		foreach ($attendee_data as $property_name => $property_value) {
1249
+			if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) {
1250
+				$existing_attendee->set($property_name, $property_value);
1252 1251
 			}
1253 1252
 		}
1254 1253
 		// better save that now
@@ -1266,11 +1265,11 @@  discard block
 block discarded – undo
1266 1265
 	 * @return void
1267 1266
 	 * @throws \EE_Error
1268 1267
 	 */
1269
-	private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) {
1268
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) {
1270 1269
 		// add relation to attendee
1271
-		$registration->_add_relation_to( $attendee, 'Attendee' );
1272
-		$registration->set_attendee_id( $attendee->ID() );
1273
-		$registration->update_cache_after_object_save( 'Attendee', $attendee );
1270
+		$registration->_add_relation_to($attendee, 'Attendee');
1271
+		$registration->set_attendee_id($attendee->ID());
1272
+		$registration->update_cache_after_object_save('Attendee', $attendee);
1274 1273
 	}
1275 1274
 
1276 1275
 
@@ -1282,10 +1281,10 @@  discard block
 block discarded – undo
1282 1281
 	 * @return void
1283 1282
 	 * @throws \EE_Error
1284 1283
 	 */
1285
-	private function _associate_registration_with_transaction( EE_Registration $registration ) {
1284
+	private function _associate_registration_with_transaction(EE_Registration $registration) {
1286 1285
 		// add relation to attendee
1287
-		$this->checkout->transaction->_add_relation_to( $registration, 'Registration' );
1288
-		$this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration );
1286
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
1287
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1289 1288
 	}
1290 1289
 
1291 1290
 
@@ -1298,14 +1297,14 @@  discard block
 block discarded – undo
1298 1297
 	 * @return array
1299 1298
 	 * @throws \EE_Error
1300 1299
 	 */
1301
-	private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) {
1300
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) {
1302 1301
 		// bare minimum critical details include first name, last name, email address
1303
-		$critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1302
+		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email');
1304 1303
 		// add address info to critical details?
1305
-		if ( apply_filters(
1304
+		if (apply_filters(
1306 1305
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details',
1307 1306
 			false
1308
-		) ) {
1307
+		)) {
1309 1308
 			$address_details = array(
1310 1309
 				'ATT_address',
1311 1310
 				'ATT_address2',
@@ -1315,13 +1314,13 @@  discard block
 block discarded – undo
1315 1314
 				'ATT_zip',
1316 1315
 				'ATT_phone'
1317 1316
 			);
1318
-			$critical_attendee_details = array_merge( $critical_attendee_details, $address_details );
1317
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1319 1318
 		}
1320
-		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1321
-			if ( ! isset( $attendee_data[ $critical_attendee_detail ] )
1322
-			     || empty( $attendee_data[ $critical_attendee_detail ] )
1319
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1320
+			if ( ! isset($attendee_data[$critical_attendee_detail])
1321
+			     || empty($attendee_data[$critical_attendee_detail])
1323 1322
 			) {
1324
-				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(
1323
+				$attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get(
1325 1324
 					$critical_attendee_detail
1326 1325
 				);
1327 1326
 			}
@@ -1339,11 +1338,11 @@  discard block
 block discarded – undo
1339 1338
 	 * @return \EE_Attendee
1340 1339
 	 * @throws \EE_Error
1341 1340
 	 */
1342
-	private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) {
1341
+	private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) {
1343 1342
 		// create new attendee object
1344
-		$new_attendee = EE_Attendee::new_instance( $attendee_data );
1343
+		$new_attendee = EE_Attendee::new_instance($attendee_data);
1345 1344
 		// set author to event creator
1346
-		$new_attendee->set( 'ATT_author', $registration->event()->wp_user() );
1345
+		$new_attendee->set('ATT_author', $registration->event()->wp_user());
1347 1346
 		$new_attendee->save();
1348 1347
 		return $new_attendee;
1349 1348
 	}
@@ -1360,7 +1359,7 @@  discard block
 block discarded – undo
1360 1359
 	 */
1361 1360
 	public function update_reg_step() {
1362 1361
 		// save everything
1363
-		if ( $this->process_reg_step() ) {
1362
+		if ($this->process_reg_step()) {
1364 1363
 			$this->checkout->redirect = true;
1365 1364
 			$this->checkout->redirect_url = add_query_arg(
1366 1365
 				array(
@@ -1369,7 +1368,7 @@  discard block
 block discarded – undo
1369 1368
 				),
1370 1369
 				$this->checkout->thank_you_page_url
1371 1370
 			);
1372
-			$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1371
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1373 1372
 			return true;
1374 1373
 		}
1375 1374
 		return false;
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 4 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 	 * 	process_ticket_selections
487 487
 	 *
488 488
 	 *	@access public
489
-	 * 	@return array|boolean
489
+	 * 	@return boolean|null
490 490
 	 */
491 491
 	public function process_ticket_selections() {
492 492
         do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	 *    validate_post_data
632 632
 	 *
633 633
 	 * @access        private
634
-	 * @return        array  or FALSE
634
+	 * @return        string  or FALSE
635 635
 	 */
636 636
 	private static function _validate_post_data() {
637 637
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 	 * @access   private
749 749
 	 * @param EE_Ticket $ticket
750 750
 	 * @param int       $qty
751
-	 * @return TRUE on success, FALSE on fail
751
+	 * @return boolean on success, FALSE on fail
752 752
 	 */
753 753
 	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
754 754
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 	protected static $_event = NULL;
36 36
 
37 37
 	/**
38
-	* array of datetimes and the spaces available for them
39
-	*
40
-	* @access private
41
-	* @var array
42
-	*/
38
+	 * array of datetimes and the spaces available for them
39
+	 *
40
+	 * @access private
41
+	 * @var array
42
+	 */
43 43
 	private static $_available_spaces = array();
44 44
 
45 45
 	/**
46
-	* max attendees that can register for event at one time
47
-	*
48
-	* @access private
49
-	* @var int
50
-	*/
46
+	 * max attendees that can register for event at one time
47
+	 *
48
+	 * @access private
49
+	 * @var int
50
+	 */
51 51
 	private static $_max_atndz = EE_INF;
52 52
 
53 53
 
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
 				return $permalink_string;
217 217
 			}
218 218
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
219
-			                     . __( 'Embed', 'event_espresso' )
220
-			                     . '</a> ';
219
+								 . __( 'Embed', 'event_espresso' )
220
+								 . '</a> ';
221 221
 			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
222 222
 			$iframe_string = esc_html(
223 223
 				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 * 	@return array|boolean
528 528
 	 */
529 529
 	public function process_ticket_selections() {
530
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
530
+		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
531 531
 		// check nonce
532 532
 		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) {
533 533
 			EE_Error::add_error(
@@ -921,11 +921,11 @@  discard block
 block discarded – undo
921 921
 
922 922
 
923 923
 	/**
924
-	* 	load js
925
-	*
926
-	* 	@access 		public
927
-	* 	@return 		void
928
-	*/
924
+	 * 	load js
925
+	 *
926
+	 * 	@access 		public
927
+	 * 	@return 		void
928
+	 */
929 929
 	public static function load_tckt_slctr_assets() {
930 930
 		// add some style
931 931
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
Please login to merge, or discard this patch.
Spacing   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
 	 * @return EED_Ticket_Selector
66 66
 	 */
67 67
 	public static function instance() {
68
-		return parent::get_instance( __CLASS__ );
68
+		return parent::get_instance(__CLASS__);
69 69
 	}
70 70
 
71 71
 
72 72
 
73
-	protected function set_config(){
74
-		$this->set_config_section( 'template_settings' );
75
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
76
-		$this->set_config_name( 'EED_Ticket_Selector' );
73
+	protected function set_config() {
74
+		$this->set_config_section('template_settings');
75
+		$this->set_config_class('EE_Ticket_Selector_Config');
76
+		$this->set_config_name('EED_Ticket_Selector');
77 77
 	}
78 78
 
79 79
 
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public static function set_hooks() {
90 90
 		// routing
91
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
92
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
93
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
91
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
92
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
93
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
94 94
 		//add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 );
95
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
95
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
96 96
 		//add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 );
97 97
 		//add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 );
98
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
98
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
99 99
 	}
100 100
 
101 101
 
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 	 *  @return 	void
108 108
 	 */
109 109
 	public static function set_hooks_admin() {
110
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
110
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
111 111
 		//add button for iframe code to event editor.
112
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
113
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
112
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
113
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
114 114
 	}
115 115
 
116 116
 
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
 	 *  @return 	void
123 123
 	 */
124 124
 	public static function set_definitions() {
125
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
126
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
125
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
126
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
127 127
 
128 128
 		//if config is not set, initialize
129 129
 		//If config is not set, set it.
130
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
130
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
131 131
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
132 132
 		}
133
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
133
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
134 134
 	}
135 135
 
136 136
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * 	@param	object 			$WP
142 142
 	 * 	@return 	void
143 143
 	 */
144
-	public function run( $WP ) {}
144
+	public function run($WP) {}
145 145
 
146 146
 
147 147
 	/**
@@ -153,23 +153,23 @@  discard block
 block discarded – undo
153 153
 	public function ticket_selector_iframe() {
154 154
 		self::$_in_iframe = true;
155 155
 		/** @type EEM_Event $EEM_Event */
156
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
156
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
157 157
 		$event = $EEM_Event->get_one_by_ID(
158
-			EE_Registry::instance()->REQ->get( 'event', 0 )
158
+			EE_Registry::instance()->REQ->get('event', 0)
159 159
 		);
160
-		EE_Registry::instance()->REQ->set_espresso_page( true );
161
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
160
+		EE_Registry::instance()->REQ->set_espresso_page(true);
161
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
162 162
 		$template_args['css'] = apply_filters(
163 163
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
164 164
 			array(
165
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
166
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
167
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
168
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
165
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
166
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
167
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
168
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
169 169
 			)
170 170
 		);
171
-		EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true;
172
-		EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = esc_html__( 'Please choose at least one ticket before continuing.', 'event_espresso' );
171
+		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
172
+		EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = esc_html__('Please choose at least one ticket before continuing.', 'event_espresso');
173 173
 		$template_args['eei18n'] = apply_filters(
174 174
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings',
175 175
 			EE_Registry::localize_i18n_js_strings()
@@ -177,18 +177,18 @@  discard block
 block discarded – undo
177 177
 		$template_args['js'] = apply_filters(
178 178
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
179 179
 			array(
180
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
181
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
182
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
180
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
181
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
182
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
183 183
 			)
184 184
 		);
185
-		$template_args[ 'notices' ] = EEH_Template::display_template(
186
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
185
+		$template_args['notices'] = EEH_Template::display_template(
186
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
187 187
 			array(),
188 188
 			true
189 189
 		);
190 190
 		EEH_Template::display_template(
191
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
191
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
192 192
 			$template_args
193 193
 		);
194 194
 		exit;
@@ -207,25 +207,25 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return string The new html string for the permalink area.
209 209
 	 */
210
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
210
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
211 211
 		//make sure this is ONLY when editing and the event id has been set.
212
-		if ( ! empty( $id ) ) {
213
-			$post = get_post( $id );
212
+		if ( ! empty($id)) {
213
+			$post = get_post($id);
214 214
 			//if NOT event then let's get out.
215
-			if ( $post->post_type !== 'espresso_events' ) {
215
+			if ($post->post_type !== 'espresso_events') {
216 216
 				return $permalink_string;
217 217
 			}
218 218
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
219
-			                     . __( 'Embed', 'event_espresso' )
219
+			                     . __('Embed', 'event_espresso')
220 220
 			                     . '</a> ';
221
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
221
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
222 222
 			$iframe_string = esc_html(
223
-				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
223
+				'<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>'
224 224
 			);
225 225
 			$permalink_string .= '
226 226
 <div id="js-ts-iframe" style="display:none">
227 227
 	<div style="width:100%; height: 500px;">
228
-		' . $iframe_string . '
228
+		' . $iframe_string.'
229 229
 	</div>
230 230
 </div>';
231 231
 		}
@@ -244,22 +244,22 @@  discard block
 block discarded – undo
244 244
 	 * @param 	mixed $event
245 245
 	 * @return 	bool
246 246
 	 */
247
-	protected static function set_event( $event = null ) {
248
-		if( $event === null ) {
247
+	protected static function set_event($event = null) {
248
+		if ($event === null) {
249 249
 			global $post;
250 250
 			$event = $post;
251 251
 		}
252
-		if ( $event instanceof EE_Event ) {
252
+		if ($event instanceof EE_Event) {
253 253
 			self::$_event = $event;
254
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
254
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
255 255
 			self::$_event = $event->EE_Event;
256
-		} else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) {
257
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
256
+		} else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') {
257
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
258 258
 			self::$_event = $event->EE_Event;
259 259
 		} else {
260
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
261
-			$dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' );
262
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
260
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
261
+			$dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso');
262
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
263 263
 			return false;
264 264
 		}
265 265
 		return true;
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 	 * @param 	bool 	$view_details
279 279
 	 * @return 	string
280 280
 	 */
281
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
281
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
282 282
 		// reset filter for displaying submit button
283
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
283
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
284 284
 		// poke and prod incoming event till it tells us what it is
285
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
285
+		if ( ! EED_Ticket_Selector::set_event($event)) {
286 286
 			return false;
287 287
 		}
288 288
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 			&& (
294 294
 				! self::$_event->display_ticket_selector()
295 295
 				|| $view_details
296
-				|| post_password_required( $event_post )
296
+				|| post_password_required($event_post)
297 297
 				|| (
298 298
 					$_event_active_status != EE_Datetime::active
299 299
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -311,34 +311,34 @@  discard block
 block discarded – undo
311 311
 		$template_args = array();
312 312
 		$template_args['event_status'] = $_event_active_status;
313 313
 
314
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
315
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
314
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
315
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
316 316
 
317 317
 		$template_args['EVT_ID'] = self::$_event->ID();
318 318
 		$template_args['event'] = self::$_event;
319 319
 
320 320
 		// is the event expired ?
321 321
 		$template_args['event_is_expired'] = self::$_event->is_expired();
322
-		if ( $template_args['event_is_expired'] ) {
323
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>';
322
+		if ($template_args['event_is_expired']) {
323
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>';
324 324
 		}
325 325
 
326 326
 		$ticket_query_args = array(
327
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
328
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
327
+			array('Datetime.EVT_ID' => self::$_event->ID()),
328
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
329 329
 		);
330 330
 
331
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
331
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
332 332
 			//use the correct applicable time query depending on what version of core is being run.
333
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
334
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
333
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
334
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
335 335
 		}
336 336
 
337 337
 		// get all tickets for this event ordered by the datetime
338
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
338
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
339 339
 
340
-		if ( count( $template_args['tickets'] ) < 1 ) {
341
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
340
+		if (count($template_args['tickets']) < 1) {
341
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
342 342
 		}
343 343
 
344 344
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
@@ -347,36 +347,36 @@  discard block
 block discarded – undo
347 347
 			self::$_event->additional_limit()
348 348
 		);
349 349
 		$template_args['max_atndz'] = \EED_Ticket_Selector::$_max_atndz;
350
-		if ( $template_args['max_atndz'] < 1 ) {
351
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
352
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
353
-				$sales_closed_msg .=  sprintf(
354
-					__( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ),
350
+		if ($template_args['max_atndz'] < 1) {
351
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
352
+			if (current_user_can('edit_post', self::$_event->ID())) {
353
+				$sales_closed_msg .= sprintf(
354
+					__('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'),
355 355
 					'<div class="ee-attention" style="text-align: left;"><b>',
356 356
 					'</b><br />',
357
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
357
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
358 358
 					'</a></span></div>'
359 359
 				);
360 360
 			}
361
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
361
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
362 362
 		}
363 363
 
364
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
365
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
364
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
365
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
366 366
 
367 367
 		// redirecting to another site for registration ??
368 368
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
369 369
 		// set up the form (but not for the admin)
370
-		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : '';
370
+		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : '';
371 371
 		// if not redirecting to another site for registration
372
-		if ( ! $external_url ) {
372
+		if ( ! $external_url) {
373 373
 			// then display the ticket selector
374
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
374
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
375 375
 		} else {
376 376
 			// if not we still need to trigger the display of the submit button
377
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
377
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
378 378
 			//display notice to admin that registration is external
379
-			$ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
379
+			$ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
380 380
 		}
381 381
 		// submit button and form close tag
382 382
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -396,25 +396,25 @@  discard block
 block discarded – undo
396 396
 	 * @param 		string $external_url
397 397
 	 * @return 		string
398 398
 	 */
399
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
399
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
400 400
 		// if redirecting, we don't need any anything else
401
-		if ( $external_url ) {
402
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
403
-			$query_args = EEH_URL::get_query_string( $external_url );
404
-			foreach ( $query_args as $query_arg => $value ) {
405
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
401
+		if ($external_url) {
402
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
403
+			$query_args = EEH_URL::get_query_string($external_url);
404
+			foreach ($query_args as $query_arg => $value) {
405
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
406 406
 			}
407 407
 			return $html;
408 408
 		}
409
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
410
-		if ( ! $checkout_url ) {
411
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
409
+		$checkout_url = EEH_Event_View::event_link_url($ID);
410
+		if ( ! $checkout_url) {
411
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
412 412
 		}
413 413
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
414
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
415
-		$html .= wp_nonce_field( 	'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE );
414
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
415
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE);
416 416
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
417
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
417
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
418 418
 		return $html;
419 419
 	}
420 420
 
@@ -429,30 +429,30 @@  discard block
 block discarded – undo
429 429
 	 * 	@return		string
430 430
 	 */
431 431
 	public static function display_ticket_selector_submit() {
432
-		if ( ! is_admin() ) {
433
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) {
432
+		if ( ! is_admin()) {
433
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) {
434 434
 				$btn_text = apply_filters(
435 435
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
436
-					__('Register Now', 'event_espresso' ),
436
+					__('Register Now', 'event_espresso'),
437 437
 					EED_Ticket_Selector::$_event
438 438
 				);
439 439
 				$external_url = EED_Ticket_Selector::$_event->external_url();
440
-				$html = '<input id="ticket-selector-submit-'. EED_Ticket_Selector::$_event->ID() .'-btn"';
440
+				$html = '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"';
441 441
 				$html .= ' class="ticket-selector-submit-btn ';
442
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
443
-				$html .= ' type="submit" value="' . $btn_text . '" />';
442
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
443
+				$html .= ' type="submit" value="'.$btn_text.'" />';
444 444
 				$html .= apply_filters(
445 445
 					'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
446 446
 					'',
447 447
 					EED_Ticket_Selector::$_event
448 448
 				);
449 449
 				$html .= '<div class="clear"><br/></div></form>';
450
-				if ( ! is_archive() ) {
450
+				if ( ! is_archive()) {
451 451
 					$html .= \EEH_Template::powered_by_event_espresso();
452 452
 				}
453 453
 				return $html;
454
-			} else if ( is_archive() ) {
455
-				return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn();
454
+			} else if (is_archive()) {
455
+				return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn();
456 456
 			} else if (
457 457
 				EED_Ticket_Selector::$_event instanceof EE_Event
458 458
 				// if $_max_atndz === 1 (ie: a "Dude Where's my Ticket Selector?" type event)
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 				$html = apply_filters(
465 465
 					'FHEE__EE_Ticket_Selector__no_ticket_selector_submit',
466 466
 					sprintf(
467
-						__( '%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso' ),
467
+						__('%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso'),
468 468
 						'<p class="no-ticket-selector-msg important-notice">',
469 469
 						EED_Ticket_Selector::$_event->name(),
470 470
 						'</p>'
@@ -506,13 +506,13 @@  discard block
 block discarded – undo
506 506
 	 * 	@return		string
507 507
 	 */
508 508
 	public static function display_view_details_btn() {
509
-		if ( ! self::$_event->get_permalink() ) {
510
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
509
+		if ( ! self::$_event->get_permalink()) {
510
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
511 511
 		}
512
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
513
-		$btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event );
514
-		$view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />';
515
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
512
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
513
+		$btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event);
514
+		$view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />';
515
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
516 516
 		$view_details_btn .= '<div class="clear"><br/></div>';
517 517
 		$view_details_btn .= '</form>';
518 518
 		return $view_details_btn;
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 	 * 	@return array|boolean
531 531
 	 */
532 532
 	public function process_ticket_selections() {
533
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
533
+        do_action('EED_Ticket_Selector__process_ticket_selections__before');
534 534
 		// check nonce
535
-		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) {
535
+		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) {
536 536
 			EE_Error::add_error(
537
-				sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
537
+				sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
538 538
 				__FILE__, __FUNCTION__, __LINE__
539 539
 			);
540 540
 			return FALSE;
@@ -548,16 +548,16 @@  discard block
 block discarded – undo
548 548
 
549 549
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
550 550
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
551
-		EE_Registry::instance()->load_core( 'Session' );
551
+		EE_Registry::instance()->load_core('Session');
552 552
 		// unless otherwise requested, clear the session
553
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
554
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
553
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
554
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
555 555
 		}
556 556
 		//d( EE_Registry::instance()->SSN );
557 557
 
558
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
558
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
559 559
 		// do we have an event id?
560
-		if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
560
+		if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
561 561
 			// validate/sanitize data
562 562
 			$valid = self::_validate_post_data();
563 563
 
@@ -567,41 +567,41 @@  discard block
 block discarded – undo
567 567
 			//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
568 568
 
569 569
 			//check total tickets ordered vs max number of attendees that can register
570
-			if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
570
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
571 571
 
572 572
 				// ordering too many tickets !!!
573 573
 				$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
574
-				$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
574
+				$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
575 575
 				// dev only message
576 576
 				$max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso');
577
-				$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
578
-				EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
577
+				$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
578
+				EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
579 579
 			} else {
580 580
 
581 581
 				// all data appears to be valid
582 582
 				$tckts_slctd = FALSE;
583 583
 				$success = TRUE;
584 584
 				// load cart
585
-				EE_Registry::instance()->load_core( 'Cart' );
585
+				EE_Registry::instance()->load_core('Cart');
586 586
 
587 587
 				// cycle thru the number of data rows sent from the event listing
588
-				for ( $x = 0; $x < $valid['rows']; $x++ ) {
588
+				for ($x = 0; $x < $valid['rows']; $x++) {
589 589
 					// does this row actually contain a ticket quantity?
590
-					if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
590
+					if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
591 591
 						// YES we have a ticket quantity
592 592
 						$tckts_slctd = TRUE;
593 593
 						//						d( $valid['ticket_obj'][$x] );
594
-						if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
594
+						if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
595 595
 							// then add ticket to cart
596
-							$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
596
+							$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
597 597
 							$success = ! $ticket_added ? FALSE : $success;
598
-							if ( EE_Error::has_error() ) {
598
+							if (EE_Error::has_error()) {
599 599
 								break;
600 600
 							}
601 601
 						} else {
602 602
 							// nothing added to cart retrieved
603 603
 							EE_Error::add_error(
604
-								sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
604
+								sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
605 605
 								__FILE__, __FUNCTION__, __LINE__
606 606
 							);
607 607
 						}
@@ -610,45 +610,45 @@  discard block
 block discarded – undo
610 610
 				//d( EE_Registry::instance()->CART );
611 611
 				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
612 612
 
613
-				if ( $tckts_slctd ) {
614
-					if ( $success ) {
615
-						do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
613
+				if ($tckts_slctd) {
614
+					if ($success) {
615
+						do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
616 616
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
617
-						EE_Registry::instance()->CART->save_cart( FALSE );
617
+						EE_Registry::instance()->CART->save_cart(FALSE);
618 618
 						EE_Registry::instance()->SSN->update();
619 619
 						//d( EE_Registry::instance()->CART );
620 620
 						//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
621 621
 						// just return TRUE for registrations being made from admin
622
-						if ( is_admin() ) {
622
+						if (is_admin()) {
623 623
 							return TRUE;
624 624
 						}
625
-						wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
625
+						wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
626 626
 						exit();
627 627
 
628 628
 					} else {
629
-						if ( ! EE_Error::has_error() ) {
629
+						if ( ! EE_Error::has_error()) {
630 630
 							// nothing added to cart
631
-							EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
631
+							EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
632 632
 						}
633 633
 					}
634 634
 
635 635
 				} else {
636 636
 					// no ticket quantities were selected
637
-					EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
637
+					EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
638 638
 				}
639 639
 			}
640 640
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
641 641
 			// at this point, just return if registration is being made from admin
642
-			if ( is_admin() ) {
642
+			if (is_admin()) {
643 643
 				return FALSE;
644 644
 			}
645
-			if ( $valid['return_url'] ) {
646
-				EE_Error::get_notices( FALSE, TRUE );
647
-				wp_safe_redirect( $valid['return_url'] );
645
+			if ($valid['return_url']) {
646
+				EE_Error::get_notices(FALSE, TRUE);
647
+				wp_safe_redirect($valid['return_url']);
648 648
 				exit();
649
-			} elseif ( isset( $event_to_add['id'] )) {
650
-				EE_Error::get_notices( FALSE, TRUE );
651
-				wp_safe_redirect( get_permalink( $event_to_add['id'] ));
649
+			} elseif (isset($event_to_add['id'])) {
650
+				EE_Error::get_notices(FALSE, TRUE);
651
+				wp_safe_redirect(get_permalink($event_to_add['id']));
652 652
 				exit();
653 653
 			} else {
654 654
 				echo EE_Error::get_notices();
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 		} else {
658 658
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
659 659
 			EE_Error::add_error(
660
-				sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
660
+				sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
661 661
 				__FILE__, __FUNCTION__, __LINE__
662 662
 			);
663 663
 		}
@@ -675,18 +675,18 @@  discard block
 block discarded – undo
675 675
 	 * @return        array  or FALSE
676 676
 	 */
677 677
 	private static function _validate_post_data() {
678
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
678
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
679 679
 
680 680
 		// start with an empty array()
681 681
 		$valid_data = array();
682 682
 		//		d( $_POST );
683 683
 		//if event id is valid
684
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ));
685
-		if ( $id ) {
684
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
685
+		if ($id) {
686 686
 			// grab valid id
687 687
 			$valid_data['id'] = $id;
688 688
 			// grab and sanitize return-url
689
-			$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
689
+			$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
690 690
 			// array of other form names
691 691
 			$inputs_to_clean = array(
692 692
 				'event_id' => 'tkt-slctr-event-id',
@@ -699,22 +699,22 @@  discard block
 block discarded – undo
699 699
 			// let's track the total number of tickets ordered.'
700 700
 			$valid_data['total_tickets'] = 0;
701 701
 			// cycle through $inputs_to_clean array
702
-			foreach ( $inputs_to_clean as $what => $input_to_clean ) {
702
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
703 703
 				// check for POST data
704
-				if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
704
+				if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
705 705
 					// grab value
706
-					$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
706
+					$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
707 707
 					switch ($what) {
708 708
 
709 709
 						// integers
710 710
 						case 'event_id':
711
-							$valid_data[$what] = absint( $input_value );
711
+							$valid_data[$what] = absint($input_value);
712 712
 							// get event via the event id we put in the form
713
-							$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
713
+							$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
714 714
 							break;
715 715
 						case 'rows':
716 716
 						case 'max_atndz':
717
-							$valid_data[$what] = absint( $input_value );
717
+							$valid_data[$what] = absint($input_value);
718 718
 							break;
719 719
 
720 720
 						// arrays of integers
@@ -722,27 +722,27 @@  discard block
 block discarded – undo
722 722
 							//							d( $input_value );
723 723
 							$row_qty = $input_value;
724 724
 							// if qty is coming from a radio button input, then we need to assemble an array of rows
725
-							if( ! is_array( $row_qty )) {
725
+							if ( ! is_array($row_qty)) {
726 726
 								// get number of rows
727
-								$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
727
+								$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
728 728
 								//								d( $rows );
729 729
 								// explode ints by the dash
730
-								$row_qty = explode( '-', $row_qty );
731
-								$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
732
-								$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
733
-								$row_qty = array( $row => $qty );
730
+								$row_qty = explode('-', $row_qty);
731
+								$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
732
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
733
+								$row_qty = array($row => $qty);
734 734
 								//								 d( $row_qty );
735
-								for( $x = 1; $x <= $rows; $x++ ) {
736
-									if ( ! isset( $row_qty[$x] )) {
735
+								for ($x = 1; $x <= $rows; $x++) {
736
+									if ( ! isset($row_qty[$x])) {
737 737
 										$row_qty[$x] = 0;
738 738
 									}
739 739
 								}
740 740
 							}
741
-							ksort( $row_qty );
741
+							ksort($row_qty);
742 742
 							//							 d( $row_qty );
743 743
 							// cycle thru values
744
-							foreach ( $row_qty as $qty ) {
745
-								$qty = absint( $qty );
744
+							foreach ($row_qty as $qty) {
745
+								$qty = absint($qty);
746 746
 								// sanitize as integers
747 747
 								$valid_data[$what][] = $qty;
748 748
 								$valid_data['total_tickets'] += $qty;
@@ -753,19 +753,19 @@  discard block
 block discarded – undo
753 753
 						case 'ticket_id':
754 754
 							$value_array = array();
755 755
 							// cycle thru values
756
-							foreach ( $input_value as $key=>$value ) {
756
+							foreach ($input_value as $key=>$value) {
757 757
 								// allow only numbers, letters,  spaces, commas and dashes
758
-								$value_array[ $key ] = wp_strip_all_tags( $value );
758
+								$value_array[$key] = wp_strip_all_tags($value);
759 759
 								// get ticket via the ticket id we put in the form
760
-								$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
761
-								$valid_data['ticket_obj'][ $key ] = $ticket_obj;
760
+								$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
761
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
762 762
 							}
763
-							$valid_data[ $what ] = $value_array;
763
+							$valid_data[$what] = $value_array;
764 764
 							break;
765 765
 
766 766
 						case 'return_url' :
767 767
 							// grab and sanitize return-url
768
-							$valid_data[$what] = esc_url_raw( $input_value );
768
+							$valid_data[$what] = esc_url_raw($input_value);
769 769
 							break;
770 770
 
771 771
 					} 	// end switch $what
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 			} 	// end foreach $inputs_to_clean
774 774
 
775 775
 		} else {
776
-			EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
776
+			EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
777 777
 			return FALSE;
778 778
 		}
779 779
 
@@ -791,28 +791,28 @@  discard block
 block discarded – undo
791 791
 	 * @param int       $qty
792 792
 	 * @return TRUE on success, FALSE on fail
793 793
 	 */
794
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
795
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
794
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
795
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
796 796
 		// get the number of spaces left for this datetime ticket
797
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
797
+		$available_spaces = self::_ticket_datetime_availability($ticket);
798 798
 		// compare available spaces against the number of tickets being purchased
799
-		if ( $available_spaces >= $qty ) {
799
+		if ($available_spaces >= $qty) {
800 800
 			// allow addons to prevent a ticket from being added to cart
801
-			if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) {
801
+			if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) {
802 802
 				return false;
803 803
 			}
804 804
 			// add event to cart
805
-			if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
806
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
805
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
806
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
807 807
 				return true;
808 808
 			} else {
809 809
 				return false;
810 810
 			}
811 811
 		} else {
812 812
 			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
813
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
813
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
814 814
 			// greedy greedy greedy eh?
815
-			if ( $available_spaces > 0 ) {
815
+			if ($available_spaces > 0) {
816 816
 				// add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces
817 817
 				EE_Error::add_error(
818 818
 					sprintf(
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 					__FILE__, __FUNCTION__, __LINE__
829 829
 				);
830 830
 			} else {
831
-				EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
831
+				EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
832 832
 			}
833 833
 			return false;
834 834
 		}
@@ -846,22 +846,22 @@  discard block
 block discarded – undo
846 846
 	 * @param 	bool         $get_original_ticket_spaces
847 847
 	 * @return 	int
848 848
 	 */
849
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
849
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
850 850
 		// if the $_available_spaces array has not been set up yet...
851
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
852
-				self::_set_initial_ticket_datetime_availability( $ticket );
851
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
852
+				self::_set_initial_ticket_datetime_availability($ticket);
853 853
 		}
854 854
 		$available_spaces = $ticket->qty() - $ticket->sold();
855
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
855
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
856 856
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
857
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
857
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
858 858
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
859
-				if ( $get_original_ticket_spaces ) {
859
+				if ($get_original_ticket_spaces) {
860 860
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
861
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
861
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
862 862
 				} else {
863 863
 					// we want the updated ticket availability as stored in the "datetimes" array
864
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
864
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
865 865
 				}
866 866
 			}
867 867
 		}
@@ -877,23 +877,23 @@  discard block
 block discarded – undo
877 877
 	 * @param 	EE_Ticket $ticket
878 878
 	 * @return 	int
879 879
 	 */
880
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
880
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
881 881
 		// first, get all of the datetimes that are available to this ticket
882 882
 		$datetimes = $ticket->get_many_related(
883 883
 			'Datetime',
884
-			array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ))
884
+			array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC'))
885 885
 		);
886
-		if ( ! empty( $datetimes )) {
886
+		if ( ! empty($datetimes)) {
887 887
 			// now loop thru all of the datetimes
888
-			foreach ( $datetimes as $datetime  ) {
889
-				if ( $datetime instanceof EE_Datetime ) {
888
+			foreach ($datetimes as $datetime) {
889
+				if ($datetime instanceof EE_Datetime) {
890 890
 					// the number of spaces available for the datetime without considering individual ticket quantities
891 891
 					$spaces_remaining = $datetime->spaces_remaining();
892 892
 					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
893
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
893
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
894 894
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
895 895
 					// else just take the datetime spaces remaining, and assign to the datetimes array
896
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
896
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
897 897
 				}
898 898
 			}
899 899
 		}
@@ -909,12 +909,12 @@  discard block
 block discarded – undo
909 909
 	 * @param 	int   $qty
910 910
 	 * @return 	int
911 911
 	 */
912
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
913
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
912
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
913
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
914 914
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
915
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
915
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
916 916
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
917
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
917
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
918 918
 			}
919 919
 		}
920 920
 	}
@@ -931,8 +931,8 @@  discard block
 block discarded – undo
931 931
 	*/
932 932
 	public static function load_tckt_slctr_assets() {
933 933
 		// add some style
934
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
935
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
934
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
935
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
936 936
 			wp_enqueue_style('ticket_selector');
937 937
 			// make it dance
938 938
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -946,9 +946,9 @@  discard block
 block discarded – undo
946 946
 
947 947
 	public static function load_tckt_slctr_assets_admin() {
948 948
 		//iframe button js on admin event editor page
949
-		if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) {
950
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
951
-			wp_enqueue_script( 'ticket_selector_embed' );
949
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') {
950
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
951
+			wp_enqueue_script('ticket_selector_embed');
952 952
 		}
953 953
 	}
954 954
 
Please login to merge, or discard this patch.
modules/venue_single/EED_Venue_Single.module.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @return EED_Venue_Single
28 28
 	 */
29 29
 	public static function instance() {
30
-		return parent::get_instance( __CLASS__ );
30
+		return parent::get_instance(__CLASS__);
31 31
 	}
32 32
 
33 33
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 *  @return 	void
38 38
 	 */
39 39
 	public static function set_hooks() {
40
-		EE_Config::register_route( 'venue', 'Venue_Single', 'run' );
40
+		EE_Config::register_route('venue', 'Venue_Single', 'run');
41 41
 //		EE_Config::register_view( 'venue', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'single-espresso_venues.php' );
42 42
 	}
43 43
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 * @access    public
59 59
 	 * @param \WP $WP
60 60
 	 */
61
-	public function run( $WP ) {
61
+	public function run($WP) {
62 62
 		// check what template is loaded
63
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
64
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
63
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
64
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
65 65
 	}
66 66
 
67 67
 
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 	 * @param  string $template
74 74
 	 * @return string
75 75
 	 */
76
-	public function template_include( $template ) {
76
+	public function template_include($template) {
77 77
 		// not a custom template?
78
-		if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_venues.php' ) {
78
+		if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_venues.php') {
79 79
 			EEH_Template::load_espresso_theme_functions();
80 80
 			// then add extra event data via hooks
81
-			add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 );
82
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
81
+			add_filter('the_title', array($this, 'the_title'), 100, 1);
82
+			add_filter('the_content', array($this, 'venue_details'), 100);
83 83
 			// don't display entry meta because the existing theme will take car of that
84
-			add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' );
84
+			add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
85 85
 		}
86 86
 		return $template;
87 87
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @param  string $title
96 96
 	 * @return string
97 97
 	 */
98
-	public function the_title( $title = '' ) {
98
+	public function the_title($title = '') {
99 99
 		return $title;
100 100
 	}
101 101
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * @param  string $content
108 108
 	 * @return string
109 109
 	 */
110
-	public function venue_details( $content ) {
110
+	public function venue_details($content) {
111 111
 		global $post;
112 112
 		if (
113 113
 			$post->post_type == 'espresso_venues'
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 			// it uses the_content() for displaying the $post->post_content
118 118
 			// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
119 119
 			// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
120
-			remove_filter( 'the_content', array( $this, 'venue_details' ), 100 );
120
+			remove_filter('the_content', array($this, 'venue_details'), 100);
121 121
 			// add filters we want
122
-			add_filter( 'the_content', array( $this, 'venue_location' ), 110 );
122
+			add_filter('the_content', array($this, 'venue_location'), 110);
123 123
 			// now load our template
124
-			$template = EEH_Template::locate_template( 'content-espresso_venues-details.php' );
124
+			$template = EEH_Template::locate_template('content-espresso_venues-details.php');
125 125
 			// remove other filters we added so they won't get applied to the next post
126
-			remove_filter( 'the_content', array( $this, 'venue_location' ), 110 );
126
+			remove_filter('the_content', array($this, 'venue_location'), 110);
127 127
 		}
128 128
 		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
129
-		return ! empty( $template ) ? $template : $content;
129
+		return ! empty($template) ? $template : $content;
130 130
 	}
131 131
 
132 132
 
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 * @param  string $content
139 139
 	 * @return string
140 140
 	 */
141
-	public function venue_location( $content ) {
142
-		return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' );
141
+	public function venue_location($content) {
142
+		return $content.EEH_Template::locate_template('content-espresso_venues-location.php');
143 143
 	}
144 144
 
145 145
 
@@ -152,16 +152,16 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function wp_enqueue_scripts() {
154 154
 		// get some style
155
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_single() ) {
155
+		if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_single()) {
156 156
 			// first check theme folder
157
-			if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
158
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
159
-			} else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) {
160
-				wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
157
+			if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
158
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
159
+			} else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) {
160
+				wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
161 161
 			}
162
-			wp_enqueue_style( $this->theme );
163
-			if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) {
164
-				add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 );
162
+			wp_enqueue_style($this->theme);
163
+			if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
164
+				add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
165 165
 			}
166 166
 		}
167 167
 	}
Please login to merge, or discard this patch.
modules/venues_archive/EED_Venues_Archive.module.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @return EED_Venues_Archive
28 28
 	 */
29 29
 	public static function instance() {
30
-		return parent::get_instance( __CLASS__ );
30
+		return parent::get_instance(__CLASS__);
31 31
 	}
32 32
 
33 33
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 *  @return 	void
38 38
 	 */
39 39
 	public static function set_hooks() {
40
-		EE_Config::register_route( 'venues', 'Venues_Archive', 'run' );
40
+		EE_Config::register_route('venues', 'Venues_Archive', 'run');
41 41
 //		EE_Config::register_view( 'venues', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.php' );
42 42
 	}
43 43
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 * @access    public
59 59
 	 * @param \WP $WP
60 60
 	 */
61
-	public function run( $WP ) {
61
+	public function run($WP) {
62 62
 		// check what template is loaded
63
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
64
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
63
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
64
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
65 65
 	}
66 66
 
67 67
 
@@ -73,18 +73,18 @@  discard block
 block discarded – undo
73 73
 	 * @param  string $template
74 74
 	 * @return string
75 75
 	 */
76
-	public function template_include( $template ) {
76
+	public function template_include($template) {
77 77
 		// not a custom template?
78
-		if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'archive-espresso_venues.php' ) {
78
+		if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'archive-espresso_venues.php') {
79 79
 			EEH_Template::load_espresso_theme_functions();
80 80
 			// then add extra event data via hooks
81
-			add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 );
81
+			add_filter('the_title', array($this, 'the_title'), 100, 1);
82 82
 			// don't know if theme uses the_excerpt
83
-			add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 );
83
+			add_filter('the_excerpt', array($this, 'venue_details'), 100);
84 84
 			// or the_content
85
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
85
+			add_filter('the_content', array($this, 'venue_details'), 100);
86 86
 			// don't display entry meta because the existing theme will take care of that
87
-			add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' );
87
+			add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
88 88
 		}
89 89
 		return $template;
90 90
 	}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @param  string $title
99 99
 	 * @return string
100 100
 	 */
101
-	public function the_title( $title = '' ) {
101
+	public function the_title($title = '') {
102 102
 		return $title;
103 103
 	}
104 104
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param  string $content
111 111
 	 * @return string
112 112
 	 */
113
-	public function venue_details( $content ) {
113
+	public function venue_details($content) {
114 114
 		global $post;
115 115
 		if (
116 116
 			$post->post_type == 'espresso_venues'
@@ -120,22 +120,22 @@  discard block
 block discarded – undo
120 120
 			// it uses the_content() for displaying the $post->post_content
121 121
 			// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
122 122
 			// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
123
-			remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 );
124
-			remove_filter( 'the_content', array( $this, 'venue_details' ), 100 );
123
+			remove_filter('the_excerpt', array($this, 'venue_details'), 100);
124
+			remove_filter('the_content', array($this, 'venue_details'), 100);
125 125
 			// add filters we want
126
-			add_filter( 'the_content', array( $this, 'venue_location' ), 110 );
127
-			add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 );
126
+			add_filter('the_content', array($this, 'venue_location'), 110);
127
+			add_filter('the_excerpt', array($this, 'venue_location'), 110);
128 128
 			// now load our template
129
-			$template = EEH_Template::locate_template( 'content-espresso_venues-details.php' );
129
+			$template = EEH_Template::locate_template('content-espresso_venues-details.php');
130 130
 			//now add our filter back in, plus some others
131
-			add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 );
132
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
131
+			add_filter('the_excerpt', array($this, 'venue_details'), 100);
132
+			add_filter('the_content', array($this, 'venue_details'), 100);
133 133
 			// remove other filters we added so they won't get applied to the next post
134
-			remove_filter( 'the_content', array( $this, 'venue_location' ), 110 );
135
-			remove_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 );
134
+			remove_filter('the_content', array($this, 'venue_location'), 110);
135
+			remove_filter('the_excerpt', array($this, 'venue_location'), 110);
136 136
 			// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
137 137
 		}
138
-		return ! empty( $template ) ? $template : $content;
138
+		return ! empty($template) ? $template : $content;
139 139
 	}
140 140
 
141 141
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @param  string $content
148 148
 	 * @return string
149 149
 	 */
150
-	public function venue_location( $content ) {
151
-		return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' );
150
+	public function venue_location($content) {
151
+		return $content.EEH_Template::locate_template('content-espresso_venues-location.php');
152 152
 	}
153 153
 
154 154
 
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function wp_enqueue_scripts() {
164 164
 		// get some style
165
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) {
165
+		if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_archive()) {
166 166
 			// first check theme folder
167
-			if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
168
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
169
-			} else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) {
170
-				wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
167
+			if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
168
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
169
+			} else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) {
170
+				wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
171 171
 			}
172
-			wp_enqueue_style( $this->theme );
172
+			wp_enqueue_style($this->theme);
173 173
 		}
174 174
 	}
175 175
 
Please login to merge, or discard this patch.
payment_methods/Bank/EE_PMT_Bank.pm.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 /**
6 7
  * Event Espresso
7 8
  *
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 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_PMT_Bank extends EE_PMT_Base{
28
+class EE_PMT_Bank extends EE_PMT_Base {
29 29
 
30 30
 
31 31
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$this->_pretty_name = __("Bank", 'event_espresso');
39 39
 		parent::__construct($pm_instance);
40 40
 		$this->_default_button_url = $this->file_url().'lib'.DS.'bank-logo.png';
41
-		$this->_default_description = __( 'Make payment using an electronic funds transfer from your bank.', 'event_espresso' );
41
+		$this->_default_description = __('Make payment using an electronic funds transfer from your bank.', 'event_espresso');
42 42
 	}
43 43
 
44 44
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param \EE_Transaction $transaction
49 49
 	 * @return NULL
50 50
 	 */
51
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
51
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
52 52
 		return NULL;
53 53
 	}
54 54
 
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
 		return new EE_Payment_Method_Form(array(
63 63
 			'extra_meta_inputs'=>array(
64 64
 				'page_title'=>new EE_Text_Input(array(
65
-					'html_label_text'=>  sprintf(__("Title %s", "event_espresso"),  $this->get_help_tab_link()),
65
+					'html_label_text'=>  sprintf(__("Title %s", "event_espresso"), $this->get_help_tab_link()),
66 66
 					'default'=>  __("Electronic Funds Transfers", 'event_espresso')
67 67
 				)),
68
-				'payment_instructions'=>new EE_Text_Area_Input( array(
69
-					'html_label_text'=>  sprintf(__("Payment Instructions %s", "event_espresso"),  $this->get_help_tab_link()),
70
-					'html_help_text' => __( 'Provide instructions on how registrants can send the bank draft payment. Eg, mention your account name, bank account number, bank name, bank routing code, and bank address, etc.', 'event_espresso' ),
68
+				'payment_instructions'=>new EE_Text_Area_Input(array(
69
+					'html_label_text'=>  sprintf(__("Payment Instructions %s", "event_espresso"), $this->get_help_tab_link()),
70
+					'html_help_text' => __('Provide instructions on how registrants can send the bank draft payment. Eg, mention your account name, bank account number, bank name, bank routing code, and bank address, etc.', 'event_espresso'),
71 71
 					'default'=> sprintf(
72 72
 						__('Please initiate an electronic payment using the following bank information: %1$sAccount Owner: Luke Skywalker%1$sBank Account # 1234567890%1$sBank Name: Rebellion Bank%1$sRouting Number: 12345%1$sBank Address: 12345 Wookie Rd., Planet Corellian.%1$sPayment must be received within 48 hours of event date.', 'event_espresso'),
73 73
 						"\n"
74 74
 					),
75
-					'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ),
75
+					'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()),
76 76
 				)),
77 77
 			),
78 78
 			'exclude'=>array('PMD_debug_mode')
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @see EE_PMT_Base::help_tabs_config()
87 87
 	 * @return array
88 88
 	 */
89
-	public function help_tabs_config(){
89
+	public function help_tabs_config() {
90 90
 		return array(
91 91
 			$this->get_help_tab_name() => array(
92 92
 						'title' => __('Bank Draft Settings', 'event_espresso'),
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * Other gateways may want to override this, such as offline gateways.
104 104
 	 * @return string
105 105
 	 */
106
-	public function payment_overview_content(EE_Payment $payment){
106
+	public function payment_overview_content(EE_Payment $payment) {
107 107
 		EE_Registry::instance()->load_helper('Template');
108 108
 		$extra_meta_for_payment_method = $this->_pm_instance->all_extra_meta_array();
109 109
 		$template_vars = array_merge(
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 							),
116 116
 						$extra_meta_for_payment_method);
117 117
 		return EEH_Template::locate_template(
118
-				'payment_methods' . DS . 'Bank'. DS . 'templates' . DS . 'bank_payment_details_content.template.php',
118
+				'payment_methods'.DS.'Bank'.DS.'templates'.DS.'bank_payment_details_content.template.php',
119 119
 				$template_vars);
120 120
 	}
121 121
 
Please login to merge, or discard this patch.
payment_methods/Invoice/EE_PMT_Invoice.pm.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 /**
6 7
  * Event Espresso
7 8
  *
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 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_PMT_Invoice extends EE_PMT_Base{
28
+class EE_PMT_Invoice extends EE_PMT_Base {
29 29
 
30 30
 
31 31
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function __construct($pm_instance = NULL) {
38 38
 		$this->_pretty_name = __("Invoice", 'event_espresso');
39
-		$this->_default_description = __( 'After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso' );
39
+		$this->_default_description = __('After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso');
40 40
 		parent::__construct($pm_instance);
41 41
 		$this->_default_button_url = $this->file_url().'lib'.DS.'invoice-logo.png';
42 42
 	}
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param \EE_Transaction $transaction
49 49
 	 * @return NULL
50 50
 	 */
51
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
51
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
52 52
 		return NULL;
53 53
 	}
54 54
 
@@ -61,53 +61,53 @@  discard block
 block discarded – undo
61 61
 	public function generate_new_settings_form() {
62 62
 		$pdf_payee_input_name = 'pdf_payee_name';
63 63
 		$confirmation_text_input_name = 'page_confirmation_text';
64
-		$form =  new EE_Payment_Method_Form(array(
64
+		$form = new EE_Payment_Method_Form(array(
65 65
 //				'payment_method_type' => $this,
66 66
 				'extra_meta_inputs'=>array(
67 67
 					$pdf_payee_input_name => new EE_Text_Input(array(
68
-						'html_label_text' => sprintf( __( 'Payee Name %s', 'event_espresso' ), $this->get_help_tab_link())
68
+						'html_label_text' => sprintf(__('Payee Name %s', 'event_espresso'), $this->get_help_tab_link())
69 69
 					)),
70 70
 					'pdf_payee_email' => new EE_Email_Input(array(
71
-						'html_label_text' => sprintf( __( 'Payee Email %s', 'event_espresso' ), $this->get_help_tab_link()),
71
+						'html_label_text' => sprintf(__('Payee Email %s', 'event_espresso'), $this->get_help_tab_link()),
72 72
 					)),
73 73
 					'pdf_payee_tax_number' => new EE_Text_Input(array(
74
-						'html_label_text' => sprintf( __( 'Payee Tax Number %s', 'event_espresso' ), $this->get_help_tab_link()),
74
+						'html_label_text' => sprintf(__('Payee Tax Number %s', 'event_espresso'), $this->get_help_tab_link()),
75 75
 						)),
76
-					'pdf_payee_address' => new EE_Text_Area_Input( array(
77
-						'html_label_text' => sprintf( __( 'Payee Address %s', 'event_espresso' ), $this->get_help_tab_link() ),
78
-						'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ),
76
+					'pdf_payee_address' => new EE_Text_Area_Input(array(
77
+						'html_label_text' => sprintf(__('Payee Address %s', 'event_espresso'), $this->get_help_tab_link()),
78
+						'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()),
79 79
 					)),
80 80
 					'pdf_instructions'=>new EE_Text_Area_Input(array(
81
-						'html_label_text'=>  sprintf(__("Instructions %s", "event_espresso"),  $this->get_help_tab_link()),
81
+						'html_label_text'=>  sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()),
82 82
 						'default'=>  __("Please send this invoice with payment attached to the address above, or use the payment link below. Payment must be received within 48 hours of event date.", 'event_espresso'),
83
-						'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ),
83
+						'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()),
84 84
 					)),
85 85
 					'pdf_logo_image'=>new EE_Admin_File_Uploader_Input(array(
86
-						'html_label_text'=>  sprintf(__("Logo Image %s", "event_espresso"),  $this->get_help_tab_link()),
86
+						'html_label_text'=>  sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()),
87 87
 						'default'=>  EE_Config::instance()->organization->logo_url,
88 88
 						'html_help_text'=>  __("(Logo for the top left of the invoice)", 'event_espresso'),
89 89
 					)),
90 90
 					$confirmation_text_input_name =>new EE_Text_Area_Input(array(
91
-						'html_label_text'=>  sprintf(__("Confirmation Text %s", "event_espresso"),  $this->get_help_tab_link()),
91
+						'html_label_text'=>  sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()),
92 92
 						'default'=>  __("Payment must be received within 48 hours of event date.  Details about where to send payment is included on the invoice.", 'event_espresso'),
93
-						'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ),
93
+						'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()),
94 94
 					)),
95 95
 					'page_extra_info'=>new EE_Text_Area_Input(array(
96
-						'html_label_text'=>  sprintf(__("Extra Info %s", "event_espresso"),  $this->get_help_tab_link()),
97
-						'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ),
96
+						'html_label_text'=>  sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()),
97
+						'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()),
98 98
 					)),
99 99
 				),
100 100
 				'include'=>array(
101
-					'PMD_ID', 'PMD_name','PMD_desc','PMD_admin_name','PMD_admin_desc', 'PMD_type','PMD_slug', 'PMD_open_by_default','PMD_button_url','PMD_scope','Currency','PMD_order',
102
-					$pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions','pdf_logo_image',
101
+					'PMD_ID', 'PMD_name', 'PMD_desc', 'PMD_admin_name', 'PMD_admin_desc', 'PMD_type', 'PMD_slug', 'PMD_open_by_default', 'PMD_button_url', 'PMD_scope', 'Currency', 'PMD_order',
102
+					$pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions', 'pdf_logo_image',
103 103
 					$confirmation_text_input_name, 'page_extra_info'),
104 104
 			));
105 105
 		$form->add_subsections(
106
-			array( 'header1' => new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_display.template.php' )),
106
+			array('header1' => new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_display.template.php')),
107 107
 			$pdf_payee_input_name
108 108
 		);
109 109
 		$form->add_subsections(
110
-			array( 'header2'=>new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php' )),
110
+			array('header2'=>new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php')),
111 111
 			$confirmation_text_input_name
112 112
 		);
113 113
 		return $form;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 * @see EE_PMT_Base::help_tabs_config()
121 121
 	 * @return array
122 122
 	 */
123
-	public function help_tabs_config(){
123
+	public function help_tabs_config() {
124 124
 		return array(
125 125
 			$this->get_help_tab_name() => array(
126 126
 				'title' => __('Invoice Settings', 'event_espresso'),
@@ -138,17 +138,17 @@  discard block
 block discarded – undo
138 138
 	 * @param \EE_Payment $payment
139 139
 	 * @return string
140 140
 	 */
141
-	public function payment_overview_content( EE_Payment $payment ){
141
+	public function payment_overview_content(EE_Payment $payment) {
142 142
 		EE_Registry::instance()->load_helper('Template');
143 143
 		return EEH_Template::locate_template(
144
-			'payment_methods' . DS . 'Invoice'. DS . 'templates'.DS.'invoice_payment_details_content.template.php',
144
+			'payment_methods'.DS.'Invoice'.DS.'templates'.DS.'invoice_payment_details_content.template.php',
145 145
 			array_merge(
146 146
 				array(
147 147
 					'payment_method'			=> $this->_pm_instance,
148 148
 					'payment'						=> $payment,
149 149
 					'page_confirmation_text'					=> '',
150 150
 					'page_extra_info'	=> '',
151
-					'invoice_url' 					=> $payment->transaction()->primary_registration()->invoice_url( 'html' )
151
+					'invoice_url' 					=> $payment->transaction()->primary_registration()->invoice_url('html')
152 152
 				),
153 153
 				$this->_pm_instance->all_extra_meta_array()
154 154
 			)
Please login to merge, or discard this patch.
shortcodes/espresso_checkout/EES_Espresso_Checkout.shortcode.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
 	 * @param WP $WP
52 52
 	 * @return    void
53 53
 	 */
54
-	public function run( WP $WP ) {
55
-		if ( did_action( 'pre_get_posts' ) && did_action( 'send_headers' ) ) {
54
+	public function run(WP $WP) {
55
+		if (did_action('pre_get_posts') && did_action('send_headers')) {
56 56
 			global $wp_query;
57 57
 			EED_Single_Page_Checkout::load_reg_steps();
58
-			EED_Single_Page_Checkout::init( $wp_query );
58
+			EED_Single_Page_Checkout::init($wp_query);
59 59
 		} else {
60 60
 			// hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called
61
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
61
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
62 62
 			// this will trigger the EED_Single_Page_Checkout module's run() method during the pre_get_posts hook point,
63 63
 			// this allows us to initialize things, enqueue assets, etc,
64
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'init' ), 10, 1 );
64
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'init'), 10, 1);
65 65
 		}
66 66
 	}
67 67
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 *  @param		array 	$attributes
75 75
 	 *  @return 	string
76 76
 	 */
77
-	public function process_shortcode( $attributes = array() ) {
77
+	public function process_shortcode($attributes = array()) {
78 78
 		return EE_Registry::instance()->REQ->get_output();
79 79
 	}
80 80
 
Please login to merge, or discard this patch.
libraries/messages/defaults/default/html_receipt_attendee_list.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
6 6
 <li class="ticket-registration">
7 7
 	<table class="registration-details">
8 8
 		<tr class="odd">
9
-			<th><?php	_e('Attendee', 'event_espresso');?></th>
9
+			<th><?php	_e('Attendee', 'event_espresso'); ?></th>
10 10
 			<td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td>
11 11
 		</tr>
12 12
 		<tr>
13
-			<th><?php _e("Registration Code:", "event_espresso");?></th>
13
+			<th><?php _e("Registration Code:", "event_espresso"); ?></th>
14 14
 			<td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td>
15 15
 		</tr>
16 16
 	</table>
Please login to merge, or discard this patch.
line_item_display/EE_Admin_Table_Line_Item_Display_Strategy.strategy.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	/**
17 17
 	 * @param EE_Line_Item $line_item
18 18
 	 * @param array        $options
19
-	 * @return mixed
19
+	 * @return string
20 20
 	 */
21 21
 	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
22 22
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @param EE_Line_Item $line_item
96 96
 	 * @param array        $options
97
-	 * @return mixed
97
+	 * @return string
98 98
 	 */
99 99
 	private function _item_row( EE_Line_Item $line_item, $options = array() ) {
100 100
 		// start of row
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @param EE_Line_Item $line_item
125 125
 	 * @param array        $options
126
-	 * @return mixed
126
+	 * @return string
127 127
 	 */
128 128
 	private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
129 129
 		// start of row
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 *
154 154
 	 * @param EE_Line_Item $line_item
155 155
 	 * @param array        $options
156
-	 * @return mixed
156
+	 * @return string
157 157
 	 */
158 158
 	private function _tax_row( EE_Line_Item $line_item, $options = array() ) {
159 159
 		// start of row
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param EE_Line_Item $line_item
180 180
 	 * @param string       $text
181 181
 	 * @param array        $options
182
-	 * @return mixed
182
+	 * @return string
183 183
 	 */
184 184
 	private function _total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
185 185
 		// colspan
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * 	_separator_row
204 204
 	 *
205 205
 	 * @param array        $options
206
-	 * @return mixed
206
+	 * @return string
207 207
 	 */
208 208
 	private function _separator_row( $options = array() ) {
209 209
 		// colspan
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param array        $options
50 50
 	 * @return mixed
51 51
 	 */
52
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
52
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
53 53
 
54 54
 		$html = '';
55 55
 		// set some default options and merge with incoming
@@ -60,43 +60,43 @@  discard block
 block discarded – undo
60 60
 			'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr',
61 61
 			'total_tr_css_class' => 'admin-primary-mbox-total-tr'
62 62
 		);
63
-		$options = array_merge( $default_options, (array)$options );
63
+		$options = array_merge($default_options, (array) $options);
64 64
 
65
-		switch( $line_item->type() ) {
65
+		switch ($line_item->type()) {
66 66
 
67 67
 			case EEM_Line_Item::type_line_item:
68 68
 				// item row
69
-				$html .= $this->_item_row( $line_item, $options );
69
+				$html .= $this->_item_row($line_item, $options);
70 70
 				break;
71 71
 
72 72
 			case EEM_Line_Item::type_sub_line_item:
73
-				$html .= $this->_sub_item_row( $line_item, $options );
73
+				$html .= $this->_sub_item_row($line_item, $options);
74 74
 				break;
75 75
 
76 76
 			case EEM_Line_Item::type_sub_total:
77
-				if ( $line_item->quantity() === 0 ) {
77
+				if ($line_item->quantity() === 0) {
78 78
 					return $html;
79 79
 				}
80 80
 				//loop through children
81 81
 				$child_line_items = $line_item->children();
82 82
 				//loop through children
83
-				foreach ( $child_line_items as $child_line_item ) {
83
+				foreach ($child_line_items as $child_line_item) {
84 84
 					//recursively feed children back into this method
85
-					$html .= $this->display_line_item( $child_line_item, $options );
85
+					$html .= $this->display_line_item($child_line_item, $options);
86 86
 				}
87
-				$html .= $this->_sub_total_row( $line_item, $options );
87
+				$html .= $this->_sub_total_row($line_item, $options);
88 88
 				break;
89 89
 
90 90
 			case EEM_Line_Item::type_tax:
91
-				if ( $this->_show_taxes ) {
92
-					$this->_taxes_html .= $this->_tax_row( $line_item, $options );
91
+				if ($this->_show_taxes) {
92
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
93 93
 				}
94 94
 				break;
95 95
 
96 96
 			case EEM_Line_Item::type_tax_sub_total:
97
-				foreach( $line_item->children() as $child_line_item ) {
98
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax ) {
99
-						$this->display_line_item( $child_line_item, $options );
97
+				foreach ($line_item->children() as $child_line_item) {
98
+					if ($child_line_item->type() == EEM_Line_Item::type_tax) {
99
+						$this->display_line_item($child_line_item, $options);
100 100
 					}
101 101
 				}
102 102
 				break;
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 				$children = $line_item->children();
109 109
 
110 110
 				// loop thru all non-tax child line items
111
-				foreach( $children as $child_line_item ) {
112
-						$html .= $this->display_line_item( $child_line_item, $options );
111
+				foreach ($children as $child_line_item) {
112
+						$html .= $this->display_line_item($child_line_item, $options);
113 113
 				}
114 114
 
115 115
 				$html .= $this->_taxes_html;
116
-				$html .= $this->_total_row( $line_item, $options );
117
-				if ( $options['use_table_wrapper'] ) {
118
-					$html = $this->_table_header( $options ) . $html . $this->_table_footer( $options );
116
+				$html .= $this->_total_row($line_item, $options);
117
+				if ($options['use_table_wrapper']) {
118
+					$html = $this->_table_header($options).$html.$this->_table_footer($options);
119 119
 				}
120 120
 				break;
121 121
 
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 	 * @param array $options
133 133
 	 * @return string
134 134
 	 */
135
-	protected function _table_header( $options ) {
136
-		$html = EEH_HTML::table( '','', $options['table_css_class'] );
135
+	protected function _table_header($options) {
136
+		$html = EEH_HTML::table('', '', $options['table_css_class']);
137 137
 		$html .= EEH_HTML::thead();
138 138
 		$html .= EEH_HTML::tr();
139
-		$html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' );
140
-		$html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' );
141
-		$html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' );
142
-		$html .= EEH_HTML::th( __( 'Qty', 'event_espresso' ), '', 'jst-cntr' );
143
-		$html .= EEH_HTML::th( __( 'Line Total', 'event_espresso'), '', 'jst-cntr' );
139
+		$html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left');
140
+		$html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left');
141
+		$html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr');
142
+		$html .= EEH_HTML::th(__('Qty', 'event_espresso'), '', 'jst-cntr');
143
+		$html .= EEH_HTML::th(__('Line Total', 'event_espresso'), '', 'jst-cntr');
144 144
 		$html .= EEH_HTML::tbody();
145 145
 		return $html;
146 146
 	}
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @param array $options array of options for the table.
153 153
 	 * @return string
154 154
 	 */
155
-	protected function _table_footer( $options ) {
156
-		return EEH_HTML::tbodyx() .  EEH_HTML::tablex();
155
+	protected function _table_footer($options) {
156
+		return EEH_HTML::tbodyx().EEH_HTML::tablex();
157 157
 	}
158 158
 
159 159
 
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
 	 * @param array        $options
166 166
 	 * @return mixed
167 167
 	 */
168
-	protected function _item_row( EE_Line_Item $line_item, $options = array() ) {
168
+	protected function _item_row(EE_Line_Item $line_item, $options = array()) {
169 169
 		$line_item_related_object = $line_item->get_object();
170 170
 		$parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null;
171 171
 		// start of row
172 172
 		$row_class = $options['odd'] ? 'item odd' : 'item';
173
-		$html = EEH_HTML::tr( '', '', $row_class );
173
+		$html = EEH_HTML::tr('', '', $row_class);
174 174
 
175 175
 
176 176
 		//Name Column
@@ -178,45 +178,45 @@  discard block
 block discarded – undo
178 178
 
179 179
 		//related object scope.
180 180
 		$parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : '';
181
-		$parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
181
+		$parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
182 182
 		$parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : '';
183 183
 
184 184
 
185 185
 		$name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name();
186
-		$name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;
186
+		$name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html;
187 187
 		$name_html .= $line_item->is_taxable() ? ' *' : '';
188 188
 		//maybe preface with icon?
189
-		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html;
190
-		$name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
191
-		$name_html .=  sprintf(
192
-			_x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
189
+		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html;
190
+		$name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>';
191
+		$name_html .= sprintf(
192
+			_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
193 193
 			'<span class="ee-line-item-related-parent-object">',
194
-			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __( 'Item:', 'event_espresso' ),
195
-			$parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name,
194
+			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'),
195
+			$parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name,
196 196
 			'</span>'
197 197
 		);
198
-		$html .= EEH_HTML::td( $name_html, '', 'jst-left' );
198
+		$html .= EEH_HTML::td($name_html, '', 'jst-left');
199 199
 		//Type Column
200 200
 		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : '';
201
-		$type_html .= $this->_get_cancellations( $line_item );
201
+		$type_html .= $this->_get_cancellations($line_item);
202 202
 		$type_html .= $line_item->OBJ_type() ? '<br />' : '';
203 203
 		$code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
204
-		$type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : '';
205
-		$html .= EEH_HTML::td( $type_html, '', 'jst-left' );
204
+		$type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : '';
205
+		$html .= EEH_HTML::td($type_html, '', 'jst-left');
206 206
 
207 207
 
208 208
 		//Amount Column
209
-		if ( $line_item->is_percent() ) {
210
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' );
209
+		if ($line_item->is_percent()) {
210
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght');
211 211
 		} else {
212
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' );
212
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
213 213
 		}
214 214
 
215 215
 		//QTY column
216
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'jst-rght' );
216
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght');
217 217
 
218 218
 		//total column
219
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
219
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
220 220
 
221 221
 		//finish things off and return
222 222
 		$html .= EEH_HTML::trx();
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 	 * @param EE_Line_Item $line_item
232 232
 	 * @return string
233 233
 	 */
234
-	protected function _get_cancellations( EE_Line_Item $line_item ) {
234
+	protected function _get_cancellations(EE_Line_Item $line_item) {
235 235
 		$html = '';
236 236
 		$cancellations = $line_item->get_cancellations();
237
-		$cancellation = reset( $cancellations );
237
+		$cancellation = reset($cancellations);
238 238
 		// \EEH_Debug_Tools::printr( $cancellation, '$cancellation', __FILE__, __LINE__ );
239
-		if ( $cancellation instanceof EE_Line_Item ) {
239
+		if ($cancellation instanceof EE_Line_Item) {
240 240
 			$html .= ' <span class="ee-line-item-id">';
241 241
 			$html .= sprintf(
242 242
 				_n(
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 * @param array        $options
262 262
 	 * @return mixed
263 263
 	 */
264
-	protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
264
+	protected function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
265 265
 		//for now we're not showing sub-items
266 266
 		return '';
267 267
 	}
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
 	 * @param array        $options
276 276
 	 * @return mixed
277 277
 	 */
278
-	protected function _tax_row( EE_Line_Item $line_item, $options = array() ) {
278
+	protected function _tax_row(EE_Line_Item $line_item, $options = array()) {
279 279
 		// start of row
280
-		$html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' );
280
+		$html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
281 281
 		// name th
282
-		$html .= EEH_HTML::th(  $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '',  'jst-rght', '', ' colspan="4"' );
282
+		$html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="4"');
283 283
 		// total th
284
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
284
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
285 285
 		// end of row
286 286
 		$html .= EEH_HTML::trx();
287 287
 		return $html;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	 * @param array        $options
299 299
 	 * @return mixed
300 300
 	 */
301
-	protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
301
+	protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
302 302
 		//currently not showing subtotal row
303 303
 		return '';
304 304
 	}
@@ -312,15 +312,15 @@  discard block
 block discarded – undo
312 312
 	 * @param array        $options
313 313
 	 * @return mixed
314 314
 	 */
315
-	protected function _total_row( EE_Line_Item $line_item, $options = array() ) {
315
+	protected function _total_row(EE_Line_Item $line_item, $options = array()) {
316 316
 		// start of row
317
-		$html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' );
317
+		$html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
318 318
 		// Total th label
319
-		$total_label = sprintf( __( 'Transaction Total %s', 'event_espresso' ),  '(' . EE_Registry::instance()->CFG->currency->code . ')' );
320
-		$html .= EEH_HTML::th( $total_label, '',  'jst-rght',  '',  ' colspan="4"' );
319
+		$total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
320
+		$html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');
321 321
 		// total th
322 322
 
323
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'jst-rght' );
323
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
324 324
 		// end of row
325 325
 		$html .= EEH_HTML::trx();
326 326
 		return $html;
Please login to merge, or discard this patch.