Completed
Branch BUG-7537 (42ca46)
by
unknown
88:54 queued 73:30
created
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 1 patch
Spacing   +261 added lines, -262 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	 * @param    EE_Checkout $checkout
38 38
 	 * @return    \EE_SPCO_Reg_Step_Attendee_Information
39 39
 	 */
40
-	public function __construct( EE_Checkout $checkout ) {
40
+	public function __construct(EE_Checkout $checkout) {
41 41
 		$this->_slug = 'attendee_information';
42 42
 		$this->_name = __('Attendee Information', 'event_espresso');
43
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php';
43
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php';
44 44
 		$this->checkout = $checkout;
45 45
 		$this->_reset_success_message();
46
-		$this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso'));
46
+		$this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso'));
47 47
 	}
48 48
 
49 49
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso');
53 53
 		EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso');
54 54
 		EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso');
55
-		EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' );
55
+		EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>');
56 56
 		EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso');
57 57
 		EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso');
58 58
 		EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso');
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		EEH_Autoloader::register_line_item_display_autoloaders();
86 86
 		$Line_Item_Display = new EE_Line_Item_Display();
87 87
 		// calculate taxes
88
-		$Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) );
88
+		$Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true));
89 89
 		EE_Registry::instance()->load_helper('Line_Item');
90 90
 		/** @var $subsections EE_Form_Section_Proper[] */
91 91
 		$subsections = array(
@@ -97,33 +97,33 @@  discard block
 block discarded – undo
97 97
 			'ticket_count' 	=> array()
98 98
 		);
99 99
 		// grab the saved registrations from the transaction
100
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
101
-		if ( $registrations ) {
102
-			foreach ( $registrations as $registration ) {
103
-				if ( $registration instanceof EE_Registration ) {
100
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
101
+		if ($registrations) {
102
+			foreach ($registrations as $registration) {
103
+				if ($registration instanceof EE_Registration) {
104 104
 					// can this registration be processed during this visit ?
105
-					if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
106
-						$subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration );
107
-						if ( ! $this->checkout->admin_request ) {
108
-							$template_args['registrations'][ $registration->reg_url_link() ] = $registration;
109
-							$template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1;
110
-							$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) );
111
-							$ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item;
112
-							$template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item );
105
+					if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
106
+						$subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration);
107
+						if ( ! $this->checkout->admin_request) {
108
+							$template_args['registrations'][$registration->reg_url_link()] = $registration;
109
+							$template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1;
110
+							$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID()));
111
+							$ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item;
112
+							$template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item);
113 113
 						}
114
-						if ( $registration->is_primary_registrant() ) {
114
+						if ($registration->is_primary_registrant()) {
115 115
 							$primary_registrant = $registration->reg_url_link();
116 116
 						}
117 117
 					}
118 118
 				}
119 119
 			}
120 120
 			// print_copy_info ?
121
-			if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) {
121
+			if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) {
122 122
 				// TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info
123 123
 				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info();
124 124
 				// generate hidden input
125
-				if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) {
126
-					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
125
+				if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) {
126
+					$subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false);
127 127
 				}
128 128
 			}
129 129
 
@@ -135,8 +135,7 @@  discard block
 block discarded – undo
135 135
 				'html_id' 					=> $this->reg_form_name(),
136 136
 				'subsections' 			=> $subsections,
137 137
 				'layout_strategy'		=> $this->checkout->admin_request ?
138
-					new EE_Div_Per_Section_Layout() :
139
-					new EE_Template_Layout(
138
+					new EE_Div_Per_Section_Layout() : new EE_Template_Layout(
140 139
 						array(
141 140
 							'layout_template_file' 	=> $this->_template, // layout_template
142 141
 							'template_args' 				=> $template_args
@@ -153,61 +152,61 @@  discard block
 block discarded – undo
153 152
 	 * @param EE_Registration $registration
154 153
 	 * @return EE_Form_Section_Proper
155 154
 	 */
156
-	private function _registrations_reg_form( EE_Registration $registration ) {
157
-		EE_Registry::instance()->load_helper( 'Template' );
155
+	private function _registrations_reg_form(EE_Registration $registration) {
156
+		EE_Registry::instance()->load_helper('Template');
158 157
 		static $attendee_nmbr = 1;
159 158
 		// array of params to pass to parent constructor
160 159
 		$form_args = array(
161
-			'html_id' 				=> 'ee-registration-' . $registration->reg_url_link(),
160
+			'html_id' 				=> 'ee-registration-'.$registration->reg_url_link(),
162 161
 			'html_class' 		=> 'ee-reg-form-attendee-dv',
163 162
 			'html_style' 		=> $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '',
164 163
 			'subsections' 		=> array(),
165 164
 			'layout_strategy' => new EE_Fieldset_Section_Layout(
166 165
 				array(
167 166
 					'legend_class' 	=> 'spco-attendee-lgnd smaller-text lt-grey-text',
168
-					'legend_text' 	=> sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr )
167
+					'legend_text' 	=> sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr)
169 168
 				)
170 169
 			)
171 170
 		);
172 171
 		// verify that registration has valid event
173
-		if ( $registration->event() instanceof EE_Event ) {
172
+		if ($registration->event() instanceof EE_Event) {
174 173
 			$query_params = array(
175 174
 				array(
176 175
 					'Event.EVT_ID' => $registration->event()->ID(),
177 176
 					'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE
178 177
 				),
179
-				'order_by'=>array( 'QSG_order'=>'ASC' )
178
+				'order_by'=>array('QSG_order'=>'ASC')
180 179
 			);
181
-			$question_groups = $registration->event()->question_groups( $query_params );
182
-			if ( $question_groups ) {
183
-				foreach ( $question_groups as $question_group ) {
184
-					if ( $question_group instanceof EE_Question_Group ) {
185
-						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group );
180
+			$question_groups = $registration->event()->question_groups($query_params);
181
+			if ($question_groups) {
182
+				foreach ($question_groups as $question_group) {
183
+					if ($question_group instanceof EE_Question_Group) {
184
+						$form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group);
186 185
 						// add hidden input
187
-						$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration );
186
+						$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration);
188 187
 					}
189 188
 				}
190 189
 				// if we have question groups for additional attendees, then display the copy options
191 190
 				$this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info;
192 191
 			} else {
193
-				$form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML(
192
+				$form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML(
194 193
 					EEH_Template::locate_template(
195
-						SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php',
196
-						apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()),
194
+						SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php',
195
+						apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()),
197 196
 						TRUE,
198 197
 						TRUE
199 198
 					)
200 199
 				);
201 200
 				// add hidden input
202
-				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE );
201
+				$form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE);
203 202
 			}
204 203
 		}
205
-		if ( $registration->is_primary_registrant() ) {
204
+		if ($registration->is_primary_registrant()) {
206 205
 			// generate hidden input
207
-			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration );
206
+			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration);
208 207
 		}
209 208
 		$attendee_nmbr++;
210
-		return new EE_Form_Section_Proper( $form_args );
209
+		return new EE_Form_Section_Proper($form_args);
211 210
 	}
212 211
 
213 212
 
@@ -220,11 +219,11 @@  discard block
 block discarded – undo
220 219
 	 * @param bool  $additional_attendee_reg_info
221 220
 	 * @return    EE_Form_Input_Base
222 221
 	 */
223
-	private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){
222
+	private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) {
224 223
 		// generate hidden input
225 224
 		return new EE_Hidden_Input(
226 225
 			array(
227
-				'html_id' 				=> 'additional-attendee-reg-info-' . $registration->reg_url_link(),
226
+				'html_id' 				=> 'additional-attendee-reg-info-'.$registration->reg_url_link(),
228 227
 				'default'				=> $additional_attendee_reg_info
229 228
 			)
230 229
 		);
@@ -237,22 +236,22 @@  discard block
 block discarded – undo
237 236
 	 * @param EE_Question_Group $question_group
238 237
 	 * @return EE_Form_Section_Proper
239 238
 	 */
240
-	private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){
239
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) {
241 240
 		// array of params to pass to parent constructor
242 241
 		$form_args = array(
243
-			'html_id' 					=> 'ee-reg-form-qstn-grp-' . $question_group->identifier(),
242
+			'html_id' 					=> 'ee-reg-form-qstn-grp-'.$question_group->identifier(),
244 243
 			'html_class' 			=> $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv',
245
-			'html_label_id' 		=> 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl',
244
+			'html_label_id' 		=> 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl',
246 245
 			'subsections' 			=> array(
247
-				'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group )
246
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group)
248 247
 			),
249 248
 			'layout_strategy' 	=> $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout()
250 249
 		);
251 250
 		// where params
252
-		$query_params = array( 'QST_deleted' => 0 );
251
+		$query_params = array('QST_deleted' => 0);
253 252
 		// don't load admin only questions on the frontend
254
-		if ( ! $this->checkout->admin_request ) {
255
-			$query_params['QST_admin_only'] = array( '!=', TRUE );
253
+		if ( ! $this->checkout->admin_request) {
254
+			$query_params['QST_admin_only'] = array('!=', TRUE);
256 255
 		}
257 256
 		$questions = $question_group->get_many_related(
258 257
 			'Question',
@@ -264,21 +263,21 @@  discard block
 block discarded – undo
264 263
 			)
265 264
 		);
266 265
 		// filter for additional content before questions
267
-		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this ));
266
+		$form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this));
268 267
 		// loop thru questions
269
-		foreach ( $questions as $question ) {
270
-			if( $question instanceof EE_Question ){
268
+		foreach ($questions as $question) {
269
+			if ($question instanceof EE_Question) {
271 270
 				$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
272
-				$form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question );
271
+				$form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
273 272
 			}
274 273
 		}
275
-		$form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this );
274
+		$form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this);
276 275
 
277 276
 		// filter for additional content after questions
278
-		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this ));
277
+		$form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this));
279 278
 //		d( $form_args );
280
-		$question_group_reg_form = new EE_Form_Section_Proper( $form_args );
281
-		return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this );
279
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
280
+		return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this);
282 281
 	}
283 282
 
284 283
 
@@ -288,12 +287,12 @@  discard block
 block discarded – undo
288 287
 	 * @param EE_Question_Group $question_group
289 288
 	 * @return 	EE_Form_Section_HTML
290 289
 	 */
291
-	private function _question_group_header( EE_Question_Group $question_group ){
290
+	private function _question_group_header(EE_Question_Group $question_group) {
292 291
 		$html = '';
293 292
 		// group_name
294
-		if ( $question_group->show_group_name() && $question_group->name() != '' ) {
293
+		if ($question_group->show_group_name() && $question_group->name() != '') {
295 294
 			EE_Registry::instance()->load_helper('HTML');
296
-			if ( $this->checkout->admin_request ) {
295
+			if ($this->checkout->admin_request) {
297 296
 				$html .= EEH_HTML::br();
298 297
 				$html .= EEH_HTML::h3(
299 298
 					$question_group->name(),
@@ -307,7 +306,7 @@  discard block
 block discarded – undo
307 306
 			}
308 307
 		}
309 308
 		// group_desc
310
-		if ( $question_group->show_group_desc() && $question_group->desc() != '' ) {
309
+		if ($question_group->show_group_desc() && $question_group->desc() != '') {
311 310
 			$html .= EEH_HTML::p(
312 311
 				$question_group->desc(),
313 312
 				'',
@@ -315,7 +314,7 @@  discard block
 block discarded – undo
315 314
 			);
316 315
 
317 316
 		}
318
-		return new EE_Form_Section_HTML( $html );
317
+		return new EE_Form_Section_HTML($html);
319 318
 	}
320 319
 
321 320
 
@@ -324,14 +323,14 @@  discard block
 block discarded – undo
324 323
 	 * @access public
325 324
 	 * @return 	EE_Form_Section_Proper
326 325
 	 */
327
-	private function _copy_attendee_info_form(){
326
+	private function _copy_attendee_info_form() {
328 327
 		// array of params to pass to parent constructor
329 328
 		return new EE_Form_Section_Proper(
330 329
 			array(
331 330
 				'subsections' 			=> $this->_copy_attendee_info_inputs(),
332 331
 				'layout_strategy' 	=> new EE_Template_Layout(
333 332
 					array(
334
-						'layout_template_file' 			=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template
333
+						'layout_template_file' 			=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template
335 334
 						'begin_template_file' 			=> NULL,
336 335
 						'input_template_file' 				=> NULL,
337 336
 						'subsection_template_file' 	=> NULL,
@@ -353,8 +352,8 @@  discard block
 block discarded – undo
353 352
 	private function _auto_copy_attendee_info() {
354 353
 		return new EE_Form_Section_HTML(
355 354
 			EEH_Template::locate_template(
356
-				SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php',
357
-				apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()),
355
+				SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php',
356
+				apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()),
358 357
 				TRUE,
359 358
 				TRUE
360 359
 			)
@@ -373,25 +372,25 @@  discard block
 block discarded – undo
373 372
 		$copy_attendee_info_inputs = array();
374 373
 		$prev_ticket = NULL;
375 374
 		// grab the saved registrations from the transaction
376
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
377
-		foreach ( $registrations as $registration ) {
375
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
376
+		foreach ($registrations as $registration) {
378 377
 			// for all  attendees other than the primary attendee
379
-			if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) {
378
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
380 379
 				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
381
-				if ( $registration->ticket()->ID() !== $prev_ticket ) {
380
+				if ($registration->ticket()->ID() !== $prev_ticket) {
382 381
 					$item_name = $registration->ticket()->name();
383
-					$item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : '';
384
-					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML(
385
-						'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
382
+					$item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : '';
383
+					$copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML(
384
+						'<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
386 385
 					);
387 386
 					$prev_ticket = $registration->ticket()->ID();
388 387
 				}
389 388
 
390
-				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new
389
+				$copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new
391 390
 				EE_Checkbox_Multi_Input(
392
-					array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )),
391
+					array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())),
393 392
 					array(
394
-						'html_id' 								=> 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
393
+						'html_id' 								=> 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
395 394
 						'html_class' 						=> 'spco-copy-attendee-chk ee-do-not-validate',
396 395
 						'display_html_label_text' 	=> FALSE
397 396
 					)
@@ -410,7 +409,7 @@  discard block
 block discarded – undo
410 409
 	 * @param EE_Registration $registration
411 410
 	 * @return    EE_Form_Input_Base
412 411
 	 */
413
-	private function _additional_primary_registrant_inputs( EE_Registration $registration ){
412
+	private function _additional_primary_registrant_inputs(EE_Registration $registration) {
414 413
 		// generate hidden input
415 414
 		return new EE_Hidden_Input(
416 415
 			array(
@@ -428,31 +427,31 @@  discard block
 block discarded – undo
428 427
 	 * @param EE_Question     $question
429 428
 	 * @return 	EE_Form_Input_Base
430 429
 	 */
431
-	public function reg_form_question( EE_Registration $registration, EE_Question $question ){
430
+	public function reg_form_question(EE_Registration $registration, EE_Question $question) {
432 431
 
433 432
 		// if this question was for an attendee detail, then check for that answer
434
-		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() );
433
+		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID());
435 434
 		$answer = $answer_value === null
436
-				? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() )	) )
435
+				? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())))
437 436
 				: null;
438 437
 		// if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object
439
-		if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) {
438
+		if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) {
440 439
 			// create an EE_Answer object for storing everything in
441
-			$answer = EE_Answer::new_instance ( array(
440
+			$answer = EE_Answer::new_instance(array(
442 441
 				'QST_ID'=> $question->ID(),
443 442
 				'REG_ID'=> $registration->ID()
444 443
 			));
445 444
 		}
446 445
 		// verify instance
447
-		if( $answer instanceof EE_Answer ){
448
-			if ( ! empty( $answer_value )) {
449
-				$answer->set( 'ANS_value', $answer_value );
446
+		if ($answer instanceof EE_Answer) {
447
+			if ( ! empty($answer_value)) {
448
+				$answer->set('ANS_value', $answer_value);
450 449
 			}
451
-			$answer->cache( 'Question', $question );
452
-			$answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link();
453
-			$registration->cache( 'Answer', $answer, $answer_cache_id );
450
+			$answer->cache('Question', $question);
451
+			$answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link();
452
+			$registration->cache('Answer', $answer, $answer_cache_id);
454 453
 		}
455
-		return $this->_generate_question_input( $registration, $question, $answer );
454
+		return $this->_generate_question_input($registration, $question, $answer);
456 455
 
457 456
 	}
458 457
 
@@ -464,7 +463,7 @@  discard block
 block discarded – undo
464 463
 	 * @param mixed EE_Answer|NULL      $answer
465 464
 	 * @return EE_Form_Input_Base
466 465
 	 */
467
-	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
466
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) {
468 467
 		//		d( $registration );
469 468
 		//		d( $question );
470 469
 		//		d( $answer );
@@ -487,29 +486,29 @@  discard block
 block discarded – undo
487 486
 		$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
488 487
 
489 488
 		$input_constructor_args = array(
490
-			'html_name' 			=> 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
491
-			'html_id' 					=> 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
492
-			'html_class' 			=> 'ee-reg-qstn ee-reg-qstn-' . $identifier,
489
+			'html_name' 			=> 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
490
+			'html_id' 					=> 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
491
+			'html_class' 			=> 'ee-reg-qstn ee-reg-qstn-'.$identifier,
493 492
 			'required' 				=> $question->required() ? TRUE : FALSE,
494
-			'html_label_id'		=> 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
493
+			'html_label_id'		=> 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
495 494
 			'html_label_class'	=> 'ee-reg-qstn',
496 495
 			'html_label_text'		=> $question->display_text(),
497 496
 			'required_validation_error_message' => $question->required_text()
498 497
 		);
499 498
 		// has this question been answered ?
500
-		if ( $answer instanceof EE_Answer ) {
501
-			if ( $answer->ID() ) {
502
-				$input_constructor_args['html_name'] 		.= '[' . $answer->ID() . ']';
503
-				$input_constructor_args['html_id'] 				.= '-' . $answer->ID();
504
-				$input_constructor_args['html_label_id'] 	.= '-' . $answer->ID();
499
+		if ($answer instanceof EE_Answer) {
500
+			if ($answer->ID()) {
501
+				$input_constructor_args['html_name'] 		.= '['.$answer->ID().']';
502
+				$input_constructor_args['html_id'] 				.= '-'.$answer->ID();
503
+				$input_constructor_args['html_label_id'] .= '-'.$answer->ID();
505 504
 			}
506 505
 			$input_constructor_args['default'] = $answer->value();
507 506
 		}
508 507
 		//add "-lbl" to the end of the label id
509
-		$input_constructor_args['html_label_id'] 	.= '-lbl';
510
-		$max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() );
511
-		if( EEM_Question::instance()->question_type_is_in_category(  $question->type(), 'text' ) ) {
512
-			$input_constructor_args[ 'validation_strategies' ][] = new EE_Max_Length_Validation_Strategy( 
508
+		$input_constructor_args['html_label_id'] .= '-lbl';
509
+		$max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID());
510
+		if (EEM_Question::instance()->question_type_is_in_category($question->type(), 'text')) {
511
+			$input_constructor_args['validation_strategies'][] = new EE_Max_Length_Validation_Strategy( 
513 512
 				null, 
514 513
 				min( 
515 514
 					$max_max_for_question, 
@@ -517,83 +516,83 @@  discard block
 block discarded – undo
517 516
 				) 
518 517
 			);
519 518
 		}
520
-		$input_constructor_args = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args',
519
+		$input_constructor_args = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args',
521 520
 				$input_constructor_args,
522 521
 				$registration,
523 522
 				$question,
524 523
 				$answer
525 524
 				);
526 525
 
527
-		$this->_required_questions[ $identifier ] = $question->required() ? true : false;
526
+		$this->_required_questions[$identifier] = $question->required() ? true : false;
528 527
 
529
-		switch ( $question->type() ) {
528
+		switch ($question->type()) {
530 529
 			// Text
531 530
 			case EEM_Question::QST_type_text :
532
-				if( $identifier == 'email' ){
533
-					return new EE_Email_Input( $input_constructor_args );
534
-				}else{
535
-					return new EE_Text_Input( $input_constructor_args );
531
+				if ($identifier == 'email') {
532
+					return new EE_Email_Input($input_constructor_args);
533
+				} else {
534
+					return new EE_Text_Input($input_constructor_args);
536 535
 				}
537 536
 				break;
538 537
 			// Textarea
539 538
 			case EEM_Question::QST_type_textarea :
540
-				return new EE_Text_Area_Input( $input_constructor_args );
539
+				return new EE_Text_Area_Input($input_constructor_args);
541 540
 				break;
542 541
 			// Radio Buttons
543 542
 			case EEM_Question::QST_type_radio :
544
-				return new EE_Radio_Button_Input( $question->options(), $input_constructor_args );
543
+				return new EE_Radio_Button_Input($question->options(), $input_constructor_args);
545 544
 				break;
546 545
 			// Dropdown
547 546
 			case EEM_Question::QST_type_dropdown :
548
-				return new EE_Select_Input( $question->options(), $input_constructor_args );
547
+				return new EE_Select_Input($question->options(), $input_constructor_args);
549 548
 				break;
550 549
 			// State Dropdown
551 550
 			case EEM_Question::QST_type_state :
552
-				$state_options = array( '' => array( '' => ''));
551
+				$state_options = array('' => array('' => ''));
553 552
 				$states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states();
554
-				if ( ! empty( $states )) {
555
-					foreach( $states as $state ){
556
-						if ( $state instanceof EE_State ) {
557
-							$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
553
+				if ( ! empty($states)) {
554
+					foreach ($states as $state) {
555
+						if ($state instanceof EE_State) {
556
+							$state_options[$state->country()->name()][$state->ID()] = $state->name();
558 557
 						}
559 558
 					}
560 559
 				}
561
-				$state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer );
562
-				return new EE_State_Select_Input( $state_options, $input_constructor_args );
560
+				$state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer);
561
+				return new EE_State_Select_Input($state_options, $input_constructor_args);
563 562
 				break;
564 563
 			// Country Dropdown
565 564
 			case EEM_Question::QST_type_country :
566
-				$country_options = array( '' => '' );
565
+				$country_options = array('' => '');
567 566
 				// get possibly cached list of countries
568 567
 				$countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
569
-				if ( ! empty( $countries )) {
570
-					foreach( $countries as $country ){
571
-						if ( $country instanceof EE_Country ) {
572
-							$country_options[ $country->ID() ] = $country->name();
568
+				if ( ! empty($countries)) {
569
+					foreach ($countries as $country) {
570
+						if ($country instanceof EE_Country) {
571
+							$country_options[$country->ID()] = $country->name();
573 572
 						}
574 573
 					}
575 574
 				}
576
-				$country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer );
577
-				return new EE_Country_Select_Input( $country_options, $input_constructor_args );
575
+				$country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer);
576
+				return new EE_Country_Select_Input($country_options, $input_constructor_args);
578 577
 				break;
579 578
 			// Checkboxes
580 579
 			case EEM_Question::QST_type_checkbox :
581
-				return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args );
580
+				return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args);
582 581
 				break;
583 582
 			// Date
584 583
 			case EEM_Question::QST_type_date :
585
-				return new EE_Datepicker_Input( $input_constructor_args );
584
+				return new EE_Datepicker_Input($input_constructor_args);
586 585
 				break;
587 586
 			case EEM_Question::QST_type_html_textarea :
588
-				$input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy();
589
-				$input =  new EE_Text_Area_Input( $input_constructor_args );
590
-				$input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' );
587
+				$input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy();
588
+				$input = new EE_Text_Area_Input($input_constructor_args);
589
+				$input->remove_validation_strategy('EE_Plaintext_Validation_Strategy');
591 590
 				return $input;
592 591
 			// fallback
593 592
 			default :
594
-				$default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args );
595
-				if( ! $default_input ){
596
-					$default_input = new EE_Text_Input( $input_constructor_args );
593
+				$default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args);
594
+				if ( ! $default_input) {
595
+					$default_input = new EE_Text_Input($input_constructor_args);
597 596
 				}
598 597
 				return $default_input;
599 598
 		}
@@ -618,65 +617,65 @@  discard block
 block discarded – undo
618 617
 	 */
619 618
 	public function process_reg_step() {
620 619
 
621
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
620
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
622 621
 		// grab validated data from form
623 622
 		$valid_data = $this->checkout->current_step->valid_data();
624 623
 		//EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
625 624
 		//EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );
626 625
 		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
627
-		if ( empty( $valid_data ))  {
628
-			EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
626
+		if (empty($valid_data)) {
627
+			EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
629 628
 			return FALSE;
630 629
 		}
631 630
 		//EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ );
632
-		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) {
633
-			EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
631
+		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
632
+			EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
634 633
 			return FALSE;
635 634
 		}
636 635
 		// get cached registrations
637
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
636
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
638 637
 		// verify we got the goods
639
-		if ( empty( $registrations )) {
640
-			EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
638
+		if (empty($registrations)) {
639
+			EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
641 640
 			return FALSE;
642 641
 		}
643 642
 		// extract attendee info from form data and save to model objects
644
-		$registrations_processed = $this->_process_registrations( $registrations, $valid_data );
643
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
645 644
 		// if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart
646
-		if ( $registrations_processed === FALSE ) {
645
+		if ($registrations_processed === FALSE) {
647 646
 			// but return immediately if the previous step exited early due to errors
648 647
 			return FALSE;
649
-		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) {
648
+		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
650 649
 			// generate a correctly translated string for all possible singular/plural combinations
651
-			if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) {
650
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
652 651
 				$error_msg = sprintf(
653
-					__( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ),
652
+					__('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'),
654 653
 					$this->checkout->total_ticket_count,
655 654
 					$registrations_processed
656 655
 				);
657
-			} else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) {
656
+			} else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
658 657
 				$error_msg = sprintf(
659
-					__( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ),
658
+					__('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'),
660 659
 					$this->checkout->total_ticket_count,
661 660
 					$registrations_processed
662 661
 				);
663 662
 			} else {
664 663
 				$error_msg = sprintf(
665
-					__( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ),
664
+					__('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'),
666 665
 					$this->checkout->total_ticket_count,
667 666
 					$registrations_processed
668 667
 				);
669 668
 
670 669
 			}
671
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
670
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
672 671
 			return FALSE;
673 672
 		}
674 673
 		// mark this reg step as completed
675 674
 		$this->set_completed();
676
-		$this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' ));
675
+		$this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso'));
677 676
 		//do action in case a plugin wants to do something with the data submitted in step 1.
678 677
 		//passes EE_Single_Page_Checkout, and it's posted data
679
-		do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data );
678
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
680 679
 		return TRUE;
681 680
 
682 681
 	}
@@ -690,9 +689,9 @@  discard block
 block discarded – undo
690 689
 	 * @param array             $valid_data
691 690
 	 * @return boolean | int
692 691
 	 */
693
-	private function _process_registrations( $registrations = array(), $valid_data = array() ) {
692
+	private function _process_registrations($registrations = array(), $valid_data = array()) {
694 693
 		// load resources and set some defaults
695
-		EE_Registry::instance()->load_model( 'Attendee' );
694
+		EE_Registry::instance()->load_model('Attendee');
696 695
 		// holder for primary registrant attendee object
697 696
 		$this->checkout->primary_attendee_obj = NULL;
698 697
 		// array for tracking reg form data for the primary registrant
@@ -709,19 +708,19 @@  discard block
 block discarded – undo
709 708
 		// attendee counter
710 709
 		$att_nmbr = 0;
711 710
 		// grab the saved registrations from the transaction
712
-		foreach ( $registrations  as $registration ) {
711
+		foreach ($registrations  as $registration) {
713 712
 			// verify EE_Registration object
714
-			if ( ! $registration instanceof EE_Registration ) {
715
-				EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
713
+			if ( ! $registration instanceof EE_Registration) {
714
+				EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
716 715
 				return FALSE;
717 716
 			}
718 717
 			$reg_url_link = $registration->reg_url_link();
719 718
 			// reg_url_link exists ?
720
-			if ( $reg_url_link ) {
719
+			if ($reg_url_link) {
721 720
 				// should this registration be processed during this visit ?
722
-				if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
721
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
723 722
 					// if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects
724
-					if ( ! $this->checkout->revisit ) {
723
+					if ( ! $this->checkout->revisit) {
725 724
 						$registration->save();
726 725
 					}
727 726
 
@@ -732,41 +731,41 @@  discard block
 block discarded – undo
732 731
 					 * @var bool   if TRUE is returned by the plugin then the
733 732
 					 *      		registration processing is halted.
734 733
 					 */
735
-					if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) {
734
+					if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) {
736 735
 						return FALSE;
737 736
 					}
738 737
 
739 738
 					// Houston, we have a registration!
740 739
 					$att_nmbr++;
741
-					$this->_attendee_data[ $reg_url_link ] = array();
740
+					$this->_attendee_data[$reg_url_link] = array();
742 741
 					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
743
-					if ( isset( $valid_data[ $reg_url_link ] )) {
742
+					if (isset($valid_data[$reg_url_link])) {
744 743
 						// do we need to copy basic info from primary attendee ?
745
-						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE;
744
+						$copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE;
746 745
 						// filter form input data for this registration
747
-						$valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] );
746
+						$valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]);
748 747
 						//EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ );
749
-						if ( isset( $valid_data['primary_attendee'] )) {
750
-							$primary_registrant['line_item_id'] =  ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE;
751
-							unset( $valid_data['primary_attendee'] );
748
+						if (isset($valid_data['primary_attendee'])) {
749
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE;
750
+							unset($valid_data['primary_attendee']);
752 751
 						}
753 752
 						// now loop through our array of valid post data && process attendee reg forms
754
-						foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) {
755
-							if ( ! in_array( $form_section, $non_input_form_sections )) {
756
-								foreach ( $form_inputs as $form_input => $input_value ) {
753
+						foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
754
+							if ( ! in_array($form_section, $non_input_form_sections)) {
755
+								foreach ($form_inputs as $form_input => $input_value) {
757 756
 									// check for critical inputs
758
-									if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) {
757
+									if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) {
759 758
 										return FALSE;
760 759
 									}
761 760
 									// store a bit of data about the primary attendee
762
-									if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) {
763
-										$primary_registrant[ $form_input ] = $input_value;
764
-									} else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) {
765
-										$input_value = $primary_registrant[ $form_input ];
761
+									if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) {
762
+										$primary_registrant[$form_input] = $input_value;
763
+									} else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) {
764
+										$input_value = $primary_registrant[$form_input];
766 765
 									}
767 766
 									// now attempt to save the input data
768
-									if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value ))  {
769
-										EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ );
767
+									if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) {
768
+										EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__);
770 769
 										return FALSE;
771 770
 									}
772 771
 								}
@@ -775,51 +774,51 @@  discard block
 block discarded – undo
775 774
 					}
776 775
 					//EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ );
777 776
 					// this registration does not require additional attendee information ?
778
-					if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
777
+					if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
779 778
 						// just copy the primary registrant
780 779
 						$attendee = $this->checkout->primary_attendee_obj;
781 780
 					} else {
782 781
 						// have we met before?
783
-						$attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] );
782
+						$attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]);
784 783
 						// did we find an already existing record for this attendee ?
785
-						if ( $attendee instanceof EE_Attendee ) {
786
-							$attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] );
784
+						if ($attendee instanceof EE_Attendee) {
785
+							$attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]);
787 786
 						} else {
788 787
 							// ensure critical details are set for additional attendees
789
-							$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ];
790
-							$attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] );
788
+							$this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link];
789
+							$attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]);
791 790
 						}
792 791
 						// who's #1 ?
793
-						if ( $att_nmbr == 1 ) {
792
+						if ($att_nmbr == 1) {
794 793
 							$this->checkout->primary_attendee_obj = $attendee;
795 794
 						}
796 795
 					}
797 796
 					//EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );
798 797
 					// add relation to registration, set attendee ID, and cache attendee
799
-					$this->_associate_attendee_with_registration( $registration, $attendee );
800
-					if ( ! $registration->attendee() instanceof EE_Attendee ) {
801
-						EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ );
798
+					$this->_associate_attendee_with_registration($registration, $attendee);
799
+					if ( ! $registration->attendee() instanceof EE_Attendee) {
800
+						EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__);
802 801
 						return FALSE;
803 802
 					}
804 803
 					/** @type EE_Registration_Processor $registration_processor */
805
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
804
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
806 805
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
807
-					$registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE );
806
+					$registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE);
808 807
 					/** @type EE_Transaction_Processor $transaction_processor */
809
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
808
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
810 809
 					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
811
-					$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
810
+					$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
812 811
 					// if we've gotten this far, then let's save what we have
813 812
 					$registration->save();
814 813
 					// add relation between TXN and registration
815
-					$this->_associate_registration_with_transaction( $registration );
814
+					$this->_associate_registration_with_transaction($registration);
816 815
 
817 816
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
818 817
 
819
-			}  else {
820
-				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__ );
818
+			} else {
819
+				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__);
821 820
 				// remove malformed data
822
-				unset( $valid_data[ $reg_url_link ] );
821
+				unset($valid_data[$reg_url_link]);
823 822
 				return FALSE;
824 823
 			}
825 824
 
@@ -837,22 +836,22 @@  discard block
 block discarded – undo
837 836
 	 * @param string           	$input_value
838 837
 	 * @return boolean
839 838
 	 */
840
-	private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) {
839
+	private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') {
841 840
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
842 841
 		//EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ );
843 842
 		// allow for plugins to hook in and do their own processing of the form input.
844 843
 		// For plugins to bypass normal processing here, they just need to return a boolean value.
845
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) {
844
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) {
846 845
 			return TRUE;
847 846
 		}
848 847
 
849 848
 		// grab related answer objects
850 849
 		$answers = $registration->answers();
851 850
 		// $answer_cache_id is the key used to find the EE_Answer we want
852
-		$answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link();
853
-		$answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE;
851
+		$answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link();
852
+		$answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE;
854 853
 		//rename form_inputs if they are EE_Attendee properties
855
-		switch( (string)$form_input ) {
854
+		switch ((string) $form_input) {
856 855
 
857 856
 			case 'state' :
858 857
 			case 'STA_ID' :
@@ -867,33 +866,33 @@  discard block
 block discarded – undo
867 866
 				break;
868 867
 
869 868
 			default :
870
-				$ATT_input = 'ATT_' . $form_input;
869
+				$ATT_input = 'ATT_'.$form_input;
871 870
 				//EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );
872
-				$attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE;
873
-				$form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;
871
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE;
872
+				$form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;
874 873
 		}
875 874
 		//EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );
876 875
 		//EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );
877 876
 		//EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );
878 877
 		//EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );
879 878
 		// if this form input has a corresponding attendee property
880
-		if ( $attendee_property ) {
881
-			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
882
-			if (  $answer_is_obj ) {
879
+		if ($attendee_property) {
880
+			$this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
881
+			if ($answer_is_obj) {
883 882
 				// and delete the corresponding answer since we won't be storing this data in that object
884
-				$registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' );
885
-				$answers[ $answer_cache_id ]->delete_permanently();
883
+				$registration->_remove_relation_to($answers[$answer_cache_id], 'Answer');
884
+				$answers[$answer_cache_id]->delete_permanently();
886 885
 			}
887 886
 			return TRUE;
888
-		} elseif ( $answer_is_obj ) {
887
+		} elseif ($answer_is_obj) {
889 888
 			// save this data to the answer object
890
-			$answers[ $answer_cache_id ]->set_value( $input_value );
891
-			$result = $answers[ $answer_cache_id ]->save();
889
+			$answers[$answer_cache_id]->set_value($input_value);
890
+			$result = $answers[$answer_cache_id]->save();
892 891
 			return $result !== false ? true : false;
893 892
 		} else {
894
-			foreach ( $answers as $answer ) {
895
-				if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) {
896
-					$answer->set_value( $input_value );
893
+			foreach ($answers as $answer) {
894
+				if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) {
895
+					$answer->set_value($input_value);
897 896
 					$result = $answer->save();
898 897
 					return $result !== false ? true : false;
899 898
 				}
@@ -911,33 +910,33 @@  discard block
 block discarded – undo
911 910
 	 * @param string $input_value
912 911
 	 * @return boolean
913 912
 	 */
914
-	private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) {
915
-		if ( empty( $input_value )) {
913
+	private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') {
914
+		if (empty($input_value)) {
916 915
 			// if the form input isn't marked as being required, then just return
917
-			if ( ! isset( $this->_required_questions[ $form_input ]  ) || ! $this->_required_questions[ $form_input ] ) {
916
+			if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) {
918 917
 				return true;
919 918
 			}
920
-			switch( $form_input ) {
919
+			switch ($form_input) {
921 920
 				case 'fname' :
922
-					EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
921
+					EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
923 922
 					return FALSE;
924 923
 					break;
925 924
 				case 'lname' :
926
-					EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
925
+					EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
927 926
 					return FALSE;
928 927
 					break;
929 928
 				case 'email' :
930
-					EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
929
+					EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
931 930
 					return FALSE;
932 931
 					break;
933 932
 			}
934
-		} else if ( $form_input === 'email' ) {
933
+		} else if ($form_input === 'email') {
935 934
 			// clean the email address
936
-			$valid_email = sanitize_email( $input_value );
935
+			$valid_email = sanitize_email($input_value);
937 936
 			// check if it matches
938
-			if ( $input_value != $valid_email ) {
937
+			if ($input_value != $valid_email) {
939 938
 				// whoops!!!
940
-				EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
939
+				EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
941 940
 				return FALSE;
942 941
 			}
943 942
 		}
@@ -965,14 +964,14 @@  discard block
 block discarded – undo
965 964
 	 * @param array           $attendee_data
966 965
 	 * @return boolean
967 966
 	 */
968
-	private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) {
967
+	private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) {
969 968
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
970
-		$ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : '';
971
-		$ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : '';
972
-		$ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : '';
969
+		$ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : '';
970
+		$ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : '';
971
+		$ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : '';
973 972
 		// but only if those have values
974
-		if ( $ATT_fname && $ATT_lname && $ATT_email ) {
975
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
973
+		if ($ATT_fname && $ATT_lname && $ATT_email) {
974
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
976 975
 				'ATT_fname' => $ATT_fname,
977 976
 				'ATT_lname' => $ATT_lname,
978 977
 				'ATT_email' => $ATT_email
@@ -980,7 +979,7 @@  discard block
 block discarded – undo
980 979
 		} else {
981 980
 			$existing_attendee = NULL;
982 981
 		}
983
-		return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data );
982
+		return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data);
984 983
 	}
985 984
 
986 985
 
@@ -992,13 +991,13 @@  discard block
 block discarded – undo
992 991
 	 * @param array           $attendee_data
993 992
 	 * @return \EE_Attendee
994 993
 	 */
995
-	private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) {
994
+	private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) {
996 995
 		// first remove fname, lname, and email from attendee data
997
-		$dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
996
+		$dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email');
998 997
 		// now loop thru what's left and add to attendee CPT
999
-		foreach ( $attendee_data as $property_name => $property_value ) {
1000
-			if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) {
1001
-				$existing_attendee->set( $property_name, $property_value );
998
+		foreach ($attendee_data as $property_name => $property_value) {
999
+			if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) {
1000
+				$existing_attendee->set($property_name, $property_value);
1002 1001
 			}
1003 1002
 		}
1004 1003
 		// better save that now
@@ -1015,11 +1014,11 @@  discard block
 block discarded – undo
1015 1014
 	 * @param EE_Attendee     $attendee
1016 1015
 	 * @return void
1017 1016
 	 */
1018
-	private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) {
1017
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) {
1019 1018
 		// add relation to attendee
1020
-		$registration->_add_relation_to( $attendee, 'Attendee' );
1021
-		$registration->set_attendee_id( $attendee->ID() );
1022
-		$registration->update_cache_after_object_save( 'Attendee', $attendee );
1019
+		$registration->_add_relation_to($attendee, 'Attendee');
1020
+		$registration->set_attendee_id($attendee->ID());
1021
+		$registration->update_cache_after_object_save('Attendee', $attendee);
1023 1022
 	}
1024 1023
 
1025 1024
 
@@ -1030,10 +1029,10 @@  discard block
 block discarded – undo
1030 1029
 	 * @param EE_Registration $registration
1031 1030
 	 * @return void
1032 1031
 	 */
1033
-	private function _associate_registration_with_transaction( EE_Registration $registration ) {
1032
+	private function _associate_registration_with_transaction(EE_Registration $registration) {
1034 1033
 		// add relation to attendee
1035
-		$this->checkout->transaction->_add_relation_to( $registration, 'Registration' );
1036
-		$this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration );
1034
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
1035
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1037 1036
 	}
1038 1037
 
1039 1038
 
@@ -1045,17 +1044,17 @@  discard block
 block discarded – undo
1045 1044
 	 * @param array $attendee_data
1046 1045
 	 * @return array
1047 1046
 	 */
1048
-	private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) {
1047
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) {
1049 1048
 		// bare minimum critical details include first name, last name, email address
1050
-		$critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1049
+		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email');
1051 1050
 		// add address info to critical details?
1052
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) {
1053
-			$address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' );
1054
-			$critical_attendee_details = array_merge( $critical_attendee_details, $address_details );
1051
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) {
1052
+			$address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone');
1053
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1055 1054
 		}
1056
-		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1057
-			if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) {
1058
-				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail );
1055
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1056
+			if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) {
1057
+				$attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail);
1059 1058
 			}
1060 1059
 		}
1061 1060
 		return $attendee_data;
@@ -1070,11 +1069,11 @@  discard block
 block discarded – undo
1070 1069
 	 * @param array           $attendee_data
1071 1070
 	 * @return \EE_Attendee
1072 1071
 	 */
1073
-	private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) {
1072
+	private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) {
1074 1073
 		// create new attendee object
1075
-		$new_attendee = EE_Attendee::new_instance( $attendee_data );
1074
+		$new_attendee = EE_Attendee::new_instance($attendee_data);
1076 1075
 		// set author to event creator
1077
-		$new_attendee->set( 'ATT_author', $registration->event()->wp_user() );
1076
+		$new_attendee->set('ATT_author', $registration->event()->wp_user());
1078 1077
 		$new_attendee->save();
1079 1078
 		return $new_attendee;
1080 1079
 	}
@@ -1090,7 +1089,7 @@  discard block
 block discarded – undo
1090 1089
 	 */
1091 1090
 	public function update_reg_step() {
1092 1091
 		// save everything
1093
-		if ( $this->process_reg_step() ) {
1092
+		if ($this->process_reg_step()) {
1094 1093
 			$this->checkout->redirect = TRUE;
1095 1094
 			$this->checkout->redirect_url = add_query_arg(
1096 1095
 				array(
@@ -1099,7 +1098,7 @@  discard block
 block discarded – undo
1099 1098
 				),
1100 1099
 				$this->checkout->thank_you_page_url
1101 1100
 			);
1102
-			$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1101
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1103 1102
 			return TRUE;
1104 1103
 		}
1105 1104
 		return FALSE;
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/model/Base.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 	protected $_model_version_info;
27 27
 
28 28
 /**
29
-	 * Sets the version the user requested
30
-	 * @param string $version eg '4.8'
31
-	 */
29
+ * Sets the version the user requested
30
+ * @param string $version eg '4.8'
31
+ */
32 32
 	public function set_requested_version( $version ) {
33 33
 		parent::set_requested_version( $version );
34 34
 		$this->_model_version_info = new Model_Version_Info( $version );
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 use EventEspresso\core\libraries\rest_api\controllers\Base as Controller_Base;
4 4
 use EventEspresso\core\libraries\rest_api\Model_Version_Info;
5 5
 
6
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-	exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 /**
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 * Sets the version the user requested
30 30
 	 * @param string $version eg '4.8'
31 31
 	 */
32
-	public function set_requested_version( $version ) {
33
-		parent::set_requested_version( $version );
34
-		$this->_model_version_info = new Model_Version_Info( $version );
32
+	public function set_requested_version($version) {
33
+		parent::set_requested_version($version);
34
+		$this->_model_version_info = new Model_Version_Info($version);
35 35
 	}
36 36
 
37 37
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @return \EventEspresso\core\libraries\rest_api\Model_Version_Info
44 44
 	 * @throws \EE_Error
45 45
 	 */
46
-	public function get_model_version_info(){
47
-		if( ! $this->_model_version_info ) {
46
+	public function get_model_version_info() {
47
+		if ( ! $this->_model_version_info) {
48 48
 			throw new \EE_Error(
49 49
 				sprintf(
50 50
 					__(
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @param array $classnames
67 67
 	 * @return boolean
68 68
 	 */
69
-	public function is_subclass_of_one( $object, $classnames ) {
70
-		foreach( $classnames as $classname ) {
71
-			if( is_a( $object, $classname ) ) {
69
+	public function is_subclass_of_one($object, $classnames) {
70
+		foreach ($classnames as $classname) {
71
+			if (is_a($object, $classname)) {
72 72
 				return true;
73 73
 			}
74 74
 		}
Please login to merge, or discard this patch.
core/libraries/rest_api/Model_Version_Info.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				$validation_error_message = $default_validation_strategy->get_validation_error_message();
43 43
 			}
44 44
 			throw new EE_Validation_Error( $validation_error_message, 'float_only' );
45
-		}else{
45
+		} else{
46 46
 			return floatval($normalized_value);
47 47
 		}
48 48
 	}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	public function unnormalize($normalized_value) {
56 56
 		if( empty( $normalized_value ) ){
57 57
 			return '0.00';
58
-		}else{
58
+		} else{
59 59
 			return "$normalized_value";
60 60
 		}
61 61
 	}
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\rest_api;
3 3
 
4
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 /**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	protected $_cached_fields_on_models = array();
89 89
 
90 90
 
91
-	public function __construct( $requested_version ) {
91
+	public function __construct($requested_version) {
92 92
 		$this->_requested_version = $requested_version;
93 93
 		$this->_model_changes = array(
94 94
 			'4.8.28' => array(
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 			'table_column' => 'N/A',
111 111
 			'always_available' => true,
112 112
 		);
113
-		foreach( $this->_resource_changes as $version => $model_classnames ) {
114
-			foreach( $model_classnames as $model_classname => $extra_fields ) {
115
-				foreach( $extra_fields as $fieldname => $field_data ) {
116
-					$this->_resource_changes[ $model_classname ][ $fieldname ][ 'name' ] = $fieldname;
117
-					foreach( $defaults as $attribute => $default_value ) {
118
-						if( ! isset( $this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] ) ) {
119
-							$this->_resource_changes[ $model_classname ][ $fieldname ][ $attribute ] = $default_value;
113
+		foreach ($this->_resource_changes as $version => $model_classnames) {
114
+			foreach ($model_classnames as $model_classname => $extra_fields) {
115
+				foreach ($extra_fields as $fieldname => $field_data) {
116
+					$this->_resource_changes[$model_classname][$fieldname]['name'] = $fieldname;
117
+					foreach ($defaults as $attribute => $default_value) {
118
+						if ( ! isset($this->_resource_changes[$model_classname][$fieldname][$attribute])) {
119
+							$this->_resource_changes[$model_classname][$fieldname][$attribute] = $default_value;
120 120
 						}
121 121
 					}
122 122
 				}
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	 * @return array
133 133
 	 */
134 134
 	public function model_changes_between_requested_version_and_current() {
135
-		if( $this->_cached_model_changes_between_requested_version_and_current === null ) {
135
+		if ($this->_cached_model_changes_between_requested_version_and_current === null) {
136 136
 			$model_changes = array();
137
-			foreach( $this->model_changes() as $version => $models_changed_in_version ) {
138
-				if( $version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version() ) {
139
-					$model_changes[ $version ] = $models_changed_in_version;
137
+			foreach ($this->model_changes() as $version => $models_changed_in_version) {
138
+				if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) {
139
+					$model_changes[$version] = $models_changed_in_version;
140 140
 				}
141 141
 			}
142 142
 			$this->_cached_model_changes_between_requested_version_and_current = $model_changes;
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 	 * @return array
153 153
 	 */
154 154
 	public function resource_changes_between_requested_version_and_current() {
155
-		if( $this->_cached_resource_changes_between_requested_version_and_current === null ) {
155
+		if ($this->_cached_resource_changes_between_requested_version_and_current === null) {
156 156
 			$resource_changes = array();
157
-			foreach( $this->resource_changes() as $version => $model_classnames ) {
158
-				if( $version <= \EED_Core_Rest_Api::core_version()  && $version > $this->requested_version()  ) {
159
-					$resource_changes[ $version ] = $model_classnames;
157
+			foreach ($this->resource_changes() as $version => $model_classnames) {
158
+				if ($version <= \EED_Core_Rest_Api::core_version() && $version > $this->requested_version()) {
159
+					$resource_changes[$version] = $model_classnames;
160 160
 				}
161 161
 			}
162 162
 			$this->_cached_resource_changes_between_requested_version_and_current = $resource_changes;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * If a request was sent to 'wp-json/ee/v4.7/events' this would be '4.7'
169 169
 	 * @return string like '4.6'
170 170
 	 */
171
-	public function requested_version(){
171
+	public function requested_version() {
172 172
 		return $this->_requested_version;
173 173
 	}
174 174
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * If a version is missing then we don't know anything about what changes it introduced from the previous version
183 183
 	 * @return array
184 184
 	 */
185
-	public function model_changes(){
185
+	public function model_changes() {
186 186
 		return $this->_model_changes;
187 187
 	}
188 188
 
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 	 * @return array keys are model names, values are their classname
194 194
 	 */
195 195
 	public function models_for_requested_version() {
196
-		if( $this->_cached_models_for_requested_version === null ) {
196
+		if ($this->_cached_models_for_requested_version === null) {
197 197
 			$all_models_in_current_version = \EE_Registry::instance()->non_abstract_db_models;
198
-			foreach( $this->model_changes_between_requested_version_and_current() as $version => $models_changed ) {
199
-				foreach( $models_changed as $model_name => $new_indicator_or_fields_added ) {
200
-					if( $new_indicator_or_fields_added === Model_Version_Info::model_added ) {
201
-						unset( $all_models_in_current_version[ $model_name ] );
198
+			foreach ($this->model_changes_between_requested_version_and_current() as $version => $models_changed) {
199
+				foreach ($models_changed as $model_name => $new_indicator_or_fields_added) {
200
+					if ($new_indicator_or_fields_added === Model_Version_Info::model_added) {
201
+						unset($all_models_in_current_version[$model_name]);
202 202
 					}
203 203
 				}
204 204
 			}
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 	 * @param string $model_name eg 'Event'
218 218
 	 * @return boolean
219 219
 	 */
220
-	public function is_model_name_in_this_version( $model_name ) {
220
+	public function is_model_name_in_this_version($model_name) {
221 221
 		$model_names = $this->models_for_requested_version();
222
-		if( isset( $model_names[ $model_name ] ) ) {
222
+		if (isset($model_names[$model_name])) {
223 223
 			return true;
224
-		}else{
224
+		} else {
225 225
 			return false;
226 226
 		}
227 227
 	}
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 	 * @return \EEM_Base
237 237
 	 * @throws \EE_Error
238 238
 	 */
239
-	public function load_model( $model_name ) {
240
-		if( $this->is_model_name_in_this_version( $model_name ) ) {
241
-			return \EE_Registry::instance()->load_model( $model_name );
242
-		}else{
239
+	public function load_model($model_name) {
240
+		if ($this->is_model_name_in_this_version($model_name)) {
241
+			return \EE_Registry::instance()->load_model($model_name);
242
+		} else {
243 243
 			throw new \EE_Error(
244 244
 				sprintf(
245 245
 					__(
@@ -261,21 +261,21 @@  discard block
 block discarded – undo
261 261
 	 * @param \EEM_Base $model
262 262
 	 * @return array|\EE_Model_Field_Base[]
263 263
 	 */
264
-	public function fields_on_model_in_this_version( $model ) {
265
-		if( ! isset( $this->_cached_fields_on_models[ $model->get_this_model_name() ] ) ) {
264
+	public function fields_on_model_in_this_version($model) {
265
+		if ( ! isset($this->_cached_fields_on_models[$model->get_this_model_name()])) {
266 266
 			//get all model changes between the requested version and current core version
267 267
 			$changes = $this->model_changes_between_requested_version_and_current();
268 268
 			//fetch all fields currently on this model
269 269
 			$current_fields = $model->field_settings();
270 270
 			//remove all fields that have been added since
271
-			foreach( $changes as $version => $changes_in_version ) {
272
-				if(
273
-					isset( $changes_in_version[ $model->get_this_model_name() ] )
274
-					&& $changes_in_version[ $model->get_this_model_name() ] !== Model_Version_Info::model_added
271
+			foreach ($changes as $version => $changes_in_version) {
272
+				if (
273
+					isset($changes_in_version[$model->get_this_model_name()])
274
+					&& $changes_in_version[$model->get_this_model_name()] !== Model_Version_Info::model_added
275 275
 				) {
276 276
 					$current_fields = array_diff_key(
277 277
 						$current_fields,
278
-						array_flip( $changes_in_version[ $model->get_this_model_name() ] )
278
+						array_flip($changes_in_version[$model->get_this_model_name()])
279 279
 					);
280 280
 				}
281 281
 			}
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
 	 * @param array $classnames
294 294
 	 * @return boolean
295 295
 	 */
296
-	public function is_subclass_of_one( $object, $classnames ) {
297
-		foreach( $classnames as $classname ) {
298
-			if( is_a( $object, $classname ) ) {
296
+	public function is_subclass_of_one($object, $classnames) {
297
+		foreach ($classnames as $classname) {
298
+			if (is_a($object, $classname)) {
299 299
 				return true;
300 300
 			}
301 301
 		}
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 	 * Returns the list of model field classes that that the API basically ignores
307 307
 	 * @return array
308 308
 	 */
309
-	public function fields_ignored(){
309
+	public function fields_ignored() {
310 310
 		return apply_filters(
311 311
 			'FHEE__Controller_Model_Read_fields_ignored',
312
-			array( 'EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field' )
312
+			array('EE_Foreign_Key_Field_Base', 'EE_Any_Foreign_Model_Name_Field')
313 313
 		);
314 314
 	}
315 315
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 	 * @param EE_Model_Field_Base
319 319
 	 * @return boolean
320 320
 	 */
321
-	public function field_is_ignored( $field_obj ){
322
-		 return $this->is_subclass_of_one( $field_obj, $this->fields_ignored() );
321
+	public function field_is_ignored($field_obj) {
322
+		 return $this->is_subclass_of_one($field_obj, $this->fields_ignored());
323 323
 	}
324 324
 
325 325
 	/**
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	public function fields_that_have_rendered_format() {
331 331
 		return apply_filters(
332 332
 			'FHEE__Controller_Model_Read__fields_raw',
333
-			array( 'EE_Post_Content_Field', 'EE_Full_HTML_Field' )
333
+			array('EE_Post_Content_Field', 'EE_Full_HTML_Field')
334 334
 		);
335 335
 	}
336 336
 
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
 	 * @param EE_Model_Field_Base
340 340
 	 * @return boolean
341 341
 	 */
342
-	public function field_has_rendered_format( $field_obj ){
343
-		 return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_rendered_format() );
342
+	public function field_has_rendered_format($field_obj) {
343
+		 return $this->is_subclass_of_one($field_obj, $this->fields_that_have_rendered_format());
344 344
 	}
345 345
 
346 346
 	/**
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	public function fields_that_have_pretty_format() {
353 353
 		return apply_filters(
354 354
 			'FHEE__Controller_Model_Read__fields_pretty',
355
-			array( 'EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field' )
355
+			array('EE_Enum_Integer_Field', 'EE_Enum_Text_Field', 'EE_Money_Field')
356 356
 		);
357 357
 	}
358 358
 
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
 	 * @param EE_Model_Field_Base
362 362
 	 * @return boolean
363 363
 	 */
364
-	public function field_has_pretty_format( $field_obj ){
365
-		 return $this->is_subclass_of_one( $field_obj, $this->fields_that_have_pretty_format() );
364
+	public function field_has_pretty_format($field_obj) {
365
+		 return $this->is_subclass_of_one($field_obj, $this->fields_that_have_pretty_format());
366 366
 	}
367 367
 
368 368
 	/**
@@ -379,12 +379,12 @@  discard block
 block discarded – undo
379 379
 	 * @param \EEM_Base $model
380 380
 	 * @return array
381 381
 	 */
382
-	public function extra_resource_properties_for_model( $model ) {
382
+	public function extra_resource_properties_for_model($model) {
383 383
 		$extra_properties = array();
384
-		foreach( $this->resource_changes_between_requested_version_and_current() as $version => $model_classnames ) {
385
-			foreach( $model_classnames as $model_classname => $properties_added_in_this_version ) {
386
-				if( is_subclass_of( $model, $model_classname ) ) {
387
-					$extra_properties = array_merge( $extra_properties, $properties_added_in_this_version );
384
+		foreach ($this->resource_changes_between_requested_version_and_current() as $version => $model_classnames) {
385
+			foreach ($model_classnames as $model_classname => $properties_added_in_this_version) {
386
+				if (is_subclass_of($model, $model_classname)) {
387
+					$extra_properties = array_merge($extra_properties, $properties_added_in_this_version);
388 388
 				}
389 389
 			}
390 390
 		}
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/model/Meta.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@
 block discarded – undo
44 44
 
45 45
 				if( $field_obj instanceof \EE_Boolean_Field ) {
46 46
 					$datatype = 'Boolean';
47
-				}elseif( $field_obj->get_wpdb_data_type() == '%d' ) {
47
+				} elseif( $field_obj->get_wpdb_data_type() == '%d' ) {
48 48
 					$datatype = 'Number';
49
-				}elseif( $field_name instanceof \EE_Serialized_Text_Field ) {
49
+				} elseif( $field_name instanceof \EE_Serialized_Text_Field ) {
50 50
 					$datatype = 'Object';
51
-				}else{
51
+				} else{
52 52
 					$datatype = 'String';
53 53
 				}
54 54
 				$field_json = array(
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\rest_api\controllers\model;
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 /**
@@ -18,75 +18,75 @@  discard block
 block discarded – undo
18 18
 class Meta extends Base {
19 19
 
20 20
 
21
-	public static function handle_request_models_meta( \WP_REST_Request $request ) {
21
+	public static function handle_request_models_meta(\WP_REST_Request $request) {
22 22
 		$controller = new Meta();
23 23
 		$matches = $controller->parse_route( 
24 24
 			$request->get_route(), 
25
-			'~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . 'resources~', 
26
-			array( 'version' ) ); 
27
-		if( $matches instanceof \WP_REST_Response ) {
25
+			'~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'resources~', 
26
+			array('version') ); 
27
+		if ($matches instanceof \WP_REST_Response) {
28 28
 			return $matches;
29 29
 		}
30
-		$controller->set_requested_version( $matches[ 'version' ] );
31
-		return $controller->send_response( $controller->_get_models_metadata_entity() );
30
+		$controller->set_requested_version($matches['version']);
31
+		return $controller->send_response($controller->_get_models_metadata_entity());
32 32
 	}
33 33
 
34 34
 	/*
35 35
 	 * Gets the model metadata resource entity
36 36
 	 * @return array for JSON response, describing all the models available in teh requested version
37 37
 	 */
38
-	protected function _get_models_metadata_entity(){
38
+	protected function _get_models_metadata_entity() {
39 39
 		$response = array();
40
-		foreach( $this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname ){
41
-			$model = $this->get_model_version_info()->load_model( $model_name );
40
+		foreach ($this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname) {
41
+			$model = $this->get_model_version_info()->load_model($model_name);
42 42
 			$fields_json = array();
43
-			foreach( $this->get_model_version_info()->fields_on_model_in_this_version( $model ) as $field_name => $field_obj ) {
44
-				if( $this->get_model_version_info()->field_is_ignored( $field_obj ) ) {
43
+			foreach ($this->get_model_version_info()->fields_on_model_in_this_version($model) as $field_name => $field_obj) {
44
+				if ($this->get_model_version_info()->field_is_ignored($field_obj)) {
45 45
 					continue;
46 46
 				}
47
-				if( $field_obj instanceof \EE_Boolean_Field ) {
47
+				if ($field_obj instanceof \EE_Boolean_Field) {
48 48
 					$datatype = 'Boolean';
49
-				}elseif( $field_obj->get_wpdb_data_type() == '%d' ) {
49
+				}elseif ($field_obj->get_wpdb_data_type() == '%d') {
50 50
 					$datatype = 'Number';
51
-				}elseif( $field_name instanceof \EE_Serialized_Text_Field ) {
51
+				}elseif ($field_name instanceof \EE_Serialized_Text_Field) {
52 52
 					$datatype = 'Object';
53
-				}else{
53
+				} else {
54 54
 					$datatype = 'String';
55 55
 				}
56 56
 				$default_value = $field_obj->get_default_value();
57
-				if( $default_value === EE_INF ) {
57
+				if ($default_value === EE_INF) {
58 58
 					$default_value = EE_INF_IN_DB;
59
-				} elseif( $field_obj instanceof \EE_Datetime_Field &&
60
-					$default_value instanceof \DateTime ) {
61
-					$default_value = $default_value->format( 'c' );
59
+				} elseif ($field_obj instanceof \EE_Datetime_Field &&
60
+					$default_value instanceof \DateTime) {
61
+					$default_value = $default_value->format('c');
62 62
 				}
63 63
 				$field_json = array(
64 64
 					'name' => $field_name,
65 65
 					'nicename' => $field_obj->get_nicename(),
66
-					'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format( $field_obj ),
67
-					'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format( $field_obj ),
68
-					'type' => str_replace('EE_', '', get_class( $field_obj ) ),
66
+					'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format($field_obj),
67
+					'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format($field_obj),
68
+					'type' => str_replace('EE_', '', get_class($field_obj)),
69 69
 					'datatype' => $datatype,
70 70
 					'nullable' => $field_obj->is_nullable(),
71 71
 					'default' => $default_value,
72 72
 					'table_alias' => $field_obj->get_table_alias(),
73 73
 					'table_column' => $field_obj->get_table_column(),
74 74
 				);
75
-				$fields_json[ $field_json[ 'name' ] ] = $field_json;
75
+				$fields_json[$field_json['name']] = $field_json;
76 76
 
77 77
 			}
78
-			$fields_json = array_merge( $fields_json, $this->get_model_version_info()->extra_resource_properties_for_model( $model ) );
79
-			$response[ $model_name ]['fields'] = apply_filters( 'FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model );
78
+			$fields_json = array_merge($fields_json, $this->get_model_version_info()->extra_resource_properties_for_model($model));
79
+			$response[$model_name]['fields'] = apply_filters('FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model);
80 80
 			$relations_json = array();
81
-			foreach( $model->relation_settings()  as $relation_name => $relation_obj ) {
81
+			foreach ($model->relation_settings()  as $relation_name => $relation_obj) {
82 82
 				$relation_json = array(
83 83
 					'name' => $relation_name,
84
-					'type' => str_replace( 'EE_', '', get_class( $relation_obj ) ),
84
+					'type' => str_replace('EE_', '', get_class($relation_obj)),
85 85
 					'single' => $relation_obj instanceof \EE_Belongs_To_Relation ? true : false,
86 86
 				);
87
-				$relations_json[ $relation_name ] = $relation_json;
87
+				$relations_json[$relation_name] = $relation_json;
88 88
 			}
89
-			$response[ $model_name ][ 'relations' ] = apply_filters( 'FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model );
89
+			$response[$model_name]['relations'] = apply_filters('FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model);
90 90
 		}
91 91
 		return $response;
92 92
 	}
@@ -96,23 +96,23 @@  discard block
 block discarded – undo
96 96
 	 * @param WP_REST_Response $rest_response_obj
97 97
 	 * @return WP_REST_Response
98 98
 	 */
99
-	public static function filter_ee_metadata_into_index( $rest_response_obj ) {
99
+	public static function filter_ee_metadata_into_index($rest_response_obj) {
100 100
 		$response_data = $rest_response_obj->get_data();
101 101
 		$addons = array();
102
-		foreach( \EE_Registry::instance()->addons as $addon){
102
+		foreach (\EE_Registry::instance()->addons as $addon) {
103 103
 			$addon_json = array(
104 104
 				'name' => $addon->name(),
105 105
 				'version' => $addon->version()
106 106
 			);
107
-			$addons[ $addon_json[ 'name' ] ] = $addon_json;
107
+			$addons[$addon_json['name']] = $addon_json;
108 108
 		}
109
-		$response_data[ 'ee' ] = array(
109
+		$response_data['ee'] = array(
110 110
 			'version' => \EEM_System_Status::instance()->get_ee_version(),
111 111
 			'addons' => $addons,
112 112
 			'maintenance_mode' => \EE_Maintenance_Mode::instance()->real_level(),
113
-			'served_core_versions' => array_keys( \EED_Core_Rest_Api::versions_served() )
113
+			'served_core_versions' => array_keys(\EED_Core_Rest_Api::versions_served())
114 114
 		);
115
-		$rest_response_obj->set_data( $response_data );
115
+		$rest_response_obj->set_data($response_data);
116 116
 		return $rest_response_obj;
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime.model.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -443,7 +443,7 @@
 block discarded – undo
443 443
 	/**
444 444
 	 * This returns an array of counts of datetimes in the database for each Datetime status that can be queried.
445 445
 	 *
446
-	 * @param  array $stati_to_include        If included you can restrict the statuses we return counts for by including the stati
446
+	 * @param  string[] $stati_to_include        If included you can restrict the statuses we return counts for by including the stati
447 447
 	 *                               you want counts for as values in the array.  An empty array returns counts for all valid
448 448
 	 *                               stati.
449 449
 	 * @param  array  $query_params  If included can be used to refine the conditions for returning the count (i.e. only for
Please login to merge, or discard this patch.
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Datetime.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Datetime.class.php');
26 26
 
27 27
 class EEM_Datetime extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,27 +35,27 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Datetime','event_espresso');
40
-		$this->plural_item = __('Datetimes','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Datetime', 'event_espresso');
40
+		$this->plural_item = __('Datetimes', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Datetime'=>array(
47
-				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')),
48
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
47
+				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')),
48
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
49 49
 				'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''),
50 50
 				'DTT_description' => new EE_Full_HTML_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''),
51
-				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, time(), $timezone ),
52
-				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, time(), $timezone ),
53
-				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF),
54
-				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ),
55
-				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false),
51
+				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone),
52
+				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone),
53
+				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF),
54
+				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0),
55
+				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false),
56 56
 				'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0),
57
-				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ),
58
-				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ),
57
+				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0),
58
+				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false),
59 59
 			));
60 60
 		$this->_model_relations = array(
61 61
 			'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		);
65 65
 		$this->_model_chain_to_wp_user = 'Event';
66 66
 		//this model is generally available for reading
67
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' );
68
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
69
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
70
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit );
71
-		parent::__construct( $timezone );
67
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event');
68
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event');
69
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event');
70
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit);
71
+		parent::__construct($timezone);
72 72
 	}
73 73
 
74 74
 
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 	public function create_new_blank_datetime() {
84 84
 		$blank_datetime = EE_Datetime::new_instance(
85 85
 			array(
86
-				'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30),
87
-				'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30),
86
+				'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30),
87
+				'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30),
88 88
 				'DTT_order' => 1,
89 89
 				'DTT_reg_limit' => EE_INF
90 90
 			),
91 91
 			$this->_timezone
92 92
 		);
93
-		$blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) );
94
-		$blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) );
95
-		return array( $blank_datetime );
93
+		$blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone));
94
+		$blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone));
95
+		return array($blank_datetime);
96 96
 	}
97 97
 
98 98
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	* 		@param		int 			$EVT_ID
107 107
 	*		@return 		EE_Datetime[]		array on success, FALSE on fail
108 108
 	*/
109
-	public function get_all_event_dates( $EVT_ID = 0 ) {
110
-		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
109
+	public function get_all_event_dates($EVT_ID = 0) {
110
+		if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0
111 111
 			return $this->create_new_blank_datetime();
112 112
 		}
113
-		$results =  $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
113
+		$results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
114 114
 
115
-		if ( empty( $results ) ) {
115
+		if (empty($results)) {
116 116
 			return $this->create_new_blank_datetime();
117 117
 		}
118 118
 
@@ -133,26 +133,26 @@  discard block
 block discarded – undo
133 133
 	 *                        	the given number
134 134
 	 * @return EE_Datetime[]
135 135
 	 */
136
-	public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL  ) {
136
+	public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) {
137 137
 
138 138
 		//sanitize EVT_ID
139
-		$EVT_ID = intval( $EVT_ID );
139
+		$EVT_ID = intval($EVT_ID);
140 140
 
141 141
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
142
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
143
-		$where_params = array( 'Event.EVT_ID' => $EVT_ID );
142
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
143
+		$where_params = array('Event.EVT_ID' => $EVT_ID);
144 144
 
145
-		$query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' );
145
+		$query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none');
146 146
 
147
-		if( ! $include_expired){
148
-			$query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) );
147
+		if ( ! $include_expired) {
148
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
149 149
 		}
150
-		if( $include_deleted){
151
-			$query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE ));
150
+		if ($include_deleted) {
151
+			$query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE));
152 152
 		}
153 153
 
154
-		$result = $this->get_all( $query_params );
155
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
154
+		$result = $this->get_all($query_params);
155
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
156 156
 		return $result;
157 157
 	}
158 158
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @param int $limit
168 168
 	 * @return EE_Datetime[]
169 169
 	 */
170
-	public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){
171
-		return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID),
170
+	public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) {
171
+		return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID),
172 172
 			'limit'=>$limit,
173 173
 			'order_by'=>array('DTT_EVT_start'=>'ASC'),
174 174
 			'default_where_conditions' => 'none'));
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @param boolean $include_deleted
184 184
 	 * @return EE_Datetime
185 185
 	 */
186
-	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){
187
-		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
-		if($results){
186
+	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) {
187
+		$results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
+		if ($results) {
189 189
 			return array_shift($results);
190
-		}else{
190
+		} else {
191 191
 			return NULL;
192 192
 		}
193 193
 	}
@@ -201,16 +201,16 @@  discard block
 block discarded – undo
201 201
 	 * @param bool $try_to_exclude_deleted
202 202
 	 * @return \EE_Datetime
203 203
 	 */
204
-	public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){
205
-		if($try_to_exclude_expired){
206
-			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false);
207
-			if($non_expired){
204
+	public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) {
205
+		if ($try_to_exclude_expired) {
206
+			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
207
+			if ($non_expired) {
208 208
 				return $non_expired;
209 209
 			}
210 210
 		}
211
-		if($try_to_exclude_deleted){
211
+		if ($try_to_exclude_deleted) {
212 212
 			$expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
213
-			if($expired_even){
213
+			if ($expired_even) {
214 214
 				return $expired_even;
215 215
 			}
216 216
 		}
@@ -229,23 +229,23 @@  discard block
 block discarded – undo
229 229
 	 * @param int $limit
230 230
 	 * @return EE_Datetime[]
231 231
 	 */
232
-	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){
232
+	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
233 233
 		//sanitize EVT_ID
234
-		$EVT_ID = intval( $EVT_ID );
234
+		$EVT_ID = intval($EVT_ID);
235 235
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
236
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
237
-		$query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
238
-		if( ! $include_expired){
239
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
236
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
237
+		$query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
238
+		if ( ! $include_expired) {
239
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
240 240
 		}
241
-		if( $include_deleted){
242
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
241
+		if ($include_deleted) {
242
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
243 243
 		}
244
-		if($limit){
244
+		if ($limit) {
245 245
 			$query_params['limit'] = $limit;
246 246
 		}
247
-		$result = $this->get_all( $query_params );
248
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
247
+		$result = $this->get_all($query_params);
248
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
249 249
 		return $result;
250 250
 	}
251 251
 
@@ -258,23 +258,23 @@  discard block
 block discarded – undo
258 258
 	 * @param int $limit
259 259
 	 * @return EE_Datetime[]
260 260
 	 */
261
-	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
261
+	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
262 262
 		//sanitize TKT_ID
263
-		$TKT_ID =  intval( $TKT_ID );
263
+		$TKT_ID = intval($TKT_ID);
264 264
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
265
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
266
-		$query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
267
-		if( ! $include_expired){
268
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
265
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
266
+		$query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
267
+		if ( ! $include_expired) {
268
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
269 269
 		}
270
-		if( $include_deleted){
271
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
270
+		if ($include_deleted) {
271
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
272 272
 		}
273
-		if($limit){
273
+		if ($limit) {
274 274
 			$query_params['limit'] = $limit;
275 275
 		}
276
-		$result = $this->get_all( $query_params );
277
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
276
+		$result = $this->get_all($query_params);
277
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
278 278
 		return $result;
279 279
 	}
280 280
 
@@ -290,24 +290,24 @@  discard block
 block discarded – undo
290 290
 	 *                                  that number
291 291
 	 * @return EE_Datetime[]
292 292
 	 */
293
-	public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) {
293
+	public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
294 294
 		//sanitize id.
295
-		$TKT_ID =  intval( $TKT_ID );
295
+		$TKT_ID = intval($TKT_ID);
296 296
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
297
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
298
-		$where_params = array( 'Ticket.TKT_ID' => $TKT_ID );
299
-		$query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) );
300
-		if( ! $include_expired){
301
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
297
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
298
+		$where_params = array('Ticket.TKT_ID' => $TKT_ID);
299
+		$query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
300
+		if ( ! $include_expired) {
301
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
302 302
 		}
303
-		if( $include_deleted){
304
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
303
+		if ($include_deleted) {
304
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
305 305
 		}
306
-		if($limit){
306
+		if ($limit) {
307 307
 			$query_params['limit'] = $limit;
308 308
 		}
309
-		$result = $this->get_all( $query_params );
310
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
309
+		$result = $this->get_all($query_params);
310
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
311 311
 		return $result;
312 312
 	}
313 313
 
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 	 * @param int $EVT_ID
319 319
 	 * @return EE_Datetime
320 320
 	 */
321
-	public function get_most_important_datetime_for_event($EVT_ID){
321
+	public function get_most_important_datetime_for_event($EVT_ID) {
322 322
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
323
-		if($results){
323
+		if ($results) {
324 324
 			return array_shift($results);
325
-		}else{
325
+		} else {
326 326
 			return null;
327 327
 		}
328 328
 	}
@@ -341,71 +341,71 @@  discard block
 block discarded – undo
341 341
 	 * 			- inactive = Events that are either not published.
342 342
 	 * @return wpdb results array
343 343
 	 */
344
-	public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) {
344
+	public function get_dtt_months_and_years($where_params, $evt_active_status = '') {
345 345
 
346
-		switch ( $evt_active_status ) {
346
+		switch ($evt_active_status) {
347 347
 			case 'upcoming' :
348 348
 					$where_params['Event.status'] = 'publish';
349 349
 					//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
350
-					if ( isset( $where_params['DTT_EVT_start'] ) ) {
350
+					if (isset($where_params['DTT_EVT_start'])) {
351 351
 						$where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start'];
352 352
 					}
353
-					$where_params['DTT_EVT_start'] = array('>', $this->current_time_for_query( 'DTT_EVT_start' ) );
353
+					$where_params['DTT_EVT_start'] = array('>', $this->current_time_for_query('DTT_EVT_start'));
354 354
 					break;
355 355
 
356 356
 			case 'expired' :
357
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
357
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
358 358
 				//get events to exclude
359
-				$exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $this->current_time_for_query( 'DTT_EVT_end' ) ) ) );
359
+				$exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $this->current_time_for_query('DTT_EVT_end'))));
360 360
 				//first get all events that have datetimes where its not expired.
361
-				$event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' );
362
-				$event_ids = array_keys( $event_ids );
361
+				$event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID');
362
+				$event_ids = array_keys($event_ids);
363 363
 
364
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
364
+				if (isset($where_params['DTT_EVT_end'])) {
365 365
 					$where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
366 366
 				}
367
-				$where_params['DTT_EVT_end'] = array( '<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
368
-				$where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids );
367
+				$where_params['DTT_EVT_end'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
368
+				$where_params['Event.EVT_ID'] = array('NOT IN', $event_ids);
369 369
 				break;
370 370
 
371 371
 			case 'active' :
372 372
 				$where_params['Event.status'] = 'publish';
373
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
373
+				if (isset($where_params['DTT_EVT_start'])) {
374 374
 					$where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start'];
375 375
 				}
376
-				if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
376
+				if (isset($where_params['Datetime.DTT_EVT_end'])) {
377 377
 					$where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end'];
378 378
 				}
379
-				$where_params['DTT_EVT_start'] = array('<',  $this->current_time_for_query( 'DTT_EVT_start' ) );
380
-				$where_params['DTT_EVT_end'] = array('>', $this->current_time_for_query( 'DTT_EVT_end' ) );
379
+				$where_params['DTT_EVT_start'] = array('<', $this->current_time_for_query('DTT_EVT_start'));
380
+				$where_params['DTT_EVT_end'] = array('>', $this->current_time_for_query('DTT_EVT_end'));
381 381
 				break;
382 382
 
383 383
 			case 'inactive' :
384
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
385
-				if ( isset( $where_params['OR'] ) ) {
384
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
385
+				if (isset($where_params['OR'])) {
386 386
 					$where_params['AND']['OR'] = $where_params['OR'];
387 387
 				}
388
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
388
+				if (isset($where_params['DTT_EVT_end'])) {
389 389
 					$where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
390
-					unset( $where_params['DTT_EVT_end'] );
390
+					unset($where_params['DTT_EVT_end']);
391 391
 				}
392 392
 
393
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
393
+				if (isset($where_params['DTT_EVT_start'])) {
394 394
 					$where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start'];
395
-					unset( $where_params['DTT_EVT_start'] );
395
+					unset($where_params['DTT_EVT_start']);
396 396
 				}
397
-				$where_params['AND']['Event.status'] = array( '!=', 'publish' );
397
+				$where_params['AND']['Event.status'] = array('!=', 'publish');
398 398
 				break;
399 399
 		}
400 400
 
401 401
 		$query_params[0] = $where_params;
402 402
 		$query_params['group_by'] = array('dtt_year', 'dtt_month');
403
-		$query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' );
403
+		$query_params['order_by'] = array('DTT_EVT_start' => 'DESC');
404 404
 		$columns_to_select = array(
405 405
 			'dtt_year' => array('YEAR(DTT_EVT_start)', '%s'),
406 406
 			'dtt_month' => array('MONTHNAME(DTT_EVT_start)', '%s')
407 407
 			);
408
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
408
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
409 409
 	}
410 410
 
411 411
 	/**
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
 	 * for the tickets for each datetime)
414 414
 	 * @param EE_Datetime[] $datetimes
415 415
 	 */
416
-	public function update_sold($datetimes){
417
-		foreach($datetimes as $datetime){
416
+	public function update_sold($datetimes) {
417
+		foreach ($datetimes as $datetime) {
418 418
 			$datetime->update_sold();
419 419
 		}
420 420
 	}
@@ -429,10 +429,10 @@  discard block
 block discarded – undo
429 429
 	 * @param array $query_params
430 430
 	 * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF,  IF there are NO tickets attached to datetime then FALSE is returned.
431 431
 	 */
432
-	public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) {
433
-		$datetime = $this->get_one_by_ID( $DTT_ID );
434
-		if ( $datetime instanceof EE_Datetime ) {
435
-			return $datetime->tickets_remaining( $query_params );
432
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
433
+		$datetime = $this->get_one_by_ID($DTT_ID);
434
+		if ($datetime instanceof EE_Datetime) {
435
+			return $datetime->tickets_remaining($query_params);
436 436
 		}
437 437
 		return 0;
438 438
 	}
@@ -454,36 +454,36 @@  discard block
 block discarded – undo
454 454
 	 *                EE_Datetime::upcoming
455 455
 	 *                EE_Datetime::expired
456 456
 	 */
457
-	public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) {
457
+	public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) {
458 458
 		//only accept where conditions for this query.
459
-		$_where = isset( $query_params[0] ) ? $query_params[0] : array();
459
+		$_where = isset($query_params[0]) ? $query_params[0] : array();
460 460
 		$status_query_args = array(
461 461
 				EE_Datetime::active => array_merge(
462 462
 						$_where,
463
-						array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) )
463
+						array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time()))
464 464
 				),
465 465
 				EE_Datetime::upcoming => array_merge(
466 466
 						$_where,
467
-						array( 'DTT_EVT_start' => array( '>', time() ) )
467
+						array('DTT_EVT_start' => array('>', time()))
468 468
 				),
469 469
 				EE_Datetime::expired => array_merge(
470 470
 						$_where,
471
-						array( 'DTT_EVT_end' => array('<', time() ) )
471
+						array('DTT_EVT_end' => array('<', time()))
472 472
 				)
473 473
 		);
474 474
 
475
-		if ( ! empty( $stati_to_include ) ) {
476
-			foreach( array_keys( $status_query_args ) as $status ) {
477
-				if ( ! in_array( $status, $stati_to_include ) ) {
478
-					unset( $status_query_args[$status] );
475
+		if ( ! empty($stati_to_include)) {
476
+			foreach (array_keys($status_query_args) as $status) {
477
+				if ( ! in_array($status, $stati_to_include)) {
478
+					unset($status_query_args[$status]);
479 479
 				}
480 480
 			}
481 481
 		}
482 482
 
483 483
 		//loop through and query counts for each stati.
484 484
 		$status_query_results = array();
485
-		foreach( $status_query_args as $status => $status_where_conditions ) {
486
-			$status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true );
485
+		foreach ($status_query_args as $status => $status_where_conditions) {
486
+			$status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true);
487 487
 		}
488 488
 
489 489
 		return $status_query_results;
@@ -497,9 +497,9 @@  discard block
 block discarded – undo
497 497
 	 * @param array $query_params
498 498
 	 * @return int
499 499
 	 */
500
-	public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) {
501
-		$count = $this->get_datetime_counts_by_status( array( $status ), $query_params );
502
-		return ! empty( $count[$status] ) ? $count[$status] : 0;
500
+	public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) {
501
+		$count = $this->get_datetime_counts_by_status(array($status), $query_params);
502
+		return ! empty($count[$status]) ? $count[$status] : 0;
503 503
 	}
504 504
 
505 505
 
Please login to merge, or discard this patch.
core/db_classes/EE_Registration.class.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * EE_Registration class
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	 *                             		    date_format and the second value is the time format
42 42
 	 * @return EE_Registration
43 43
 	 */
44
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
45
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
46
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
44
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
45
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
46
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
47 47
 	}
48 48
 
49 49
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 *                          		the website will be used.
55 55
 	 * @return EE_Registration
56 56
 	 */
57
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
58
-		return new self( $props_n_values, TRUE, $timezone );
57
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
58
+		return new self($props_n_values, TRUE, $timezone);
59 59
 	}
60 60
 
61 61
 
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	 * @access        public
67 67
 	 * @param        int $EVT_ID Event ID
68 68
 	 */
69
-	public function set_event( $EVT_ID = 0 ) {
70
-		$this->set( 'EVT_ID', $EVT_ID );
69
+	public function set_event($EVT_ID = 0) {
70
+		$this->set('EVT_ID', $EVT_ID);
71 71
 	}
72 72
 
73 73
 
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
 	 * @param mixed  $field_value
79 79
 	 * @param bool   $use_default
80 80
 	 */
81
-	public function set( $field_name, $field_value, $use_default = FALSE ) {
82
-		switch( $field_name ) {
81
+	public function set($field_name, $field_value, $use_default = FALSE) {
82
+		switch ($field_name) {
83 83
 			case 'REG_code' :
84
-				if ( ! empty( $field_value ) && $this->reg_code() == '' ) {
85
-					$this->set_reg_code( $field_value, $use_default );
84
+				if ( ! empty($field_value) && $this->reg_code() == '') {
85
+					$this->set_reg_code($field_value, $use_default);
86 86
 				}
87 87
 				break;
88 88
 			case 'STS_ID' :
89
-				$this->set_status( $field_value, $use_default );
89
+				$this->set_status($field_value, $use_default);
90 90
 				break;
91 91
 			default :
92
-				parent::set( $field_name, $field_value, $use_default );
92
+				parent::set($field_name, $field_value, $use_default);
93 93
 		}
94 94
 	}
95 95
 
@@ -106,30 +106,30 @@  discard block
 block discarded – undo
106 106
 	 * @param boolean $use_default
107 107
 	 * @return bool
108 108
 	 */
109
-	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
109
+	public function set_status($new_STS_ID = NULL, $use_default = FALSE) {
110 110
 		// get current REG_Status
111 111
 		$old_STS_ID = $this->status_ID();
112 112
 		// if status has changed
113
-		if ( $old_STS_ID != $new_STS_ID  ) {
113
+		if ($old_STS_ID != $new_STS_ID) {
114 114
 			// TO approved
115
-			if ( $new_STS_ID == EEM_Registration::status_id_approved ) {
115
+			if ($new_STS_ID == EEM_Registration::status_id_approved) {
116 116
 				// reserve a space by incrementing ticket and datetime sold values
117 117
 				$this->_reserve_registration_space();
118
-				do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID );
118
+				do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID);
119 119
 			// OR FROM  approved
120
-			} else if ( $old_STS_ID == EEM_Registration::status_id_approved ) {
120
+			} else if ($old_STS_ID == EEM_Registration::status_id_approved) {
121 121
 				// release a space by decrementing ticket and datetime sold values
122 122
 				$this->_release_registration_space();
123
-				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
123
+				do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID);
124 124
 			}
125 125
 			// update status
126
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
127
-			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
126
+			parent::set('STS_ID', $new_STS_ID, $use_default);
127
+			do_action('AHEE__EE_Registration__set_status__after_update', $this);
128 128
 			return TRUE;
129
-		}else{
129
+		} else {
130 130
 			//even though the old value matches the new value, it's still good to
131 131
 			//allow the parent set method to have a say
132
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
132
+			parent::set('STS_ID', $new_STS_ID, $use_default);
133 133
 			return TRUE;
134 134
 		}
135 135
 	}
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @access        public
142 142
 	 */
143 143
 	public function status_ID() {
144
-		return $this->get( 'STS_ID' );
144
+		return $this->get('STS_ID');
145 145
 	}
146 146
 
147 147
 
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
 	 * @param boolean $include_archived whether to include archived tickets or not.
167 167
 	 * @return EE_Ticket
168 168
 	 */
169
-	public function ticket( $include_archived = TRUE ) {
169
+	public function ticket($include_archived = TRUE) {
170 170
 		$query_params = array();
171
-		if ( $include_archived ) {
172
-			$query_params[ 'default_where_conditions' ] = 'none';
171
+		if ($include_archived) {
172
+			$query_params['default_where_conditions'] = 'none';
173 173
 		}
174
-		return $this->get_first_related( 'Ticket', $query_params );
174
+		return $this->get_first_related('Ticket', $query_params);
175 175
 	}
176 176
 
177 177
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @return EE_Event
182 182
 	 */
183 183
 	public function event() {
184
-		return $this->get_first_related( 'Event' );
184
+		return $this->get_first_related('Event');
185 185
 	}
186 186
 
187 187
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function wp_user() {
197 197
 		$event = $this->event();
198
-		if ( $event instanceof EE_Event ) {
198
+		if ($event instanceof EE_Event) {
199 199
 			return $event->wp_user();
200 200
 		}
201 201
 		return 0;
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 * @access        public
222 222
 	 * @param        int $ATT_ID Attendee ID
223 223
 	 */
224
-	public function set_attendee_id( $ATT_ID = 0 ) {
225
-		$this->set( 'ATT_ID', $ATT_ID );
224
+	public function set_attendee_id($ATT_ID = 0) {
225
+		$this->set('ATT_ID', $ATT_ID);
226 226
 	}
227 227
 
228 228
 
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @access        public
234 234
 	 * @param        int $TXN_ID Transaction ID
235 235
 	 */
236
-	public function set_transaction_id( $TXN_ID = 0 ) {
237
-		$this->set( 'TXN_ID', $TXN_ID );
236
+	public function set_transaction_id($TXN_ID = 0) {
237
+		$this->set('TXN_ID', $TXN_ID);
238 238
 	}
239 239
 
240 240
 
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 	 * @access    public
246 246
 	 * @param    string $REG_session PHP Session ID
247 247
 	 */
248
-	public function set_session( $REG_session = '' ) {
249
-		$this->set( 'REG_session', $REG_session );
248
+	public function set_session($REG_session = '') {
249
+		$this->set('REG_session', $REG_session);
250 250
 	}
251 251
 
252 252
 
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 	 * @access    public
258 258
 	 * @param    string $REG_url_link Registration URL Link
259 259
 	 */
260
-	public function set_reg_url_link( $REG_url_link = '' ) {
261
-		$this->set( 'REG_url_link', $REG_url_link );
260
+	public function set_reg_url_link($REG_url_link = '') {
261
+		$this->set('REG_url_link', $REG_url_link);
262 262
 	}
263 263
 
264 264
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 * @access        public
270 270
 	 * @param        int $REG_count Primary Attendee
271 271
 	 */
272
-	public function set_count( $REG_count = 1 ) {
273
-		$this->set( 'REG_count', $REG_count );
272
+	public function set_count($REG_count = 1) {
273
+		$this->set('REG_count', $REG_count);
274 274
 	}
275 275
 
276 276
 
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 	 * @access        public
282 282
 	 * @param        boolean $REG_group_size Group Registration
283 283
 	 */
284
-	public function set_group_size( $REG_group_size = FALSE ) {
285
-		$this->set( 'REG_group_size', $REG_group_size );
284
+	public function set_group_size($REG_group_size = FALSE) {
285
+		$this->set('REG_group_size', $REG_group_size);
286 286
 	}
287 287
 
288 288
 
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 	 * @access        public
366 366
 	 * @param        mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date
367 367
 	 */
368
-	public function set_reg_date( $REG_date = FALSE ) {
369
-		$this->set( 'REG_date', $REG_date );
368
+	public function set_reg_date($REG_date = FALSE) {
369
+		$this->set('REG_date', $REG_date);
370 370
 	}
371 371
 
372 372
 
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	 * @access    public
378 378
 	 * @param    float $REG_final_price
379 379
 	 */
380
-	public function set_final_price( $REG_final_price = 0.00 ) {
381
-		$this->set( 'REG_final_price', $REG_final_price );
380
+	public function set_final_price($REG_final_price = 0.00) {
381
+		$this->set('REG_final_price', $REG_final_price);
382 382
 	}
383 383
 
384 384
 
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
 	 * @access    public
390 390
 	 * @param    float $REG_paid
391 391
 	 */
392
-	public function set_paid( $REG_paid = 0.00 ) {
393
-		$this->set( 'REG_paid', $REG_paid );
392
+	public function set_paid($REG_paid = 0.00) {
393
+		$this->set('REG_paid', $REG_paid);
394 394
 	}
395 395
 
396 396
 
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
 	 * @access        public
402 402
 	 * @param        boolean $REG_att_is_going Attendee Is Going
403 403
 	 */
404
-	public function set_att_is_going( $REG_att_is_going = FALSE ) {
405
-		$this->set( 'REG_att_is_going', $REG_att_is_going );
404
+	public function set_att_is_going($REG_att_is_going = FALSE) {
405
+		$this->set('REG_att_is_going', $REG_att_is_going);
406 406
 	}
407 407
 
408 408
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * @return EE_Attendee
413 413
 	 */
414 414
 	public function attendee() {
415
-		return $this->get_first_related( 'Attendee' );
415
+		return $this->get_first_related('Attendee');
416 416
 	}
417 417
 
418 418
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 * @access        public
423 423
 	 */
424 424
 	public function event_ID() {
425
-		return $this->get( 'EVT_ID' );
425
+		return $this->get('EVT_ID');
426 426
 	}
427 427
 
428 428
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	 */
434 434
 	public function event_name() {
435 435
 		$event = $this->event_obj();
436
-		if ( $event ) {
436
+		if ($event) {
437 437
 			return $event->name();
438 438
 		} else {
439 439
 			return NULL;
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 * @return EE_Event
448 448
 	 */
449 449
 	public function event_obj() {
450
-		return $this->get_first_related( 'Event' );
450
+		return $this->get_first_related('Event');
451 451
 	}
452 452
 
453 453
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 * @access        public
458 458
 	 */
459 459
 	public function attendee_ID() {
460
-		return $this->get( 'ATT_ID' );
460
+		return $this->get('ATT_ID');
461 461
 	}
462 462
 
463 463
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 	 * @access        public
468 468
 	 */
469 469
 	public function session_ID() {
470
-		return $this->get( 'REG_session' );
470
+		return $this->get('REG_session');
471 471
 	}
472 472
 
473 473
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
478 478
 	 * @return string
479 479
 	 */
480
-	public function receipt_url( $messenger = 'html' ) {
480
+	public function receipt_url($messenger = 'html') {
481 481
 
482 482
 		/**
483 483
 		 * The below will be deprecated one version after this.  We check first if there is a custom receipt template already in use on old system.  If there is then we just return the standard url for it.
@@ -486,12 +486,12 @@  discard block
 block discarded – undo
486 486
 		 */
487 487
 		EE_Registry::instance()->load_helper('Template');
488 488
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php';
489
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
489
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
490 490
 
491
-		if ( $has_custom ) {
492
-			return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) );
491
+		if ($has_custom) {
492
+			return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch'));
493 493
 		}
494
-		return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' );
494
+		return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt');
495 495
 	}
496 496
 
497 497
 
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
503 503
 	 * @return string
504 504
 	 */
505
-	public function invoice_url( $messenger = 'html' ) {
505
+	public function invoice_url($messenger = 'html') {
506 506
 		/**
507 507
 		 * The below will be deprecated one version after this.  We check first if there is a custom invoice template already in use on old system.  If there is then we just return the standard url for it.
508 508
 		 *
@@ -510,21 +510,21 @@  discard block
 block discarded – undo
510 510
 		 */
511 511
 		EE_Registry::instance()->load_helper('Template');
512 512
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php';
513
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
513
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
514 514
 
515
-		if ( $has_custom ) {
516
-			if ( $messenger == 'html' ) {
517
-				return $this->invoice_url( 'launch' );
515
+		if ($has_custom) {
516
+			if ($messenger == 'html') {
517
+				return $this->invoice_url('launch');
518 518
 			}
519 519
 			$route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice';
520 520
 
521
-			$query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() );
522
-			if ( $messenger == 'html' ) {
521
+			$query_args = array('ee' => $route, 'id' => $this->reg_url_link());
522
+			if ($messenger == 'html') {
523 523
 				$query_args['html'] = TRUE;
524 524
 			}
525
-			return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) );
525
+			return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
526 526
 		}
527
-		return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' );
527
+		return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice');
528 528
 	}
529 529
 
530 530
 
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	 * @access        public
535 535
 	 */
536 536
 	public function reg_url_link() {
537
-		return $this->get( 'REG_url_link' );
537
+		return $this->get('REG_url_link');
538 538
 	}
539 539
 
540 540
 
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	 * @param string $type 'download','launch', or 'html' (default is 'launch')
545 545
 	 * @return void
546 546
 	 */
547
-	public function e_invoice_url( $type = 'launch' ) {
548
-		echo $this->invoice_url( $type );
547
+	public function e_invoice_url($type = 'launch') {
548
+		echo $this->invoice_url($type);
549 549
 	}
550 550
 
551 551
 
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 	 * @return string
566 566
 	 */
567 567
 	public function payment_overview_url() {
568
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
568
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
569 569
 	}
570 570
 
571 571
 
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	 * @return string
577 577
 	 */
578 578
 	public function edit_attendee_information_url() {
579
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
579
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
580 580
 	}
581 581
 
582 582
 
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
 	 * @return string
587 587
 	 */
588 588
 	public function get_admin_edit_url() {
589
-		EE_Registry::instance()->load_helper( 'URL' );
590
-		return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) );
589
+		EE_Registry::instance()->load_helper('URL');
590
+		return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php'));
591 591
 	}
592 592
 
593 593
 
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 	 * @access        public
598 598
 	 */
599 599
 	public function is_primary_registrant() {
600
-		return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE;
600
+		return $this->get('REG_count') == 1 ? TRUE : FALSE;
601 601
 	}
602 602
 
603 603
 
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
 	 * This returns the primary registration object for this registration group (which may be this object).
607 607
 	 * @return EE_Registration
608 608
 	 */
609
-	public function get_primary_registration()  {
610
-		if ( $this->is_primary_registrant() )
609
+	public function get_primary_registration() {
610
+		if ($this->is_primary_registrant())
611 611
 			return $this;
612 612
 
613 613
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
614
-		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
614
+		$primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1)));
615 615
 		return $primary_registrant;
616 616
 	}
617 617
 
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	* 		@access		public
623 623
 	*/
624 624
 	public function count() {
625
-		return $this->get( 'REG_count' );
625
+		return $this->get('REG_count');
626 626
 	}
627 627
 
628 628
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 	 * @access        public
633 633
 	 */
634 634
 	public function group_size() {
635
-		return $this->get( 'REG_group_size' );
635
+		return $this->get('REG_group_size');
636 636
 	}
637 637
 
638 638
 
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 	 * @access        public
643 643
 	 */
644 644
 	public function date() {
645
-		return $this->get( 'REG_date' );
645
+		return $this->get('REG_date');
646 646
 	}
647 647
 
648 648
 
@@ -653,8 +653,8 @@  discard block
 block discarded – undo
653 653
 	 * @param string $time_format
654 654
 	 * @return string
655 655
 	 */
656
-	public function pretty_date( $date_format = NULL, $time_format = NULL ) {
657
-		return $this->get_datetime( 'REG_date', $date_format, $time_format );
656
+	public function pretty_date($date_format = NULL, $time_format = NULL) {
657
+		return $this->get_datetime('REG_date', $date_format, $time_format);
658 658
 	}
659 659
 
660 660
 
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 	 * @return    float
668 668
 	 */
669 669
 	public function final_price() {
670
-		return $this->get( 'REG_final_price' );
670
+		return $this->get('REG_final_price');
671 671
 	}
672 672
 
673 673
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 	 * @return string
679 679
 	 */
680 680
 	public function pretty_final_price() {
681
-		return $this->get_pretty( 'REG_final_price' );
681
+		return $this->get_pretty('REG_final_price');
682 682
 	}
683 683
 
684 684
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 	 * @return 	float
690 690
 	 */
691 691
 	public function paid() {
692
-		return $this->get( 'REG_paid' );
692
+		return $this->get('REG_paid');
693 693
 	}
694 694
 
695 695
 
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	 * @return 	float
701 701
 	 */
702 702
 	public function pretty_paid() {
703
-		return $this->get_pretty( 'REG_paid' );
703
+		return $this->get_pretty('REG_paid');
704 704
 	}
705 705
 
706 706
 
@@ -712,11 +712,11 @@  discard block
 block discarded – undo
712 712
 	 * @param array $requires_payment
713 713
 	 * @return bool
714 714
 	 */
715
-	public function owes_monies_and_can_pay( $requires_payment = array()) {
715
+	public function owes_monies_and_can_pay($requires_payment = array()) {
716 716
 		// these reg statuses require payment (if event is not free)
717
-		$requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
717
+		$requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
718 718
 		if (
719
-			in_array( $this->status_ID(), $requires_payment ) &&
719
+			in_array($this->status_ID(), $requires_payment) &&
720 720
 			$this->final_price() != 0 &&
721 721
 			$this->final_price() != $this->paid()
722 722
 		) {
@@ -733,8 +733,8 @@  discard block
 block discarded – undo
733 733
 	 * @param bool $show_icons
734 734
 	 * @return void
735 735
 	 */
736
-	public function e_pretty_status( $show_icons = FALSE ) {
737
-		echo $this->pretty_status( $show_icons );
736
+	public function e_pretty_status($show_icons = FALSE) {
737
+		echo $this->pretty_status($show_icons);
738 738
 	}
739 739
 
740 740
 
@@ -745,10 +745,10 @@  discard block
 block discarded – undo
745 745
 	 * @param bool $show_icons
746 746
 	 * @return string
747 747
 	 */
748
-	public function pretty_status( $show_icons = FALSE ) {
749
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
748
+	public function pretty_status($show_icons = FALSE) {
749
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
750 750
 		$icon = '';
751
-		switch ( $this->status_ID() ) {
751
+		switch ($this->status_ID()) {
752 752
 			case EEM_Registration::status_id_approved:
753 753
 				$icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : '';
754 754
 				break;
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 				$icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : '';
769 769
 				break;
770 770
 		}
771
-		return $icon . $status[ $this->status_ID() ];
771
+		return $icon.$status[$this->status_ID()];
772 772
 	}
773 773
 
774 774
 
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 	 * @access        public
779 779
 	 */
780 780
 	public function att_is_going() {
781
-		return $this->get( 'REG_att_is_going' );
781
+		return $this->get('REG_att_is_going');
782 782
 	}
783 783
 
784 784
 
@@ -788,8 +788,8 @@  discard block
 block discarded – undo
788 788
 	 * @param array $query_params like EEM_Base::get_all
789 789
 	 * @return EE_Answer[]
790 790
 	 */
791
-	public function answers( $query_params = NULL ) {
792
-		return $this->get_many_related( 'Answer', $query_params );
791
+	public function answers($query_params = NULL) {
792
+		return $this->get_many_related('Answer', $query_params);
793 793
 	}
794 794
 
795 795
 
@@ -803,9 +803,9 @@  discard block
 block discarded – undo
803 803
 	 * (because the answer might be an array of answer values, so passing pretty_value=true
804 804
 	 * will convert it into some kind of string)
805 805
 	 */
806
-	public function answer_value_to_question( $question, $pretty_value=true ) {
806
+	public function answer_value_to_question($question, $pretty_value = true) {
807 807
 		$question_id = EEM_Question::instance()->ensure_is_ID($question);
808
-		return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value);
808
+		return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value);
809 809
 	}
810 810
 
811 811
 
@@ -818,13 +818,13 @@  discard block
 block discarded – undo
818 818
 	 */
819 819
 	public function question_groups() {
820 820
 		$question_groups = array();
821
-		if ( $this->event() instanceof EE_Event ) {
821
+		if ($this->event() instanceof EE_Event) {
822 822
 			$question_groups = $this->event()->question_groups(
823 823
 				array(
824 824
 					array(
825 825
 						'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false
826 826
 					),
827
-					'order_by' => array( 'QSG_order' => 'ASC' )
827
+					'order_by' => array('QSG_order' => 'ASC')
828 828
 				)
829 829
 			);
830 830
 		}
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 	 */
842 842
 	public function count_question_groups() {
843 843
 		$qg_count = 0;
844
-		if ( $this->event() instanceof EE_Event ) {
844
+		if ($this->event() instanceof EE_Event) {
845 845
 			$qg_count = $this->event()->count_related(
846 846
 				'Question_Group',
847 847
 				array(
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 	 * @return string
863 863
 	 */
864 864
 	public function reg_date() {
865
-		return $this->get_datetime( 'REG_date' );
865
+		return $this->get_datetime('REG_date');
866 866
 	}
867 867
 
868 868
 
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 	 * @return EE_Datetime_Ticket
875 875
 	 */
876 876
 	public function datetime_ticket() {
877
-		return $this->get_first_related( 'Datetime_Ticket' );
877
+		return $this->get_first_related('Datetime_Ticket');
878 878
 	}
879 879
 
880 880
 
@@ -884,15 +884,15 @@  discard block
 block discarded – undo
884 884
 	 * @param EE_Datetime_Ticket $datetime_ticket
885 885
 	 * @return EE_Datetime_Ticket
886 886
 	 */
887
-	public function set_datetime_ticket( $datetime_ticket ) {
888
-		return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' );
887
+	public function set_datetime_ticket($datetime_ticket) {
888
+		return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket');
889 889
 	}
890 890
 	/**
891 891
 	 * Gets deleted
892 892
 	 * @return boolean
893 893
 	 */
894 894
 	public function deleted() {
895
-		return $this->get( 'REG_deleted' );
895
+		return $this->get('REG_deleted');
896 896
 	}
897 897
 
898 898
 	/**
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 	 * @return boolean
902 902
 	 */
903 903
 	public function set_deleted($deleted) {
904
-		$this->set( 'REG_deleted', $deleted );
904
+		$this->set('REG_deleted', $deleted);
905 905
 	}
906 906
 
907 907
 
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
 	 * @return EE_Status
912 912
 	 */
913 913
 	public function status_obj() {
914
-		return $this->get_first_related( 'Status' );
914
+		return $this->get_first_related('Status');
915 915
 	}
916 916
 
917 917
 
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 	 * @return int
923 923
 	 */
924 924
 	public function count_checkins() {
925
-		return $this->get_model()->count_related( $this, 'Checkin' );
925
+		return $this->get_model()->count_related($this, 'Checkin');
926 926
 	}
927 927
 
928 928
 
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 	 * @return int
933 933
 	 */
934 934
 	public function count_checkins_not_checkedout() {
935
-		return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) );
935
+		return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1)));
936 936
 	}
937 937
 
938 938
 
@@ -945,20 +945,20 @@  discard block
 block discarded – undo
945 945
 	 *
946 946
 	 * @return bool
947 947
 	 */
948
-	public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) {
949
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
948
+	public function can_checkin($DTT_OR_ID, $check_approved = TRUE) {
949
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
950 950
 
951 951
 		//first check registration status
952
-		if (  ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) {
952
+		if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) {
953 953
 			return false;
954 954
 		}
955 955
 		//is there a datetime ticket that matches this dtt_ID?
956
-		if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) {
956
+		if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) {
957 957
 			return false;
958 958
 		}
959 959
 
960 960
 		//final check is against TKT_uses
961
-		return $this->verify_can_checkin_against_TKT_uses( $DTT_ID );
961
+		return $this->verify_can_checkin_against_TKT_uses($DTT_ID);
962 962
 	}
963 963
 
964 964
 
@@ -971,10 +971,10 @@  discard block
 block discarded – undo
971 971
 	 * @param int | EE_Datetime  $DTT_OR_ID  The datetime the registration is being checked against
972 972
 	 * @return bool   true means can checkin.  false means cannot checkin.
973 973
 	 */
974
-	public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) {
975
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
974
+	public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) {
975
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
976 976
 
977
-		if ( ! $DTT_ID ) {
977
+		if ( ! $DTT_ID) {
978 978
 			return false;
979 979
 		}
980 980
 
@@ -982,23 +982,23 @@  discard block
 block discarded – undo
982 982
 
983 983
 		// if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in
984 984
 		// or not.
985
-		if ( ! $max_uses || $max_uses === EE_INF ) {
985
+		if ( ! $max_uses || $max_uses === EE_INF) {
986 986
 			return true;
987 987
 		}
988 988
 
989 989
 		//does this datetime have a checkin record?  If so, then the dtt count has already been verified so we can just
990 990
 		//go ahead and toggle.
991
-		if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) {
991
+		if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) {
992 992
 			return true;
993 993
 		}
994 994
 
995 995
 		//made it here so the last check is whether the number of checkins per unique datetime on this registration
996 996
 		//disallows further check-ins.
997
-		$count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true );
997
+		$count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true);
998 998
 		// checkins have already reached their max number of uses
999 999
 		// so registrant can NOT checkin
1000
-		if ( $count_unique_dtt_checkins >= $max_uses ) {
1001
-			EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1000
+		if ($count_unique_dtt_checkins >= $max_uses) {
1001
+			EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1002 1002
 			return false;
1003 1003
 		}
1004 1004
 		return true;
@@ -1019,15 +1019,15 @@  discard block
 block discarded – undo
1019 1019
 	 * @param  bool $verify  If true then can_checkin() is used to verify whether the person can be checked in or not.  Otherwise this forces change in checkin status.
1020 1020
 	 * @return int|BOOL            the chk_in status toggled to OR false if nothing got changed.
1021 1021
 	 */
1022
-	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1023
-		if ( empty( $DTT_ID ) ) {
1022
+	public function toggle_checkin_status($DTT_ID = null, $verify = false) {
1023
+		if (empty($DTT_ID)) {
1024 1024
 			$datetime = $this->get_related_primary_datetime();
1025 1025
 			$DTT_ID = $datetime->ID();
1026 1026
 		// verify the registration can checkin for the given DTT_ID
1027
-		} elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) {
1027
+		} elseif ( ! $this->can_checkin($DTT_ID, $verify)) {
1028 1028
 			EE_Error::add_error(
1029 1029
 					sprintf(
1030
-						__( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1030
+						__('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1031 1031
 						$this->ID(),
1032 1032
 						$DTT_ID
1033 1033
 					),
@@ -1041,8 +1041,8 @@  discard block
 block discarded – undo
1041 1041
 			EE_Registration::checkin_status_out => EE_Registration::checkin_status_in
1042 1042
 		);
1043 1043
 		//start by getting the current status so we know what status we'll be changing to.
1044
-		$cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL );
1045
-		$status_to = $status_paths[ $cur_status ];
1044
+		$cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL);
1045
+		$status_to = $status_paths[$cur_status];
1046 1046
 		// database only records true for checked IN or false for checked OUT
1047 1047
 		// no record ( null ) means checked in NEVER, but we obviously don't save that
1048 1048
 		$new_status = $status_to == EE_Registration::checkin_status_in ? true : false;
@@ -1050,24 +1050,24 @@  discard block
 block discarded – undo
1050 1050
 		// because we are keeping track of Check-ins over time.
1051 1051
 		// Eventually we'll probably want to show a list table
1052 1052
 		// for the individual Check-ins so that they can be managed.
1053
-		$checkin = EE_Checkin::new_instance( array(
1053
+		$checkin = EE_Checkin::new_instance(array(
1054 1054
 				'REG_ID' => $this->ID(),
1055 1055
 				'DTT_ID' => $DTT_ID,
1056 1056
 				'CHK_in' => $new_status
1057
-		) );
1057
+		));
1058 1058
 		// if the record could not be saved then return false
1059
-		if ( $checkin->save() === 0 ) {
1060
-			if ( WP_DEBUG ) {
1059
+		if ($checkin->save() === 0) {
1060
+			if (WP_DEBUG) {
1061 1061
 				global $wpdb;
1062 1062
 				$error = sprintf(
1063
-					__( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ),
1063
+					__('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'),
1064 1064
 					'<br />',
1065 1065
 					$wpdb->last_error
1066 1066
 				);
1067 1067
 			} else {
1068
-				$error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' );
1068
+				$error = __('Registration check in update failed because of an unknown database error', 'event_espresso');
1069 1069
 			}
1070
-			EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
1070
+			EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
1071 1071
 			return false;
1072 1072
 		}
1073 1073
 		return $status_to;
@@ -1091,19 +1091,19 @@  discard block
 block discarded – undo
1091 1091
 	 * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1092 1092
 	 * @return int            Integer representing Check-in status.
1093 1093
 	 */
1094
-	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) {
1095
-		if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) {
1094
+	public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) {
1095
+		if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) {
1096 1096
 			$datetime = $this->get_related_primary_datetime();
1097
-			if ( ! $datetime instanceof EE_Datetime ) {
1097
+			if ( ! $datetime instanceof EE_Datetime) {
1098 1098
 				return 0;
1099 1099
 			}
1100 1100
 			$DTT_ID = $datetime->ID();
1101 1101
 		//verify the registration can checkin for the given DTT_ID
1102 1102
 		}
1103 1103
 		//get checkin object (if exists)
1104
-		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) );
1105
-		if ( $checkin instanceof EE_Checkin ) {
1106
-			if ( $checkin->get( 'CHK_in' ) ) {
1104
+		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC')));
1105
+		if ($checkin instanceof EE_Checkin) {
1106
+			if ($checkin->get('CHK_in')) {
1107 1107
 				return EE_Registration::checkin_status_in; //checked in
1108 1108
 			} else {
1109 1109
 				return EE_Registration::checkin_status_out; //had checked in but is now checked out.
@@ -1121,28 +1121,28 @@  discard block
 block discarded – undo
1121 1121
 	 * @param bool $error  This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name.
1122 1122
 	 * @return string         internationalized message
1123 1123
 	 */
1124
-	public function get_checkin_msg( $DTT_ID, $error = FALSE ) {
1124
+	public function get_checkin_msg($DTT_ID, $error = FALSE) {
1125 1125
 		//let's get the attendee first so we can include the name of the attendee
1126
-		$attendee = $this->get_first_related( 'Attendee' );
1127
-		if ( $attendee instanceof EE_Attendee ) {
1128
-			if ( $error ) {
1129
-				return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() );
1126
+		$attendee = $this->get_first_related('Attendee');
1127
+		if ($attendee instanceof EE_Attendee) {
1128
+			if ($error) {
1129
+				return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name());
1130 1130
 			}
1131
-			$cur_status = $this->check_in_status_for_datetime( $DTT_ID );
1131
+			$cur_status = $this->check_in_status_for_datetime($DTT_ID);
1132 1132
 			//what is the status message going to be?
1133
-			switch ( $cur_status ) {
1133
+			switch ($cur_status) {
1134 1134
 				case EE_Registration::checkin_status_never :
1135
-					return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() );
1135
+					return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name());
1136 1136
 					break;
1137 1137
 				case EE_Registration::checkin_status_in :
1138
-					return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() );
1138
+					return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name());
1139 1139
 					break;
1140 1140
 				case EE_Registration::checkin_status_out :
1141
-					return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() );
1141
+					return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name());
1142 1142
 					break;
1143 1143
 			}
1144 1144
 		}
1145
-		return __( "The check-in status could not be determined.", "event_espresso" );
1145
+		return __("The check-in status could not be determined.", "event_espresso");
1146 1146
 	}
1147 1147
 
1148 1148
 
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 	 * @return EE_Transaction
1153 1153
 	 */
1154 1154
 	public function transaction() {
1155
-		return $this->get_first_related( 'Transaction' );
1155
+		return $this->get_first_related('Transaction');
1156 1156
 	}
1157 1157
 
1158 1158
 
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
 	 * @access        public
1164 1164
 	 */
1165 1165
 	public function reg_code() {
1166
-		return $this->get( 'REG_code' );
1166
+		return $this->get('REG_code');
1167 1167
 	}
1168 1168
 
1169 1169
 
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 	 * @access        public
1174 1174
 	 */
1175 1175
 	public function transaction_ID() {
1176
-		return $this->get( 'TXN_ID' );
1176
+		return $this->get('TXN_ID');
1177 1177
 	}
1178 1178
 
1179 1179
 
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 	 * @return int
1183 1183
 	 */
1184 1184
 	public function ticket_ID() {
1185
-		return $this->get( 'TKT_ID' );
1185
+		return $this->get('TKT_ID');
1186 1186
 	}
1187 1187
 
1188 1188
 
@@ -1194,17 +1194,17 @@  discard block
 block discarded – undo
1194 1194
 	 * @param    string $REG_code Registration Code
1195 1195
 	 * @param	boolean $use_default
1196 1196
 	 */
1197
-	public function set_reg_code( $REG_code, $use_default = FALSE ) {
1198
-		if ( empty( $REG_code )) {
1199
-			EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1197
+	public function set_reg_code($REG_code, $use_default = FALSE) {
1198
+		if (empty($REG_code)) {
1199
+			EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1200 1200
 			return;
1201 1201
 		}
1202
-		if ( ! $this->reg_code() ) {
1203
-			parent::set( 'REG_code', $REG_code, $use_default );
1202
+		if ( ! $this->reg_code()) {
1203
+			parent::set('REG_code', $REG_code, $use_default);
1204 1204
 		} else {
1205 1205
 			EE_Error::doing_it_wrong(
1206
-				__CLASS__ . '::' . __FUNCTION__,
1207
-				__( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ),
1206
+				__CLASS__.'::'.__FUNCTION__,
1207
+				__('Can not change a registration REG_code once it has been set.', 'event_espresso'),
1208 1208
 				'4.6.0'
1209 1209
 			);
1210 1210
 		}
@@ -1224,17 +1224,17 @@  discard block
 block discarded – undo
1224 1224
 	 * @return EE_Registration[]  or empty array if this isn't a group registration.
1225 1225
 	 */
1226 1226
 	public function get_all_other_registrations_in_group() {
1227
-		if ( $this->group_size() < 2 ) {
1227
+		if ($this->group_size() < 2) {
1228 1228
 			return array();
1229 1229
 		}
1230 1230
 
1231 1231
 		$query[0] = array(
1232 1232
 			'TXN_ID' => $this->transaction_ID(),
1233
-			'REG_ID' => array( '!=', $this->ID() ),
1233
+			'REG_ID' => array('!=', $this->ID()),
1234 1234
 			'TKT_ID' => $this->ticket_ID()
1235 1235
 			);
1236 1236
 
1237
-		$registrations = $this->get_model()->get_all( $query );
1237
+		$registrations = $this->get_model()->get_all($query);
1238 1238
 		return $registrations;
1239 1239
 	}
1240 1240
 
@@ -1244,8 +1244,8 @@  discard block
 block discarded – undo
1244 1244
 	 * @param array $query_params
1245 1245
 	 * @return \EE_Registration[]
1246 1246
 	 */
1247
-	public function payments( $query_params = array() ) {
1248
-		return $this->get_many_related( 'Payment', $query_params );
1247
+	public function payments($query_params = array()) {
1248
+		return $this->get_many_related('Payment', $query_params);
1249 1249
 	}
1250 1250
 
1251 1251
 
@@ -1254,8 +1254,8 @@  discard block
 block discarded – undo
1254 1254
 	 * @param array $query_params
1255 1255
 	 * @return \EE_Registration[]
1256 1256
 	 */
1257
-	public function registration_payments( $query_params = array() ) {
1258
-		return $this->get_many_related( 'Registration_Payment', $query_params );
1257
+	public function registration_payments($query_params = array()) {
1258
+		return $this->get_many_related('Registration_Payment', $query_params);
1259 1259
 	}
1260 1260
 
1261 1261
 
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
 	 * @access 	public
1267 1267
 	 */
1268 1268
 	public function price_paid() {
1269
-		EE_Error::doing_it_wrong( 'EE_Registration::price_paid()', __( 'This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso' ), '4.7.0' );
1269
+		EE_Error::doing_it_wrong('EE_Registration::price_paid()', __('This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso'), '4.7.0');
1270 1270
 		return $this->final_price();
1271 1271
 	}
1272 1272
 
@@ -1278,9 +1278,9 @@  discard block
 block discarded – undo
1278 1278
 	 * @access    public
1279 1279
 	 * @param    float $REG_final_price
1280 1280
 	 */
1281
-	public function set_price_paid( $REG_final_price = 0.00 ) {
1282
-		EE_Error::doing_it_wrong( 'EE_Registration::set_price_paid()', __( 'This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso' ), '4.7.0' );
1283
-		$this->set_final_price( $REG_final_price );
1281
+	public function set_price_paid($REG_final_price = 0.00) {
1282
+		EE_Error::doing_it_wrong('EE_Registration::set_price_paid()', __('This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso'), '4.7.0');
1283
+		$this->set_final_price($REG_final_price);
1284 1284
 	}
1285 1285
 
1286 1286
 
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 	 * @return string
1292 1292
 	 */
1293 1293
 	public function pretty_price_paid() {
1294
-		EE_Error::doing_it_wrong( 'EE_Registration::pretty_price_paid()', __( 'This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso' ), '4.7.0' );
1294
+		EE_Error::doing_it_wrong('EE_Registration::pretty_price_paid()', __('This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso'), '4.7.0');
1295 1295
 		return $this->pretty_final_price();
1296 1296
 	}
1297 1297
 
Please login to merge, or discard this patch.
core/admin/templates/admin_details_wrapper.template.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 global $post_type, $post;
3 3
 //action for registering metaboxes
4
-do_action( 'add_meta_boxes', $post_type, $post );
4
+do_action('add_meta_boxes', $post_type, $post);
5 5
 ?>
6 6
 <div id="admin-page-header">
7 7
 	<?php echo $admin_page_header; ?>
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 		<!-- admin-page-header -->
11 11
 	<div id="post-body" class="metabox-holder columns-2">
12 12
 
13
-	<?php if ( ! empty( $post_body_content )) : ?>
13
+	<?php if ( ! empty($post_body_content)) : ?>
14 14
 		<div id="post-body-content">
15 15
 			<?php echo $post_body_content; ?>
16 16
 		</div>
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
 	<?php endif; ?>
19 19
 
20 20
 		<div id="postbox-container-1" class="postbox-container">
21
-			<?php do_meta_boxes( $current_page, 'side', NULL ); ?>
21
+			<?php do_meta_boxes($current_page, 'side', NULL); ?>
22 22
 		</div>
23 23
 		<!-- postbox-container-1 -->
24 24
 
25 25
 		<div id="postbox-container-2" class="postbox-container">
26
-			<?php do_meta_boxes( $current_page, 'normal', NULL ); ?>
27
-			<?php do_meta_boxes( $current_page, 'advanced', NULL ); ?>
26
+			<?php do_meta_boxes($current_page, 'normal', NULL); ?>
27
+			<?php do_meta_boxes($current_page, 'advanced', NULL); ?>
28 28
 		</div>
29 29
 		<!-- postbox-container-2 -->
30 30
 
Please login to merge, or discard this patch.
libraries/line_item_display/EE_SPCO_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -69,104 +69,104 @@  discard block
 block discarded – undo
69 69
 	 * @param array        $options
70 70
 	 * @return mixed
71 71
 	 */
72
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
72
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
73 73
 
74
-		EE_Registry::instance()->load_helper( 'Template' );
75
-		EE_Registry::instance()->load_helper( 'HTML' );
74
+		EE_Registry::instance()->load_helper('Template');
75
+		EE_Registry::instance()->load_helper('HTML');
76 76
 
77 77
 		$html = '';
78 78
 		// set some default options and merge with incoming
79 79
 		$default_options = array(
80
-			'show_desc' => true,  // 	true 		false
80
+			'show_desc' => true, // 	true 		false
81 81
 			'odd' => false
82 82
 		);
83
-		$options = array_merge( $default_options, (array)$options );
83
+		$options = array_merge($default_options, (array) $options);
84 84
 
85
-		switch( $line_item->type() ) {
85
+		switch ($line_item->type()) {
86 86
 
87 87
 			case EEM_Line_Item::type_line_item:
88 88
 				$this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes;
89
-				if ( $line_item->OBJ_type() == 'Ticket' ) {
89
+				if ($line_item->OBJ_type() == 'Ticket') {
90 90
 					// item row
91
-					$html .= $this->_ticket_row( $line_item, $options );
91
+					$html .= $this->_ticket_row($line_item, $options);
92 92
 					// got any kids?
93
-					foreach ( $line_item->children() as $child_line_item ) {
94
-						$this->display_line_item( $child_line_item, $options );
93
+					foreach ($line_item->children() as $child_line_item) {
94
+						$this->display_line_item($child_line_item, $options);
95 95
 					}
96 96
 				} else {
97 97
 					// item row
98
-					$html .= $this->_item_row( $line_item, $options );
98
+					$html .= $this->_item_row($line_item, $options);
99 99
 					// got any kids?
100
-					foreach ( $line_item->children() as $child_line_item ) {
101
-						$this->display_line_item( $child_line_item, $options );
100
+					foreach ($line_item->children() as $child_line_item) {
101
+						$this->display_line_item($child_line_item, $options);
102 102
 					}
103 103
 				}
104 104
 				break;
105 105
 
106 106
 			case EEM_Line_Item::type_sub_line_item:
107
-				$html .= $this->_sub_item_row( $line_item, $options );
107
+				$html .= $this->_sub_item_row($line_item, $options);
108 108
 				break;
109 109
 
110 110
 			case EEM_Line_Item::type_sub_total:
111 111
 				static $sub_total = 0;
112 112
 				$event_sub_total = 0;
113
-				$text = __( 'Sub-Total', 'event_espresso' );
114
-				if ( $line_item->OBJ_type() == 'Event' ) {
115
-					$options[ 'event_id' ] = $event_id = $line_item->OBJ_ID();
116
-					if ( ! isset( $this->_events[ $options[ 'event_id' ] ] ) ) {
117
-						$event = EEM_Event::instance()->get_one_by_ID( $options[ 'event_id' ] );
118
-						if ( $event instanceof EE_Event ) {
119
-							if ( $event->default_registration_status() == EEM_Registration::status_id_not_approved ) {
113
+				$text = __('Sub-Total', 'event_espresso');
114
+				if ($line_item->OBJ_type() == 'Event') {
115
+					$options['event_id'] = $event_id = $line_item->OBJ_ID();
116
+					if ( ! isset($this->_events[$options['event_id']])) {
117
+						$event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
118
+						if ($event instanceof EE_Event) {
119
+							if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) {
120 120
 								return '';
121 121
 							}
122 122
 						}
123
-						$this->_events[ $options[ 'event_id' ] ] = 0;
124
-						$html .= $this->_event_row( $line_item );
125
-						$text = __( 'Event Sub-Total', 'event_espresso' );
123
+						$this->_events[$options['event_id']] = 0;
124
+						$html .= $this->_event_row($line_item);
125
+						$text = __('Event Sub-Total', 'event_espresso');
126 126
 					}
127 127
 				}
128 128
 				$child_line_items = $line_item->children();
129 129
 				// loop thru children
130
-				foreach( $child_line_items as $child_line_item ) {
130
+				foreach ($child_line_items as $child_line_item) {
131 131
 					// recursively feed children back into this method
132
-					$html .= $this->display_line_item( $child_line_item, $options );
132
+					$html .= $this->display_line_item($child_line_item, $options);
133 133
 				}
134
-				$event_sub_total += isset( $options[ 'event_id' ] ) ? $this->_events[ $options[ 'event_id' ] ] : 0;
134
+				$event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0;
135 135
 				$sub_total += $event_sub_total;
136 136
 				if (
137 137
 					(
138 138
 						// event subtotals
139 139
 						$line_item->code() != 'pre-tax-subtotal' &&
140
-						count( $child_line_items ) > 1
140
+						count($child_line_items) > 1
141 141
 					)
142 142
 					||
143 143
 					(
144 144
 						// pre-tax subtotals
145 145
 						$line_item->code() == 'pre-tax-subtotal' &&
146
-						count( $this->_events ) > 1
146
+						count($this->_events) > 1
147 147
 					)
148 148
 				) {
149 149
 					$options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total;
150
-					$html .= $this->_sub_total_row( $line_item, $text, $options );
150
+					$html .= $this->_sub_total_row($line_item, $text, $options);
151 151
 				}
152 152
 				break;
153 153
 
154 154
 			case EEM_Line_Item::type_tax:
155
-				if ( $this->_show_taxes ) {
156
-					$this->_taxes_html .= $this->_tax_row( $line_item, $options );
155
+				if ($this->_show_taxes) {
156
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
157 157
 				}
158 158
 				break;
159 159
 
160 160
 			case EEM_Line_Item::type_tax_sub_total:
161
-				if ( $this->_show_taxes ) {
161
+				if ($this->_show_taxes) {
162 162
 					$child_line_items = $line_item->children();
163 163
 					// loop thru children
164
-					foreach( $child_line_items as $child_line_item ) {
164
+					foreach ($child_line_items as $child_line_item) {
165 165
 						// recursively feed children back into this method
166
-						$html .= $this->display_line_item( $child_line_item, $options );
166
+						$html .= $this->display_line_item($child_line_item, $options);
167 167
 					}
168
-					if ( count( $child_line_items ) > 1 ) {
169
-						$this->_taxes_html .= $this->_total_tax_row( $line_item, __( 'Tax Total', 'event_espresso' ) );
168
+					if (count($child_line_items) > 1) {
169
+						$this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso'));
170 170
 					}
171 171
 				}
172 172
 				break;
@@ -175,25 +175,25 @@  discard block
 block discarded – undo
175 175
 				// get all child line items
176 176
 				$children = $line_item->children();
177 177
 				// loop thru all non-tax child line items
178
-				foreach( $children as $child_line_item ) {
179
-					if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) {
178
+				foreach ($children as $child_line_item) {
179
+					if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) {
180 180
 						// recursively feed children back into this method
181
-						$html .= $this->display_line_item( $child_line_item, $options );
181
+						$html .= $this->display_line_item($child_line_item, $options);
182 182
 					}
183 183
 				}
184 184
 
185 185
 				// now loop thru  tax child line items
186
-				foreach( $children as $child_line_item ) {
187
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) {
186
+				foreach ($children as $child_line_item) {
187
+					if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) {
188 188
 						// recursively feed children back into this method
189
-						$html .= $this->display_line_item( $child_line_item, $options );
189
+						$html .= $this->display_line_item($child_line_item, $options);
190 190
 					}
191 191
 				}
192 192
 				$html .= $this->_taxes_html;
193
-				$html .= $this->_total_row( $line_item, __('Total', 'event_espresso') );
193
+				$html .= $this->_total_row($line_item, __('Total', 'event_espresso'));
194 194
 
195 195
 
196
-				$html .= $this->_payments_and_amount_owing_rows( $line_item, $options );
196
+				$html .= $this->_payments_and_amount_owing_rows($line_item, $options);
197 197
 				break;
198 198
 
199 199
 		}
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	 * @param EE_Line_Item $line_item
209 209
 	 * @return mixed
210 210
 	 */
211
-	private function _event_row( EE_Line_Item $line_item ) {
211
+	private function _event_row(EE_Line_Item $line_item) {
212 212
 		// start of row
213
-		$html = EEH_HTML::tr( '', 'event-cart-total-row', 'total_tr odd' );
213
+		$html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd');
214 214
 		// event name td
215
-		$html .= EEH_HTML::td( EEH_HTML::strong( $line_item->name() ), '', 'event-header', '', ' colspan="4"' );
215
+		$html .= EEH_HTML::td(EEH_HTML::strong($line_item->name()), '', 'event-header', '', ' colspan="4"');
216 216
 		// end of row
217 217
 		$html .= EEH_HTML::trx();
218 218
 		return $html;
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
 	 * @param array        $options
228 228
 	 * @return mixed
229 229
 	 */
230
-	private function _ticket_row( EE_Line_Item $line_item, $options = array() ) {
230
+	private function _ticket_row(EE_Line_Item $line_item, $options = array()) {
231 231
 		// start of row
232 232
 		$row_class = $options['odd'] ? 'item odd' : 'item';
233
-		$html = EEH_HTML::tr( '', '', $row_class );
233
+		$html = EEH_HTML::tr('', '', $row_class);
234 234
 		// name && desc
235 235
 		$name_and_desc = apply_filters(
236 236
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
@@ -239,23 +239,23 @@  discard block
 block discarded – undo
239 239
 		);
240 240
 		$name_and_desc .= apply_filters(
241 241
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
242
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
242
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
243 243
 			$line_item,
244 244
 			$options
245 245
 		);
246 246
 		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
247 247
 		// name td
248
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l' );
248
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' );
249 249
 		// price td
250
-		$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
250
+		$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
251 251
 		// quantity td
252
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' );
252
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
253 253
 		$this->_total_items += $line_item->quantity();
254 254
 		// determine total for line item
255 255
 		$total = $line_item->total();
256
-		$this->_events[ $options[ 'event_id' ] ] += $total;
256
+		$this->_events[$options['event_id']] += $total;
257 257
 		// total td
258
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '',  'item_r jst-rght' );
258
+		$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght');
259 259
 		// end of row
260 260
 		$html .= EEH_HTML::trx();
261 261
 		return $html;
@@ -270,41 +270,41 @@  discard block
 block discarded – undo
270 270
 	 * @param array        $options
271 271
 	 * @return mixed
272 272
 	 */
273
-	private function _item_row( EE_Line_Item $line_item, $options = array() ) {
273
+	private function _item_row(EE_Line_Item $line_item, $options = array()) {
274 274
 		// start of row
275 275
 		$row_class = $options['odd'] ? 'item odd' : 'item';
276
-		$html = EEH_HTML::tr( '', '', $row_class );
277
-		$obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type() . ': ' : '';
276
+		$html = EEH_HTML::tr('', '', $row_class);
277
+		$obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type().': ' : '';
278 278
 		// name && desc
279 279
 		$name_and_desc = apply_filters(
280 280
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
281
-			 $obj_name . $line_item->name(),
281
+			 $obj_name.$line_item->name(),
282 282
 			$line_item
283 283
 		);
284 284
 		$name_and_desc .= apply_filters(
285 285
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
286
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
286
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
287 287
 			$line_item,
288 288
 			$options
289 289
 		);
290 290
 		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
291 291
 		// name td
292
-		$html .= EEH_HTML::td( $name_and_desc, '',  'item_l' );
292
+		$html .= EEH_HTML::td($name_and_desc, '', 'item_l');
293 293
 		// price td
294
-		if ( $line_item->is_percent() ) {
295
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c jst-rght' );
294
+		if ($line_item->is_percent()) {
295
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght');
296 296
 		} else {
297
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' );
297
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
298 298
 		}
299 299
 		// quantity td
300
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' );
300
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
301 301
 		//$total = $line_item->total() * $line_item->quantity();
302 302
 		$total = $line_item->total();
303
-		if( isset( $options[ 'event_id' ] ) && isset( $this->_events[ $options[ 'event_id' ] ] ) ) {
304
-			$this->_events[ $options[ 'event_id' ] ] += $total;
303
+		if (isset($options['event_id']) && isset($this->_events[$options['event_id']])) {
304
+			$this->_events[$options['event_id']] += $total;
305 305
 		}
306 306
 		// total td
307
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '',  'item_r jst-rght' );
307
+		$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght');
308 308
 		// end of row
309 309
 		$html .= EEH_HTML::trx();
310 310
 		return $html;
@@ -319,22 +319,22 @@  discard block
 block discarded – undo
319 319
 	 * @param array        $options
320 320
 	 * @return mixed
321 321
 	 */
322
-	private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
322
+	private function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
323 323
 		// start of row
324
-		$html = EEH_HTML::tr( '', 'item sub-item-row' );
324
+		$html = EEH_HTML::tr('', 'item sub-item-row');
325 325
 		// name && desc
326 326
 		$name_and_desc = $line_item->name();
327
-		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '';
327
+		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : '';
328 328
 		// name td
329
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
329
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
330 330
 		// discount/surcharge td
331
-		if ( $line_item->is_percent() ) {
332
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '',  'item_c' );
331
+		if ($line_item->is_percent()) {
332
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c');
333 333
 		} else {
334
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
334
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
335 335
 		}
336 336
 		// total td
337
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'item_r jst-rght' );
337
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
338 338
 		// end of row
339 339
 		$html .= EEH_HTML::trx();
340 340
 		return $html;
@@ -349,21 +349,21 @@  discard block
 block discarded – undo
349 349
 	 * @param array        $options
350 350
 	 * @return mixed
351 351
 	 */
352
-	private function _tax_row( EE_Line_Item $line_item, $options = array() ) {
352
+	private function _tax_row(EE_Line_Item $line_item, $options = array()) {
353 353
 		// start of row
354
-		$html = EEH_HTML::tr( '', 'item sub-item tax-total' );
354
+		$html = EEH_HTML::tr('', 'item sub-item tax-total');
355 355
 		// name && desc
356 356
 		$name_and_desc = $line_item->name();
357
-		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable items', 'event_espresso' ) . '</span>';
358
-		$name_and_desc .= $options[ 'show_desc' ] ? '<br/>' . $line_item->desc() : '';
357
+		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable items', 'event_espresso').'</span>';
358
+		$name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : '';
359 359
 		// name td
360
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
360
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
361 361
 		// percent td
362
-		$html .= EEH_HTML::td( $line_item->percent() . '%', '',  ' jst-rght', '' );
362
+		$html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', '');
363 363
 		// empty td (price)
364
-		$html .= EEH_HTML::td( EEH_HTML::nbsp() );
364
+		$html .= EEH_HTML::td(EEH_HTML::nbsp());
365 365
 		// total td
366
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'item_r jst-rght' );
366
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
367 367
 		// end of row
368 368
 		$html .= EEH_HTML::trx();
369 369
 		return $html;
@@ -378,17 +378,17 @@  discard block
 block discarded – undo
378 378
 	 * @param string $text
379 379
 	 * @return mixed
380 380
 	 */
381
-	private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) {
381
+	private function _total_tax_row(EE_Line_Item $line_item, $text = '') {
382 382
 		$html = '';
383
-		if ( $line_item->total() ) {
383
+		if ($line_item->total()) {
384 384
 			// start of row
385
-			$html = EEH_HTML::tr( '', '', 'total_tr odd' );
385
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
386 386
 			// total td
387
-			$html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="2"' );
387
+			$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="2"');
388 388
 			// empty td (price)
389
-			$html .= EEH_HTML::td( EEH_HTML::nbsp() );
389
+			$html .= EEH_HTML::td(EEH_HTML::nbsp());
390 390
 			// total td
391
-			$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' );
391
+			$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght');
392 392
 			// end of row
393 393
 			$html .= EEH_HTML::trx();
394 394
 		}
@@ -405,15 +405,15 @@  discard block
 block discarded – undo
405 405
 	 * @param array        $options
406 406
 	 * @return mixed
407 407
 	 */
408
-	private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
408
+	private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
409 409
 		$html = '';
410
-		if ( $line_item->total() ) {
410
+		if ($line_item->total()) {
411 411
 			// start of row
412
-			$html = EEH_HTML::tr( '', '', 'total_tr odd' );
412
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
413 413
 			// total td
414
-			$html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' );
414
+			$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
415 415
 			// total td
416
-			$html .= EEH_HTML::td( EEH_Template::format_currency( $options[ 'sub_total' ], false, false ), '', 'total jst-rght' );
416
+			$html .= EEH_HTML::td(EEH_Template::format_currency($options['sub_total'], false, false), '', 'total jst-rght');
417 417
 			// end of row
418 418
 			$html .= EEH_HTML::trx();
419 419
 		}
@@ -430,13 +430,13 @@  discard block
 block discarded – undo
430 430
 	 * @param string       $text
431 431
 	 * @return mixed
432 432
 	 */
433
-	private function _total_row( EE_Line_Item $line_item, $text = '' ) {
433
+	private function _total_row(EE_Line_Item $line_item, $text = '') {
434 434
 		// start of row
435
-		$html = EEH_HTML::tr( '', '', 'spco-grand-total total_tr odd' );
435
+		$html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd');
436 436
 		// total td
437
-		$html .= EEH_HTML::td( $text, '',  'total_currency total jst-rght',  '',  ' colspan="3"' );
437
+		$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
438 438
 		// total td
439
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'total jst-rght' );
439
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght');
440 440
 		// end of row
441 441
 		$html .= EEH_HTML::trx();
442 442
 		return $html;
@@ -451,30 +451,30 @@  discard block
 block discarded – undo
451 451
 	 * @param array        $options
452 452
 	 * @return mixed
453 453
 	 */
454
-	private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) {
454
+	private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) {
455 455
 		$html = '';
456 456
 		$owing = $line_item->total();
457
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $line_item->TXN_ID() );
458
-		if ( $transaction instanceof EE_Transaction ) {
457
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
458
+		if ($transaction instanceof EE_Transaction) {
459 459
 			$registration_payments = array();
460
-			$registrations = ! empty( $options['registrations'] )
461
-				? $options[ 'registrations' ]
460
+			$registrations = ! empty($options['registrations'])
461
+				? $options['registrations']
462 462
 				: $transaction->registrations();
463
-			foreach ( $registrations as $registration ) {
464
-				if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
463
+			foreach ($registrations as $registration) {
464
+				if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
465 465
 					$registration_payments = $registration_payments + $registration->registration_payments();
466 466
 				}
467 467
 			}
468
-			if ( ! empty( $registration_payments )) {
469
-				foreach ( $registration_payments as $registration_payment ) {
470
-					if ( $registration_payment instanceof EE_Registration_Payment ) {
468
+			if ( ! empty($registration_payments)) {
469
+				foreach ($registration_payments as $registration_payment) {
470
+					if ($registration_payment instanceof EE_Registration_Payment) {
471 471
 						$owing = $owing - $registration_payment->amount();
472 472
 						$payment = $registration_payment->payment();
473
-						if ( $payment instanceof EE_Payment ) {
473
+						if ($payment instanceof EE_Payment) {
474 474
 							$payment_desc = sprintf(
475
-								__( 'Payment%1$s Received: %2$s', 'event_espresso' ),
475
+								__('Payment%1$s Received: %2$s', 'event_espresso'),
476 476
 								$payment->txn_id_chq_nmbr() != ''
477
-									? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> '
477
+									? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> '
478 478
 									: '',
479 479
 								$payment->timestamp()
480 480
 							);
@@ -482,12 +482,12 @@  discard block
 block discarded – undo
482 482
 							$payment_desc = '';
483 483
 						}
484 484
 						// start of row
485
-						$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
485
+						$html .= EEH_HTML::tr('', '', 'total_tr odd');
486 486
 						// payment desc
487
-						$html .= EEH_HTML::td( $payment_desc, '', '', '', ' colspan="3"' );
487
+						$html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
488 488
 						// total td
489 489
 						$html .= EEH_HTML::td(
490
-							EEH_Template::format_currency( $registration_payment->amount(), false, false ),
490
+							EEH_Template::format_currency($registration_payment->amount(), false, false),
491 491
 							'',
492 492
 							'total jst-rght'
493 493
 						);
@@ -495,17 +495,17 @@  discard block
 block discarded – undo
495 495
 						$html .= EEH_HTML::trx();
496 496
 					}
497 497
 				}
498
-				if ( $line_item->total() ) {
498
+				if ($line_item->total()) {
499 499
 					// start of row
500
-					$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
500
+					$html .= EEH_HTML::tr('', '', 'total_tr odd');
501 501
 					// total td
502 502
 					$html .= EEH_HTML::td(
503 503
 						__('Amount Owing', 'event_espresso'),
504
-						'',  'total_currency total jst-rght',  '',  ' colspan="3"'
504
+						'', 'total_currency total jst-rght', '', ' colspan="3"'
505 505
 					);
506 506
 					// total td
507 507
 					$html .= EEH_HTML::td(
508
-						EEH_Template::format_currency( $owing, false, false ), '',  'total jst-rght'
508
+						EEH_Template::format_currency($owing, false, false), '', 'total jst-rght'
509 509
 					);
510 510
 					// end of row
511 511
 					$html .= EEH_HTML::trx();
Please login to merge, or discard this patch.
core/db_models/EEM_Extra_Meta.model.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * ------------------------------------------------------------------------
28 28
  */
29
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
29
+require_once (EE_MODELS.'EEM_Base.model.php');
30 30
 
31 31
 class EEM_Extra_Meta extends EEM_Base {
32 32
 
33 33
   	// private instance of the Attendee object
34 34
 	protected static $_instance = NULL;
35 35
 
36
-	protected function __construct( $timezone = NULL ) {
37
-		$this->singular_item = __('Extra Meta','event_espresso');
38
-		$this->plural_item = __('Extra Metas','event_espresso');
36
+	protected function __construct($timezone = NULL) {
37
+		$this->singular_item = __('Extra Meta', 'event_espresso');
38
+		$this->plural_item = __('Extra Metas', 'event_espresso');
39 39
 		$this->_tables = array(
40 40
 			'Extra_Meta'=> new EE_Primary_Table('esp_extra_meta', 'EXM_ID')
41 41
 		);
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 
51 51
 			));
52 52
 		$this->_model_relations = array();
53
-		foreach($models_this_can_attach_to as $model){
53
+		foreach ($models_this_can_attach_to as $model) {
54 54
 			$this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
55 55
 		}
56
-		foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) {
57
-			$this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'EXM_key', 'EXM_value' );
56
+		foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
57
+			$this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value');
58 58
 		}
59
-		parent::__construct( $timezone );
59
+		parent::__construct($timezone);
60 60
 	}
61 61
 
62 62
 
Please login to merge, or discard this patch.