Completed
Branch BUG-8698-ticket-sellouts (195489)
by
unknown
116:46 queued 100:40
created
registration_form/templates/questions_main_meta_box.template.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		<tbody>
22 22
 			<tr>
23 23
 				<th>
24
-					<label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info');?>
24
+					<label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info'); ?>
25 25
 				</th>
26 26
 				<td>
27 27
 					<input type="text" class="regular-text" id="QST_display_text" name="QST_display_text" value="<?php $question->f('QST_display_text')?>"/>
@@ -31,23 +31,23 @@  discard block
 block discarded – undo
31 31
 
32 32
 			<tr>
33 33
 				<th>
34
-					<label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info');?>
34
+					<label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info'); ?>
35 35
 				</th>
36 36
 				<td>
37 37
 					<?php
38
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
39
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
38
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
39
+						$id = ! empty($QST_system) ? '_disabled' : '';
40 40
 					?>
41 41
 					<input type="text" class="regular-text" id="QST_admin_label<?php echo $id?>" name="QST_admin_label<?php echo $id?>" value="<?php $question->f('QST_admin_label')?>"<?php echo $disabled?>/>
42 42
 					<input class="QST_order" type="hidden" id="QST_order<?php echo $id; ?>" name = "QST_order<?php echo $id; ?>" value="<?php echo $question->get('QST_order'); ?>" />
43
-					<?php if ( ! empty( $QST_system )) { ?>
43
+					<?php if ( ! empty($QST_system)) { ?>
44 44
 						<input type="hidden"  id="QST_admin_label" name="QST_admin_label" value="<?php echo $question->admin_label()?>"/>
45 45
 					<?php } ?>
46 46
 					<br/>
47 47
 					<p class="description">
48
-					<?php if ( ! empty( $QST_system )) { ?>
48
+					<?php if ( ! empty($QST_system)) { ?>
49 49
 					<span class="description" style="color:#D54E21;">
50
-						<?php _e('System question! This field cannot be changed.','event_espresso')?>
50
+						<?php _e('System question! This field cannot be changed.', 'event_espresso')?>
51 51
 					</span>
52 52
 					<?php } ?>
53 53
 
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 
58 58
 			<tr>
59 59
 				<th>
60
-					<label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info');?>
60
+					<label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info'); ?>
61 61
 				</th>
62 62
 				<td>
63 63
 					<?php
64
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
65
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
64
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
65
+						$id = ! empty($QST_system) ? '_disabled' : '';
66 66
 						$admin_only = $question->get('QST_admin_only');
67
-						$checked = !empty( $admin_only ) ? ' checked="checked"' : '';
67
+						$checked = ! empty($admin_only) ? ' checked="checked"' : '';
68 68
 					?>
69 69
 					<input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" name = "QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled; echo $checked; ?>/>
70 70
 					<br/>
71 71
 					<p class="description">
72
-					<?php if ( ! empty( $QST_system )) { ?>
72
+					<?php if ( ! empty($QST_system)) { ?>
73 73
 					<span class="description" style="color:#D54E21;">
74
-						<?php _e('System question! This field cannot be changed.','event_espresso')?>
74
+						<?php _e('System question! This field cannot be changed.', 'event_espresso')?>
75 75
 					</span>
76 76
 					<?php } ?>
77 77
 
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
 
82 82
 			<tr>
83 83
 				<th>
84
-					<label for="QST_type"><?php echo $fields['QST_type']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info');?>
84
+					<label for="QST_type"><?php echo $fields['QST_type']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info'); ?>
85 85
 				</th>
86 86
 				<td>
87 87
 					<?php
88
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
89
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
90
-						echo EEH_Form_Fields::select_input( 'QST_type' . $id, $question_types, $question->type(), 'id="QST_type' . $id . '"' . $disabled );
91
-						if( ! empty( $QST_system ) ) { ?>
88
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
89
+						$id = ! empty($QST_system) ? '_disabled' : '';
90
+						echo EEH_Form_Fields::select_input('QST_type'.$id, $question_types, $question->type(), 'id="QST_type'.$id.'"'.$disabled);
91
+						if ( ! empty($QST_system)) { ?>
92 92
 							<input type="hidden"  id="QST_type" name="QST_type" value="<?php echo $question->type()?>"/>
93 93
 						<?php
94
-							$explanatory_text = __('System question! This field cannot be changed.','event_espresso');
95
-						}else{
96
-							$explanatory_text = __('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.','event_espresso');
94
+							$explanatory_text = __('System question! This field cannot be changed.', 'event_espresso');
95
+						} else {
96
+							$explanatory_text = __('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', 'event_espresso');
97 97
 						}
98
-						if ( ! empty( $QST_system ) || $has_answers ) { ?>
98
+						if ( ! empty($QST_system) || $has_answers) { ?>
99 99
 							<p><span class="description" style="color:#D54E21;">
100 100
 								<?php echo $explanatory_text; ?>
101 101
 							</span></p>
@@ -108,22 +108,22 @@  discard block
 block discarded – undo
108 108
 			<tr id="text_input_question_options">
109 109
 				<th>
110 110
 					<label>
111
-						<?php _e( 'Maximum Allowed Response Size', 'event_espresso' );?>
111
+						<?php _e('Maximum Allowed Response Size', 'event_espresso'); ?>
112 112
 					</label>
113 113
 				</th>
114 114
 				<td>
115
-					<input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'";?> value="<?php $question->f( 'QST_max' );?>" min="1">
115
+					<input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1">
116 116
 					<p>
117 117
 						<span class="description">
118
-							<?php _e( 'Maximum number of characters allowed when answering this question', 'event_espresso' );?>
118
+							<?php _e('Maximum number of characters allowed when answering this question', 'event_espresso'); ?>
119 119
 						</span>
120 120
 					</p>
121
-					<?php if ( $QST_system ) { ?>
121
+					<?php if ($QST_system) { ?>
122 122
 					<p>
123 123
 						<span class="description" style="color:#D54E21;">
124 124
 							<?php printf(
125
-									__( 'System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso' ),
126
-									$max_max );?>
125
+									__('System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso'),
126
+									$max_max ); ?>
127 127
 						</span>
128 128
 					</p>
129 129
 					<?php } ?>
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			<tr id="question_options">
133 133
 				<th>
134 134
 					<label>
135
-						<?php _e('Answer Options','event_espresso')?>
135
+						<?php _e('Answer Options', 'event_espresso')?>
136 136
 					</label>
137 137
 				</th>
138 138
 				<td>
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 						<thead>
142 142
 							<tr>
143 143
 								<th class="option-value-header">
144
-									<?php _e('Value','event_espresso')?>
144
+									<?php _e('Value', 'event_espresso')?>
145 145
 								</th>
146 146
 								<th class="option-desc-header">
147
-									<?php _e('Description (optional, only shown on registration form)','event_espresso')?>
147
+									<?php _e('Description (optional, only shown on registration form)', 'event_espresso')?>
148 148
 								</th>
149 149
 								<th>
150 150
 								</th>
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
 							</tr>
168 168
 
169 169
 							<?php
170
-							$count=0;
170
+							$count = 0;
171 171
 							$question_options = $question->options();
172
-							if ( ! empty( $question_options )) {
173
-								foreach( $question_options as $option_id => $option ) {
174
-									$disabled =  $has_answers || $option->get('QSO_system') ? ' disabled="disabled"'  : '';
172
+							if ( ! empty($question_options)) {
173
+								foreach ($question_options as $option_id => $option) {
174
+									$disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : '';
175 175
 							?>
176 176
 								<tr class="question-option ee-options-sortable">
177 177
 									<td class="option-value-cell">
178 178
 										<input type="hidden" class="QSO_order" name="question_options[<?php echo $count; ?>][QSO_order]" value="<?php echo $count; ?>">
179 179
 										<input type="text" class="option-value regular-text" name="question_options[<?php echo $count?>][QSO_value]" value="<?php  $option->f('QSO_value')?>"<?php echo $disabled; ?>>
180
-										<?php if ( $has_answers ) : ?>
180
+										<?php if ($has_answers) : ?>
181 181
 											<input type="hidden" name="question_options[<?php echo $count; ?>][QSO_value]" value="<?php echo $option->f('QSO_value'); ?>" >
182 182
 										<?php endif; ?>
183 183
 									</td>
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 										<input type="text" class="option-desc regular-text" name="question_options[<?php echo $count?>][QSO_desc]" value="<?php $option->f('QSO_desc')?>">
186 186
 									</td>
187 187
 									<td>
188
-										<?php if ( ! $option->system() ) { ?>
188
+										<?php if ( ! $option->system()) { ?>
189 189
 											<span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item"></span>
190 190
 										<?php } ?>
191 191
 										<span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span>
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
 					</table>
225 225
 
226 226
 					<a id="new-question-option" class="button" style="margin:0 0 1em 3px;">
227
-						<?php _e('Add Another Answer Option','event_espresso')?>
227
+						<?php _e('Add Another Answer Option', 'event_espresso')?>
228 228
 					</a><br/>
229 229
 
230 230
 					<p class="description">
231
-						<?php _e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.','event_espresso')?>
231
+						<?php _e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', 'event_espresso')?>
232 232
 					</p>
233
-					<?php if ( $has_answers ) : ?>
233
+					<?php if ($has_answers) : ?>
234 234
 					<p class="description" style="color:#D54E21;">
235 235
 							<?php _e('Answer values that are uneditable are this way because there are registrations in the database that have answers for this question.  If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes.  This will ensure that the existing registrations that chose the original answer will preserve that answer.', 'event_espresso'); ?>
236 236
 					</p>
@@ -241,32 +241,32 @@  discard block
 block discarded – undo
241 241
 
242 242
 			<tr>
243 243
 				<th>
244
-					<label for="QST_required"><?php echo $fields['QST_required']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info');?>
244
+					<label for="QST_required"><?php echo $fields['QST_required']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info'); ?>
245 245
 				</th>
246 246
 				<td>
247 247
 					<?php
248
-					$system_required = array( 'fname', 'email' );
249
-					$disabled = in_array( $QST_system, $system_required ) ? ' disabled="disabled"' : '';
248
+					$system_required = array('fname', 'email');
249
+					$disabled = in_array($QST_system, $system_required) ? ' disabled="disabled"' : '';
250 250
 					$required_on = $question->get('QST_admin_only');
251 251
 					$show_required_msg = $required_on ? '' : ' display:none;';
252
-					$disabled = $required_on || ! empty( $disabled ) ? ' disabled="disabled"' : '';
253
-					$id =  ! empty( $disabled ) && in_array( $QST_system, $system_required) ? '_disabled' : '';
254
-					$requiredOptions=array(
255
-						array('text'=>'Optional','id'=>0),
256
-						array('text'=>'Required','id'=>1)
252
+					$disabled = $required_on || ! empty($disabled) ? ' disabled="disabled"' : '';
253
+					$id = ! empty($disabled) && in_array($QST_system, $system_required) ? '_disabled' : '';
254
+					$requiredOptions = array(
255
+						array('text'=>'Optional', 'id'=>0),
256
+						array('text'=>'Required', 'id'=>1)
257 257
 					);
258
-					echo EEH_Form_Fields::select_input('QST_required' . $id, $requiredOptions, $question->required(), 'id="QST_required' . $id . '"' . $disabled );
258
+					echo EEH_Form_Fields::select_input('QST_required'.$id, $requiredOptions, $question->required(), 'id="QST_required'.$id.'"'.$disabled);
259 259
 					?>
260 260
 						<p><span id="required_toggled_on" class="description" style="color:#D54E21;<?php echo $show_required_msg; ?>">
261
-						<?php _e('Required is set to optional, and this field is disabled, because the question is Admin-Only.','event_espresso')?>
261
+						<?php _e('Required is set to optional, and this field is disabled, because the question is Admin-Only.', 'event_espresso')?>
262 262
 						</span></p>
263 263
 						<p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;">
264
-							<?php _e('Required option field is no longer disabled because the question is not Admin-Only','event_espresso')?>
264
+							<?php _e('Required option field is no longer disabled because the question is not Admin-Only', 'event_espresso')?>
265 265
 						</span></p>
266
-					<?php if ( ! empty( $disabled ) && in_array( $QST_system, $system_required ) ) { ?>
266
+					<?php if ( ! empty($disabled) && in_array($QST_system, $system_required)) { ?>
267 267
 						<input type="hidden"  id="QST_required" name="QST_required" value="1"/>
268 268
 						<p><span class="description" style="color:#D54E21;">
269
-						<?php _e('System question! This field cannot be changed.','event_espresso')?>
269
+						<?php _e('System question! This field cannot be changed.', 'event_espresso')?>
270 270
 					</span></p>
271 271
 					<?php } ?>
272 272
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
 			<tr>
277 277
 				<th>
278
-					<label for="QST_required_text"><?php _e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info');?>
278
+					<label for="QST_required_text"><?php _e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?>
279 279
 				</th>
280 280
 				<td>
281 281
 					<input type="text" class="regular-text" id="QST_required_text" name="QST_required_text" value="<?php  $question->f('QST_required_text')?>"/>
Please login to merge, or discard this patch.
core/db_classes/EE_Taxes.class.php 1 patch
Spacing   +21 added lines, -21 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
  * Taxes class
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 	 * @param  EE_Ticket $ticket incoming EE_Ticket
33 33
 	 * @return float             total taxes to apply to ticket.
34 34
 	 */
35
-	public static function get_total_taxes_for_admin( EE_Ticket $ticket ) {
35
+	public static function get_total_taxes_for_admin(EE_Ticket $ticket) {
36 36
 		$tax = 0;
37 37
 		$total_tax = 0;
38 38
 		//This first checks to see if the given ticket is taxable.
39
-		if ( ! $ticket->get( 'TKT_taxable' ) )
39
+		if ( ! $ticket->get('TKT_taxable'))
40 40
 			return $tax;
41 41
 		//get subtotal (notice we're only retrieving a subtotal if there isn't one given)
42
-		$subtotal = self::get_subtotal_for_admin( $ticket );
42
+		$subtotal = self::get_subtotal_for_admin($ticket);
43 43
 		//get taxes
44 44
 		$taxes = self::get_taxes_for_admin();
45 45
 		//apply taxes to subtotal
46
-		foreach ( $taxes as $tax ) {
46
+		foreach ($taxes as $tax) {
47 47
 			//assuming taxes are not cumulative
48
-			$total_tax += $subtotal * $tax->get( 'PRC_amount' ) / 100;
48
+			$total_tax += $subtotal * $tax->get('PRC_amount') / 100;
49 49
 		}
50 50
 		return $total_tax;
51 51
 	}
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public static function get_total_taxes_percentage() {
59 59
 		$total_tax_percent = 0;
60
-		foreach( self::get_taxes_for_admin() as $tax_price ) {
61
-			$total_tax_percent += $tax_price->get( 'PRC_amount' );
60
+		foreach (self::get_taxes_for_admin() as $tax_price) {
61
+			$total_tax_percent += $tax_price->get('PRC_amount');
62 62
 		}
63 63
 		return $total_tax_percent;
64 64
 	}
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 	 * @param EE_Ticket $ticket
70 70
 	 * @return float
71 71
 	 */
72
-	public static function get_subtotal_for_admin( EE_Ticket $ticket ) {
72
+	public static function get_subtotal_for_admin(EE_Ticket $ticket) {
73 73
 		$TKT_ID = $ticket->ID();
74
-		return isset( self::$_subtotal[ $TKT_ID ] ) ? self::$_subtotal[ $TKT_ID ] : self::_get_subtotal_for_admin( $ticket );
74
+		return isset(self::$_subtotal[$TKT_ID]) ? self::$_subtotal[$TKT_ID] : self::_get_subtotal_for_admin($ticket);
75 75
 	}
76 76
 
77 77
 
@@ -81,29 +81,29 @@  discard block
 block discarded – undo
81 81
 	 * @param  EE_Ticket $ticket
82 82
 	 * @return float     subtotal calculated from all EE_Price[] on Ticket.
83 83
 	 */
84
-	private static function _get_subtotal_for_admin( EE_Ticket $ticket ) {
84
+	private static function _get_subtotal_for_admin(EE_Ticket $ticket) {
85 85
 		$subtotal = 0;
86 86
 		//get all prices
87
-		$prices = $ticket->get_many_related( 'Price', array( 'default_where_conditions' => 'none', 'order_by' => array( 'PRC_order' => 'ASC' ) ) );
87
+		$prices = $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC')));
88 88
 		//let's loop through them (base price is always the first item)
89
-		foreach ( $prices as $price ) {
90
-			if ( $price instanceof EE_Price ) {
89
+		foreach ($prices as $price) {
90
+			if ($price instanceof EE_Price) {
91 91
 				$price_type = $price->type_obj();
92
-				if ( $price_type instanceof EE_Price_Type ) {
93
-					switch ( $price->type_obj()->base_type() ) {
92
+				if ($price_type instanceof EE_Price_Type) {
93
+					switch ($price->type_obj()->base_type()) {
94 94
 						case 1: // base price
95 95
 						case 3: // surcharges
96
-							$subtotal += $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' );
96
+							$subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount');
97 97
 							break;
98 98
 						case 2: // discounts
99
-							$subtotal -= $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' );
99
+							$subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount');
100 100
 							break;
101 101
 					}
102 102
 				}
103 103
 			}
104 104
 		}
105 105
 		$TKT_ID = $ticket->ID();
106
-		self::$_subtotal = array( $TKT_ID => $subtotal );
106
+		self::$_subtotal = array($TKT_ID => $subtotal);
107 107
 		return $subtotal;
108 108
 	}
109 109
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * @return EE_Price[] EE_Price objects that have PRT_ID == 4
115 115
 	 */
116 116
 	public static function get_taxes_for_admin() {
117
-		self::$_default_taxes = ! empty( self::$_default_taxes ) ? self::$_default_taxes : EE_Registry::instance()->load_model( 'Price' )->get_all( array( array( 'Price_Type.PBT_ID' => 4 ) ) );
117
+		self::$_default_taxes = ! empty(self::$_default_taxes) ? self::$_default_taxes : EE_Registry::instance()->load_model('Price')->get_all(array(array('Price_Type.PBT_ID' => 4)));
118 118
 		return self::$_default_taxes;
119 119
 	}
120 120
 
Please login to merge, or discard this patch.
core/db_classes/EE_Event.class.php 1 patch
Spacing   +216 added lines, -216 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
 /**
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 *                             		    date_format and the second value is the time format
36 36
 	 * @return EE_Event
37 37
 	 */
38
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
39
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
40
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
38
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
39
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
40
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
41 41
 	}
42 42
 
43 43
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 *                          		the website will be used.
49 49
 	 * @return EE_Event
50 50
 	 */
51
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
52
-		return new self( $props_n_values, TRUE, $timezone );
51
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
52
+		return new self($props_n_values, TRUE, $timezone);
53 53
 	}
54 54
 
55 55
 
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 	 * @param mixed  $field_value
62 62
 	 * @param bool   $use_default
63 63
 	 */
64
-	public function set( $field_name, $field_value, $use_default = false ) {
65
-		switch ( $field_name ) {
64
+	public function set($field_name, $field_value, $use_default = false) {
65
+		switch ($field_name) {
66 66
 			case 'status' :
67
-				$this->set_status( $field_value, $use_default );
67
+				$this->set_status($field_value, $use_default);
68 68
 				break;
69 69
 			default :
70
-				parent::set( $field_name, $field_value, $use_default );
70
+				parent::set($field_name, $field_value, $use_default);
71 71
 		}
72 72
 	}
73 73
 
@@ -86,29 +86,29 @@  discard block
 block discarded – undo
86 86
 	 * @return bool|void
87 87
 	 * @throws \EE_Error
88 88
 	 */
89
-	public function set_status( $new_status = null, $use_default = false ) {
89
+	public function set_status($new_status = null, $use_default = false) {
90 90
 		// get current Event status
91 91
 		$old_status = $this->status();
92 92
 		// if status has changed
93
-		if ( $old_status != $new_status ) {
93
+		if ($old_status != $new_status) {
94 94
 			// TO sold_out
95
-			if ( $new_status == EEM_Event::sold_out ) {
95
+			if ($new_status == EEM_Event::sold_out) {
96 96
 				// save the previous event status so that we can revert if the event is no longer sold out
97
-				$this->add_post_meta( '_previous_event_status', $old_status );
98
-				do_action( 'AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status );
97
+				$this->add_post_meta('_previous_event_status', $old_status);
98
+				do_action('AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status);
99 99
 				// OR FROM  sold_out
100
-			} else if ( $old_status == EEM_Event::sold_out ) {
101
-				$this->delete_post_meta( '_previous_event_status' );
102
-				do_action( 'AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status );
100
+			} else if ($old_status == EEM_Event::sold_out) {
101
+				$this->delete_post_meta('_previous_event_status');
102
+				do_action('AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status);
103 103
 			}
104 104
 			// update status
105
-			parent::set( 'status', $new_status, $use_default );
106
-			do_action( 'AHEE__EE_Event__set_status__after_update', $this );
105
+			parent::set('status', $new_status, $use_default);
106
+			do_action('AHEE__EE_Event__set_status__after_update', $this);
107 107
 			return true;
108 108
 		} else {
109 109
 			// even though the old value matches the new value, it's still good to
110 110
 			// allow the parent set method to have a say
111
-			parent::set( 'status', $new_status, $use_default );
111
+			parent::set('status', $new_status, $use_default);
112 112
 			return true;
113 113
 		}
114 114
 	}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @param array $query_params like EEM_Base::get_all
122 122
 	 * @return EE_Datetime[]
123 123
 	 */
124
-	public function datetimes( $query_params = array() ) {
125
-		return $this->get_many_related( 'Datetime', $query_params );
124
+	public function datetimes($query_params = array()) {
125
+		return $this->get_many_related('Datetime', $query_params);
126 126
 	}
127 127
 
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return EE_Datetime[]
134 134
 	 */
135 135
 	public function datetimes_in_chronological_order() {
136
-		return $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) );
136
+		return $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC')));
137 137
 	}
138 138
 
139 139
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param null $limit
150 150
 	 * @return \EE_Datetime[]
151 151
 	 */
152
-	public function datetimes_ordered( $show_expired = true, $show_deleted = false, $limit = null ) {
153
-		return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_event_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted, $limit );
152
+	public function datetimes_ordered($show_expired = true, $show_deleted = false, $limit = null) {
153
+		return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_event_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted, $limit);
154 154
 	}
155 155
 
156 156
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return EE_Datetime
161 161
 	 */
162 162
 	public function first_datetime() {
163
-		return $this->get_first_related( 'Datetime' );
163
+		return $this->get_first_related('Datetime');
164 164
 	}
165 165
 
166 166
 
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	 * @param bool $try_to_exclude_deleted
172 172
 	 * @return EE_Datetime
173 173
 	 */
174
-	public function primary_datetime( $try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE ) {
175
-		if ( !empty ( $this->_Primary_Datetime ) ) {
174
+	public function primary_datetime($try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE) {
175
+		if ( ! empty ($this->_Primary_Datetime)) {
176 176
 			return $this->_Primary_Datetime;
177 177
 		}
178
-		$this->_Primary_Datetime = EEM_Datetime::instance( $this->_timezone )->get_primary_datetime_for_event( $this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted );
178
+		$this->_Primary_Datetime = EEM_Datetime::instance($this->_timezone)->get_primary_datetime_for_event($this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted);
179 179
 		return $this->_Primary_Datetime;
180 180
 	}
181 181
 
@@ -186,30 +186,30 @@  discard block
 block discarded – undo
186 186
 	 * @param array $query_params like EEM_Base::get_all
187 187
 	 * @return EE_Ticket[]
188 188
 	 */
189
-	public function tickets( $query_params = array() ) {
189
+	public function tickets($query_params = array()) {
190 190
 		//first get all datetimes
191 191
 		$datetimes = $this->datetimes_ordered();
192
-		if ( ! $datetimes ) {
192
+		if ( ! $datetimes) {
193 193
 			return array();
194 194
 		}
195 195
 
196 196
 		$datetime_ids = array();
197
-		foreach ( $datetimes as $datetime ) {
197
+		foreach ($datetimes as $datetime) {
198 198
 			$datetime_ids[] = $datetime->ID();
199 199
 		}
200 200
 
201
-		$where_params = array( 'Datetime.DTT_ID' => array( 'IN', $datetime_ids ) );
201
+		$where_params = array('Datetime.DTT_ID' => array('IN', $datetime_ids));
202 202
 
203 203
 		//if incoming $query_params has where conditions let's merge but not override existing.
204
-		if ( is_array( $query_params ) && isset( $query_params[0]) ) {
205
-			$where_params = array_merge( $query_params[0], $where_params );
206
-			unset( $query_params[0] );
204
+		if (is_array($query_params) && isset($query_params[0])) {
205
+			$where_params = array_merge($query_params[0], $where_params);
206
+			unset($query_params[0]);
207 207
 		}
208 208
 
209 209
 		//now add $where_params to $query_params
210 210
 		$query_params[0] = $where_params;
211 211
 
212
-		return EEM_Ticket::instance()->get_all( $query_params );
212
+		return EEM_Ticket::instance()->get_all($query_params);
213 213
 	}
214 214
 
215 215
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @return bool
219 219
 	 */
220 220
 	function additional_limit() {
221
-		return $this->get( 'EVT_additional_limit' );
221
+		return $this->get('EVT_additional_limit');
222 222
 	}
223 223
 
224 224
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 * @return bool
228 228
 	 */
229 229
 	function allow_overflow() {
230
-		return $this->get( 'EVT_allow_overflow' );
230
+		return $this->get('EVT_allow_overflow');
231 231
 	}
232 232
 
233 233
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * @return bool
237 237
 	 */
238 238
 	function created() {
239
-		return $this->get( 'EVT_created' );
239
+		return $this->get('EVT_created');
240 240
 	}
241 241
 
242 242
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @return bool
246 246
 	 */
247 247
 	function description() {
248
-		return $this->get( 'EVT_desc' );
248
+		return $this->get('EVT_desc');
249 249
 	}
250 250
 
251 251
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 * @return string of html
256 256
 	 */
257 257
 	function description_filtered() {
258
-		return $this->get_pretty( 'EVT_desc' );
258
+		return $this->get_pretty('EVT_desc');
259 259
 	}
260 260
 
261 261
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @return bool
265 265
 	 */
266 266
 	function display_description() {
267
-		return $this->get( 'EVT_display_desc' );
267
+		return $this->get('EVT_display_desc');
268 268
 	}
269 269
 
270 270
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return bool
274 274
 	 */
275 275
 	function display_ticket_selector() {
276
-		return (bool)$this->get( 'EVT_display_ticket_selector' );
276
+		return (bool) $this->get('EVT_display_ticket_selector');
277 277
 	}
278 278
 
279 279
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 * @return bool
283 283
 	 */
284 284
 	function external_url() {
285
-		return $this->get( 'EVT_external_URL' );
285
+		return $this->get('EVT_external_URL');
286 286
 	}
287 287
 
288 288
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @return bool
292 292
 	 */
293 293
 	function member_only() {
294
-		return $this->get( 'EVT_member_only' );
294
+		return $this->get('EVT_member_only');
295 295
 	}
296 296
 
297 297
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @return bool
301 301
 	 */
302 302
 	function phone() {
303
-		return $this->get( 'EVT_phone' );
303
+		return $this->get('EVT_phone');
304 304
 	}
305 305
 
306 306
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @return bool
310 310
 	 */
311 311
 	function modified() {
312
-		return $this->get( 'EVT_modified' );
312
+		return $this->get('EVT_modified');
313 313
 	}
314 314
 
315 315
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * @return bool
319 319
 	 */
320 320
 	function name() {
321
-		return $this->get( 'EVT_name' );
321
+		return $this->get('EVT_name');
322 322
 	}
323 323
 
324 324
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * @return bool
328 328
 	 */
329 329
 	function order() {
330
-		return $this->get( 'EVT_order' );
330
+		return $this->get('EVT_order');
331 331
 	}
332 332
 
333 333
 
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * @return bool|string
337 337
 	 */
338 338
 	function default_registration_status() {
339
-		$event_default_registration_status = $this->get( 'EVT_default_registration_status' );
340
-		return !empty( $event_default_registration_status ) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID;
339
+		$event_default_registration_status = $this->get('EVT_default_registration_status');
340
+		return ! empty($event_default_registration_status) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID;
341 341
 	}
342 342
 
343 343
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 	 * @param bool $not_full_desc
349 349
 	 * @return bool|string
350 350
 	 */
351
-	function short_description( $num_words = 55, $more = NULL, $not_full_desc = FALSE ) {
352
-		$short_desc = $this->get( 'EVT_short_desc' );
353
-		if ( !empty( $short_desc ) || $not_full_desc ) {
351
+	function short_description($num_words = 55, $more = NULL, $not_full_desc = FALSE) {
352
+		$short_desc = $this->get('EVT_short_desc');
353
+		if ( ! empty($short_desc) || $not_full_desc) {
354 354
 			return $short_desc;
355 355
 		}
356 356
 		else {
357
-			$full_desc = $this->get( 'EVT_desc' );
358
-			return wp_trim_words( $full_desc, $num_words, $more );
357
+			$full_desc = $this->get('EVT_desc');
358
+			return wp_trim_words($full_desc, $num_words, $more);
359 359
 		}
360 360
 	}
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 * @return bool
366 366
 	 */
367 367
 	function slug() {
368
-		return $this->get( 'EVT_slug' );
368
+		return $this->get('EVT_slug');
369 369
 	}
370 370
 
371 371
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 * @return bool
375 375
 	 */
376 376
 	function timezone_string() {
377
-		return $this->get( 'EVT_timezone_string' );
377
+		return $this->get('EVT_timezone_string');
378 378
 	}
379 379
 
380 380
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * @return bool
384 384
 	 */
385 385
 	function visible_on() {
386
-		return $this->get( 'EVT_visible_on' );
386
+		return $this->get('EVT_visible_on');
387 387
 	}
388 388
 
389 389
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 * @return int
393 393
 	 */
394 394
 	function wp_user() {
395
-		return $this->get( 'EVT_wp_user' );
395
+		return $this->get('EVT_wp_user');
396 396
 	}
397 397
 
398 398
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	 * @return bool
402 402
 	 */
403 403
 	function donations() {
404
-		return $this->get( 'EVT_donations' );
404
+		return $this->get('EVT_donations');
405 405
 	}
406 406
 
407 407
 
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
 	/**
410 410
 	 * @param $limit
411 411
 	 */
412
-	function set_additional_limit( $limit ) {
413
-		$this->set( 'EVT_additional_limit', $limit );
412
+	function set_additional_limit($limit) {
413
+		$this->set('EVT_additional_limit', $limit);
414 414
 	}
415 415
 
416 416
 
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 	/**
419 419
 	 * @param $created
420 420
 	 */
421
-	function set_created( $created ) {
422
-		$this->set( 'EVT_created', $created );
421
+	function set_created($created) {
422
+		$this->set('EVT_created', $created);
423 423
 	}
424 424
 
425 425
 
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
 	/**
428 428
 	 * @param $desc
429 429
 	 */
430
-	function set_description( $desc ) {
431
-		$this->set( 'EVT_desc', $desc );
430
+	function set_description($desc) {
431
+		$this->set('EVT_desc', $desc);
432 432
 	}
433 433
 
434 434
 
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 	/**
437 437
 	 * @param $display_desc
438 438
 	 */
439
-	function set_display_description( $display_desc ) {
440
-		$this->set( 'EVT_display_desc', $display_desc );
439
+	function set_display_description($display_desc) {
440
+		$this->set('EVT_display_desc', $display_desc);
441 441
 	}
442 442
 
443 443
 
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 	/**
446 446
 	 * @param $display_ticket_selector
447 447
 	 */
448
-	function set_display_ticket_selector( $display_ticket_selector ) {
449
-		$this->set( 'EVT_display_ticket_selector', $display_ticket_selector );
448
+	function set_display_ticket_selector($display_ticket_selector) {
449
+		$this->set('EVT_display_ticket_selector', $display_ticket_selector);
450 450
 	}
451 451
 
452 452
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	/**
455 455
 	 * @param $external_url
456 456
 	 */
457
-	function set_external_url( $external_url ) {
458
-		$this->set( 'EVT_external_URL', $external_url );
457
+	function set_external_url($external_url) {
458
+		$this->set('EVT_external_URL', $external_url);
459 459
 	}
460 460
 
461 461
 
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 	/**
464 464
 	 * @param $member_only
465 465
 	 */
466
-	function set_member_only( $member_only ) {
467
-		$this->set( 'EVT_member_only', $member_only );
466
+	function set_member_only($member_only) {
467
+		$this->set('EVT_member_only', $member_only);
468 468
 	}
469 469
 
470 470
 
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 	/**
473 473
 	 * @param $event_phone
474 474
 	 */
475
-	function set_event_phone( $event_phone ) {
476
-		$this->set( 'EVT_phone', $event_phone );
475
+	function set_event_phone($event_phone) {
476
+		$this->set('EVT_phone', $event_phone);
477 477
 	}
478 478
 
479 479
 
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 	/**
482 482
 	 * @param $modified
483 483
 	 */
484
-	function set_modified( $modified ) {
485
-		$this->set( 'EVT_modified', $modified );
484
+	function set_modified($modified) {
485
+		$this->set('EVT_modified', $modified);
486 486
 	}
487 487
 
488 488
 
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 	/**
491 491
 	 * @param $name
492 492
 	 */
493
-	function set_name( $name ) {
494
-		$this->set( 'EVT_name', $name );
493
+	function set_name($name) {
494
+		$this->set('EVT_name', $name);
495 495
 	}
496 496
 
497 497
 
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 	/**
500 500
 	 * @param $order
501 501
 	 */
502
-	function set_order( $order ) {
503
-		$this->set( 'EVT_order', $order );
502
+	function set_order($order) {
503
+		$this->set('EVT_order', $order);
504 504
 	}
505 505
 
506 506
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	/**
509 509
 	 * @param $short_desc
510 510
 	 */
511
-	function set_short_description( $short_desc ) {
512
-		$this->set( 'EVT_short_desc', $short_desc );
511
+	function set_short_description($short_desc) {
512
+		$this->set('EVT_short_desc', $short_desc);
513 513
 	}
514 514
 
515 515
 
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 	/**
518 518
 	 * @param $slug
519 519
 	 */
520
-	function set_slug( $slug ) {
521
-		$this->set( 'EVT_slug', $slug );
520
+	function set_slug($slug) {
521
+		$this->set('EVT_slug', $slug);
522 522
 	}
523 523
 
524 524
 
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 	/**
527 527
 	 * @param $timezone_string
528 528
 	 */
529
-	function set_timezone_string( $timezone_string ) {
530
-		$this->set( 'EVT_timezone_string', $timezone_string );
529
+	function set_timezone_string($timezone_string) {
530
+		$this->set('EVT_timezone_string', $timezone_string);
531 531
 	}
532 532
 
533 533
 
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
 	/**
536 536
 	 * @param $visible_on
537 537
 	 */
538
-	function set_visible_on( $visible_on ) {
539
-		$this->set( 'EVT_visible_on', $visible_on );
538
+	function set_visible_on($visible_on) {
539
+		$this->set('EVT_visible_on', $visible_on);
540 540
 	}
541 541
 
542 542
 
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	/**
545 545
 	 * @param $wp_user
546 546
 	 */
547
-	function set_wp_user( $wp_user ) {
548
-		$this->set( 'EVT_wp_user', $wp_user );
547
+	function set_wp_user($wp_user) {
548
+		$this->set('EVT_wp_user', $wp_user);
549 549
 	}
550 550
 
551 551
 
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 	/**
554 554
 	 * @param $default_registration_status
555 555
 	 */
556
-	function set_default_registration_status( $default_registration_status ) {
557
-		$this->set( 'EVT_default_registration_status', $default_registration_status );
556
+	function set_default_registration_status($default_registration_status) {
557
+		$this->set('EVT_default_registration_status', $default_registration_status);
558 558
 	}
559 559
 
560 560
 
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 	/**
563 563
 	 * @param $donations
564 564
 	 */
565
-	function set_donations( $donations ) {
566
-		$this->set( 'EVT_donations', $donations );
565
+	function set_donations($donations) {
566
+		$this->set('EVT_donations', $donations);
567 567
 	}
568 568
 
569 569
 
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 	 * @param EE_Venue /int $venue_id_or_obj
574 574
 	 * @return EE_Venue
575 575
 	 */
576
-	function add_venue( $venue_id_or_obj ) {
577
-		return $this->_add_relation_to( $venue_id_or_obj, 'Venue' );
576
+	function add_venue($venue_id_or_obj) {
577
+		return $this->_add_relation_to($venue_id_or_obj, 'Venue');
578 578
 	}
579 579
 
580 580
 
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 * @param EE_Venue /int $venue_id_or_obj
585 585
 	 * @return EE_Venue
586 586
 	 */
587
-	function remove_venue( $venue_id_or_obj ) {
588
-		return $this->_remove_relation_to( $venue_id_or_obj, 'Venue' );
587
+	function remove_venue($venue_id_or_obj) {
588
+		return $this->_remove_relation_to($venue_id_or_obj, 'Venue');
589 589
 	}
590 590
 
591 591
 
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
 	 * @param array $query_params like EEM_Base::get_all's $query_params
596 596
 	 * @return EE_Venue[]
597 597
 	 */
598
-	function venues( $query_params = array() ) {
599
-		return $this->get_many_related( 'Venue', $query_params );
598
+	function venues($query_params = array()) {
599
+		return $this->get_many_related('Venue', $query_params);
600 600
 	}
601 601
 
602 602
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 */
609 609
 	private function _has_ID_and_is_published() {
610 610
 		// first check if event id is present and not NULL, then check if this event is published (or any of the equivalent "published" statuses)
611
-		return ( $this->ID() && $this->ID() !== NULL && ( $this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled ) ) ? TRUE : FALSE;
611
+		return ($this->ID() && $this->ID() !== NULL && ($this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled)) ? TRUE : FALSE;
612 612
 	}
613 613
 
614 614
 
@@ -620,21 +620,21 @@  discard block
 block discarded – undo
620 620
 	 */
621 621
 	public function is_upcoming() {
622 622
 		// check if event id is present and if this event is published
623
-		if ( $this->is_inactive() ) {
623
+		if ($this->is_inactive()) {
624 624
 			return FALSE;
625 625
 		}
626 626
 		// set initial value
627 627
 		$upcoming = FALSE;
628 628
 		//next let's get all datetimes and loop through them
629 629
 		$datetimes = $this->datetimes_in_chronological_order();
630
-		foreach ( $datetimes as $datetime ) {
631
-			if ( $datetime instanceof EE_Datetime ) {
630
+		foreach ($datetimes as $datetime) {
631
+			if ($datetime instanceof EE_Datetime) {
632 632
 				//if this dtt is expired then we continue cause one of the other datetimes might be upcoming.
633
-				if ( $datetime->is_expired() ) {
633
+				if ($datetime->is_expired()) {
634 634
 					continue;
635 635
 				}
636 636
 				//if this dtt is active then we return false.
637
-				if ( $datetime->is_active() ) {
637
+				if ($datetime->is_active()) {
638 638
 					return FALSE;
639 639
 				}
640 640
 				//otherwise let's check upcoming status
@@ -651,21 +651,21 @@  discard block
 block discarded – undo
651 651
 	 */
652 652
 	public function is_active() {
653 653
 		// check if event id is present and if this event is published
654
-		if ( $this->is_inactive() ) {
654
+		if ($this->is_inactive()) {
655 655
 			return FALSE;
656 656
 		}
657 657
 		// set initial value
658 658
 		$active = FALSE;
659 659
 		//next let's get all datetimes and loop through them
660 660
 		$datetimes = $this->datetimes_in_chronological_order();
661
-		foreach ( $datetimes as $datetime ) {
662
-			if ( $datetime instanceof EE_Datetime ) {
661
+		foreach ($datetimes as $datetime) {
662
+			if ($datetime instanceof EE_Datetime) {
663 663
 				//if this dtt is expired then we continue cause one of the other datetimes might be active.
664
-				if ( $datetime->is_expired() ) {
664
+				if ($datetime->is_expired()) {
665 665
 					continue;
666 666
 				}
667 667
 				//if this dtt is upcoming then we return false.
668
-				if ( $datetime->is_upcoming() ) {
668
+				if ($datetime->is_upcoming()) {
669 669
 					return FALSE;
670 670
 				}
671 671
 				//otherwise let's check active status
@@ -682,17 +682,17 @@  discard block
 block discarded – undo
682 682
 	 */
683 683
 	public function is_expired() {
684 684
 		// check if event id is present and if this event is published
685
-		if ( $this->is_inactive() ) {
685
+		if ($this->is_inactive()) {
686 686
 			return FALSE;
687 687
 		}
688 688
 		// set initial value
689 689
 		$expired = FALSE;
690 690
 		//first let's get all datetimes and loop through them
691 691
 		$datetimes = $this->datetimes_in_chronological_order();
692
-		foreach ( $datetimes as $datetime ) {
693
-			if ( $datetime instanceof EE_Datetime ) {
692
+		foreach ($datetimes as $datetime) {
693
+			if ($datetime instanceof EE_Datetime) {
694 694
 				//if this dtt is upcoming or active then we return false.
695
-				if ( $datetime->is_upcoming() || $datetime->is_active() ) {
695
+				if ($datetime->is_upcoming() || $datetime->is_active()) {
696 696
 					return FALSE;
697 697
 				}
698 698
 				//otherwise let's check active status
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 */
710 710
 	public function is_inactive() {
711 711
 		// check if event id is present and if this event is published
712
-		if ( $this->_has_ID_and_is_published() ) {
712
+		if ($this->_has_ID_and_is_published()) {
713 713
 			return FALSE;
714 714
 		}
715 715
 		return TRUE;
@@ -727,37 +727,37 @@  discard block
 block discarded – undo
727 727
 	 */
728 728
 	public function perform_sold_out_status_check() {
729 729
 		// get all unexpired untrashed tickets
730
-		$tickets = $this->tickets( array(
730
+		$tickets = $this->tickets(array(
731 731
 			array(
732
-				'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
732
+				'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
733 733
 				'TKT_deleted'    => false
734 734
 			)
735 735
 		));
736 736
 		// if all the tickets are just expired, then don't update the event status to sold out
737
-		if ( empty( $tickets )) {
737
+		if (empty($tickets)) {
738 738
 			return true;
739 739
 		}
740 740
 		// set initial value
741 741
 		$spaces_remaining = 0;
742
-		foreach( $tickets as $ticket ) {
743
-			if ( $ticket instanceof EE_Ticket ) {
744
-				$spaces_remaining += $ticket->qty( 'saleable' );
742
+		foreach ($tickets as $ticket) {
743
+			if ($ticket instanceof EE_Ticket) {
744
+				$spaces_remaining += $ticket->qty('saleable');
745 745
 			}
746 746
 		}
747
-		if ( $spaces_remaining === 0 ) {
748
-			$this->set_status( EEM_Event::sold_out );
749
-			if ( !is_admin() || ( is_admin() && defined( 'DOING_AJAX' ) ) ) {
747
+		if ($spaces_remaining === 0) {
748
+			$this->set_status(EEM_Event::sold_out);
749
+			if ( ! is_admin() || (is_admin() && defined('DOING_AJAX'))) {
750 750
 				$this->save();
751 751
 			}
752 752
 			$sold_out = TRUE;
753 753
 		} else {
754 754
 			$sold_out = FALSE;
755 755
 			// was event previously marked as sold out ?
756
-			if ( $this->status() == EEM_Event::sold_out ) {
756
+			if ($this->status() == EEM_Event::sold_out) {
757 757
 				// revert status to previous value, if it was set
758
-				$previous_event_status = $this->get_post_meta( '_previous_event_status', true );
759
-				if ( $previous_event_status ) {
760
-					$this->set_status( $previous_event_status );
758
+				$previous_event_status = $this->get_post_meta('_previous_event_status', true);
759
+				if ($previous_event_status) {
760
+					$this->set_status($previous_event_status);
761 761
 				}
762 762
 			}
763 763
 		}
@@ -781,15 +781,15 @@  discard block
 block discarded – undo
781 781
 	 */
782 782
 	public function spaces_remaining_for_sale() {
783 783
 		//first get total available spaces including consideration for tickets that have already sold.
784
-		$spaces_available = $this->total_available_spaces( true );
784
+		$spaces_available = $this->total_available_spaces(true);
785 785
 
786 786
 		//if total available = 0, then exit right away because that means everything is expired.
787
-		if ( $spaces_available === 0 ) {
787
+		if ($spaces_available === 0) {
788 788
 			return 0;
789 789
 		}
790 790
 
791 791
 		//subtract total approved registrations from spaces available to get how many are remaining.
792
-		$spots_taken = EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true );
792
+		$spots_taken = EEM_Registration::instance()->count(array(array('EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true);
793 793
 		$spaces_remaining = $spaces_available - $spots_taken;
794 794
 
795 795
 		return $spaces_remaining > 0 ? $spaces_remaining : 0;
@@ -822,29 +822,29 @@  discard block
 block discarded – undo
822 822
 	 *
823 823
 	 * @return  int|float  (Note: if EE_INF is returned its considered a float by PHP)
824 824
 	 */
825
-	public function total_available_spaces( $current_total_available = false ) {
825
+	public function total_available_spaces($current_total_available = false) {
826 826
 		$spaces_available = 0;
827 827
 
828 828
 		//first get all tickets on the event and include expired tickets
829
-		$tickets = $this->tickets( array( 'default_where_conditions' => 'none' ) );
829
+		$tickets = $this->tickets(array('default_where_conditions' => 'none'));
830 830
 		$ticket_sums = array();
831 831
 		$datetime_limits = array();
832 832
 
833 833
 		//loop through tickets and normalize them
834
-		foreach ( $tickets as $ticket ) {
835
-			$datetimes = $ticket->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) );
834
+		foreach ($tickets as $ticket) {
835
+			$datetimes = $ticket->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC')));
836 836
 
837
-			if ( empty( $datetimes ) ) {
837
+			if (empty($datetimes)) {
838 838
 				continue;
839 839
 			}
840 840
 
841 841
 			//first datetime should be the lowest datetime
842
-			$least_datetime = reset( $datetimes );
842
+			$least_datetime = reset($datetimes);
843 843
 
844 844
 			//lets reset the ticket quantity to be the lower of either the lowest datetime reg limit or the ticket quantity
845 845
 			//IF datetimes sold (and we're not doing current live total available, then use spaces remaining for datetime, not reg_limit.
846
-			if ( $current_total_available ) {
847
-				if ( $ticket->is_remaining() ) {
846
+			if ($current_total_available) {
847
+				if ($ticket->is_remaining()) {
848 848
 					$remaining = $ticket->remaining();
849 849
 				} else {
850 850
 					$spaces_available += $ticket->sold();
@@ -852,23 +852,23 @@  discard block
 block discarded – undo
852 852
 					continue;
853 853
 				}
854 854
 			} else {
855
-				$remaining = min( $ticket->qty(), $least_datetime->reg_limit() );
855
+				$remaining = min($ticket->qty(), $least_datetime->reg_limit());
856 856
 			}
857 857
 
858 858
 			//if $ticket_limit == infinity then let's drop out right away and just return that because any infinity amount trumps all other "available" amounts.
859
-			if ( $remaining === EE_INF ) {
859
+			if ($remaining === EE_INF) {
860 860
 				return EE_INF;
861 861
 			}
862 862
 
863 863
 			//multiply normalized $tkt quantity by the number of datetimes on the ticket as the "sum"
864 864
 			//also include the sum of all the datetime reg limits on the ticket for breaking ties.
865
-			$ticket_sums[$ticket->ID()]['sum'] = $remaining * count( $datetimes );
865
+			$ticket_sums[$ticket->ID()]['sum'] = $remaining * count($datetimes);
866 866
 			$ticket_sums[$ticket->ID()]['datetime_sums'] = 0;
867
-			foreach ( $datetimes as $datetime ) {
868
-				if ( $datetime->reg_limit() === EE_INF ) {
867
+			foreach ($datetimes as $datetime) {
868
+				if ($datetime->reg_limit() === EE_INF) {
869 869
 					$ticket_sums[$ticket->ID()]['datetime_sums'] = EE_INF;
870 870
 				} else {
871
-					$ticket_sums[ $ticket->ID() ]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
871
+					$ticket_sums[$ticket->ID()]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
872 872
 				}
873 873
 				$datetime_limits[$datetime->ID()] = $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
874 874
 			}
@@ -879,74 +879,74 @@  discard block
 block discarded – undo
879 879
 		//ticket quantity by the number of datetimes on the ticket).  For tie-breakers, then the next sort is based on the
880 880
 		//ticket with the greatest sum of all remaining datetime->spaces_remaining() ( or $datetime->reg_limit() if not
881 881
 		//$current_total_available ) for the datetimes on the ticket.
882
-		usort( $ticket_sums, function( $a, $b ) {
883
-			if ( $a['sum'] == $b['sum'] ) {
884
-				if ( $a['datetime_sums'] == $b['datetime_sums'] ) {
882
+		usort($ticket_sums, function($a, $b) {
883
+			if ($a['sum'] == $b['sum']) {
884
+				if ($a['datetime_sums'] == $b['datetime_sums']) {
885 885
 					return 0;
886 886
 				}
887 887
 
888 888
 				return $a['datetime_sums'] < $b['datetime_sums'] ? 1 : -1;
889 889
 			}
890
-			return ( $a['sum'] < $b['sum'] ) ? -1 : 1;
890
+			return ($a['sum'] < $b['sum']) ? -1 : 1;
891 891
 		});
892 892
 
893 893
 		//now let's loop through the sorted tickets and simulate sellouts
894
-		foreach ( $ticket_sums as $ticket_info ) {
895
-			if ( $ticket_info['ticket'] instanceof EE_Ticket ) {
894
+		foreach ($ticket_sums as $ticket_info) {
895
+			if ($ticket_info['ticket'] instanceof EE_Ticket) {
896 896
 
897
-				$datetimes = $ticket_info['ticket']->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) );
897
+				$datetimes = $ticket_info['ticket']->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC')));
898 898
 				//need to sort these $datetimes by remaining (only if $current_total_available)
899 899
 				//setup datetimes for simulation
900 900
 				$ticket_datetimes_remaining = array();
901
-				foreach( $datetimes as $datetime ) {
901
+				foreach ($datetimes as $datetime) {
902 902
 					$ticket_datetimes_remaining[$datetime->ID()]['rem'] = $datetime_limits[$datetime->ID()];
903 903
 					$ticket_datetimes_remaining[$datetime->ID()]['datetime'] = $datetime;
904 904
 				}
905
-				usort( $ticket_datetimes_remaining, function( $a, $b ) {
906
-					if ( $a['rem'] == $b['rem'] ) {
905
+				usort($ticket_datetimes_remaining, function($a, $b) {
906
+					if ($a['rem'] == $b['rem']) {
907 907
 						return 0;
908 908
 					}
909
-					return ( $a['rem'] < $b['rem'] ) ? -1 : 1;
909
+					return ($a['rem'] < $b['rem']) ? -1 : 1;
910 910
 				});
911 911
 
912 912
 
913 913
 				//get the remaining on the first datetime (which should be the one with the least remaining) and that is
914 914
 				//what we add to the spaces_available running total.  Then we need to decrease the remaining on our datetime tracker.
915
-				$lowest_datetime = reset( $ticket_datetimes_remaining );
915
+				$lowest_datetime = reset($ticket_datetimes_remaining);
916 916
 
917 917
 				//need to get the lower of; what the remaining is on the lowest datetime, and the remaining on the ticket.
918 918
 				// If this ends up being 0 (because of previous tickets in our simulation selling out), then it has already
919 919
 				// been tracked on $spaces available and this ticket is now sold out for the simulation, so we can continue
920 920
 				// to the next ticket.
921
-				if ( $current_total_available ) {
922
-					$remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->remaining() );
921
+				if ($current_total_available) {
922
+					$remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->remaining());
923 923
 				} else {
924
-					$remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->qty() );
924
+					$remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->qty());
925 925
 				}
926 926
 
927 927
 				//if $remaining is infinite that means that all datetimes on this ticket are infinite but we've made it here because all
928 928
 				//tickets have a quantity.  So we don't have to track datetimes, we can just use ticket quantities for total
929 929
 				//available.
930
-				if ( $remaining === EE_INF ) {
930
+				if ($remaining === EE_INF) {
931 931
 					$spaces_available += $ticket_info['ticket']->qty();
932 932
 					continue;
933 933
 				}
934 934
 
935 935
 				//if ticket has sold amounts then we also need to add that (but only if doing live counts)
936
-				if ( $current_total_available ) {
936
+				if ($current_total_available) {
937 937
 					$spaces_available += $ticket_info['ticket']->sold();
938 938
 				}
939 939
 
940
-				if ( $remaining <= 0 ) {
940
+				if ($remaining <= 0) {
941 941
 					continue;
942 942
 				} else {
943 943
 					$spaces_available += $remaining;
944 944
 				}
945 945
 
946 946
 				//loop through the datetimes and sell them out!
947
-				foreach ( $ticket_datetimes_remaining as $datetime_info ) {
948
-					if ( $datetime_info['datetime'] instanceof EE_Datetime ) {
949
-						$datetime_limits[ $datetime_info['datetime']->ID() ] += - $remaining;
947
+				foreach ($ticket_datetimes_remaining as $datetime_info) {
948
+					if ($datetime_info['datetime'] instanceof EE_Datetime) {
949
+						$datetime_limits[$datetime_info['datetime']->ID()] += - $remaining;
950 950
 					}
951 951
 				}
952 952
 			}
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 	 * @param  bool $actual whether or not to perform calculations to not only figure the actual status but also to flip the status if necessary to sold out If false, we just check the existing status of the event
963 963
 	 * @return boolean
964 964
 	 */
965
-	public function is_sold_out( $actual = FALSE ) {
966
-		if ( ! $actual ) {
965
+	public function is_sold_out($actual = FALSE) {
966
+		if ( ! $actual) {
967 967
 			return $this->status() == EEM_Event::sold_out;
968 968
 		}
969 969
 		else {
@@ -1008,30 +1008,30 @@  discard block
 block discarded – undo
1008 1008
 	 *
1009 1009
 	 * @return bool | string - based on EE_Datetime active constants or FALSE if error.
1010 1010
 	 */
1011
-	public function get_active_status( $reset = false ) {
1011
+	public function get_active_status($reset = false) {
1012 1012
 		// if the active status has already been set, then just use that value (unless we are resetting it)
1013
-		if ( ! empty( $this->_active_status ) && ! $reset ) {
1013
+		if ( ! empty($this->_active_status) && ! $reset) {
1014 1014
 			return $this->_active_status;
1015 1015
 		}
1016 1016
 		//first check if event id is present on this object
1017
-		if ( ! $this->ID() ) {
1017
+		if ( ! $this->ID()) {
1018 1018
 			return false;
1019 1019
 		}
1020 1020
 
1021
-		$where_params_for_event  = array( array( 'EVT_ID' => $this->ID() ) );
1021
+		$where_params_for_event = array(array('EVT_ID' => $this->ID()));
1022 1022
 
1023 1023
 		//if event is published:
1024
-		if ( $this->status() === 'publish' ) {
1024
+		if ($this->status() === 'publish') {
1025 1025
 			//active?
1026
-			if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::active, $where_params_for_event ) > 0 ) {
1026
+			if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::active, $where_params_for_event) > 0) {
1027 1027
 				$this->_active_status = EE_Datetime::active;
1028 1028
 			} else {
1029 1029
 				//upcoming?
1030
-				if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::upcoming, $where_params_for_event  ) > 0 ) {
1030
+				if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::upcoming, $where_params_for_event) > 0) {
1031 1031
 					$this->_active_status = EE_Datetime::upcoming;
1032 1032
 				} else {
1033 1033
 					//expired?
1034
-					if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::expired, $where_params_for_event  ) > 0 ) {
1034
+					if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::expired, $where_params_for_event) > 0) {
1035 1035
 						$this->_active_status = EE_Datetime::expired;
1036 1036
 					} else {
1037 1037
 						//it would be odd if things make it this far because it basically means there are no datetime's
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 			}
1043 1043
 		} else {
1044 1044
 			//the event is not published, so let's just set it's active status according to its' post status
1045
-			switch ( $this->status() ) {
1045
+			switch ($this->status()) {
1046 1046
 				case EEM_Event::sold_out :
1047 1047
 					$this->_active_status = EE_Datetime::sold_out;
1048 1048
 					break;
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 	 * @param boolean $echo     whether to return (FALSE), or echo out the result (TRUE)
1069 1069
 	 * @return mixed void|string
1070 1070
 	 */
1071
-	public function pretty_active_status( $echo = TRUE ) {
1071
+	public function pretty_active_status($echo = TRUE) {
1072 1072
 		$active_status = $this->get_active_status();
1073
-		$status = '<span class="ee-status event-active-status-' . $active_status . '">' . EEH_Template::pretty_status( $active_status, FALSE, 'sentence' ) . '</span>';
1074
-		if ( $echo ) {
1073
+		$status = '<span class="ee-status event-active-status-'.$active_status.'">'.EEH_Template::pretty_status($active_status, FALSE, 'sentence').'</span>';
1074
+		if ($echo) {
1075 1075
 			echo $status;
1076 1076
 			return '';
1077 1077
 		}
@@ -1085,12 +1085,12 @@  discard block
 block discarded – undo
1085 1085
 	 */
1086 1086
 	public function get_number_of_tickets_sold() {
1087 1087
 		$tkt_sold = 0;
1088
-		if ( !$this->ID() ) {
1088
+		if ( ! $this->ID()) {
1089 1089
 			return 0;
1090 1090
 		}
1091 1091
 		$datetimes = $this->datetimes();
1092
-		foreach ( $datetimes as $datetime ) {
1093
-			if ( $datetime instanceof EE_Datetime ) {
1092
+		foreach ($datetimes as $datetime) {
1093
+			if ($datetime instanceof EE_Datetime) {
1094 1094
 				$tkt_sold += $datetime->sold();
1095 1095
 			}
1096 1096
 		}
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 * @return int
1106 1106
 	 */
1107 1107
 	public function get_count_of_all_registrations() {
1108
-		return EEM_Event::instance()->count_related( $this, 'Registration' );
1108
+		return EEM_Event::instance()->count_related($this, 'Registration');
1109 1109
 	}
1110 1110
 
1111 1111
 
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
 	 * @return EE_Ticket
1116 1116
 	 */
1117 1117
 	public function get_ticket_with_earliest_start_time() {
1118
-		$where[ 'Datetime.EVT_ID' ] = $this->ID();
1119
-		$query_params = array( $where, 'order_by' => array( 'TKT_start_date' => 'ASC' ) );
1120
-		return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params );
1118
+		$where['Datetime.EVT_ID'] = $this->ID();
1119
+		$query_params = array($where, 'order_by' => array('TKT_start_date' => 'ASC'));
1120
+		return EE_Registry::instance()->load_model('Ticket')->get_one($query_params);
1121 1121
 	}
1122 1122
 
1123 1123
 
@@ -1127,9 +1127,9 @@  discard block
 block discarded – undo
1127 1127
 	 * @return EE_Ticket
1128 1128
 	 */
1129 1129
 	public function get_ticket_with_latest_end_time() {
1130
-		$where[ 'Datetime.EVT_ID' ] = $this->ID();
1131
-		$query_params = array( $where, 'order_by' => array( 'TKT_end_date' => 'DESC' ) );
1132
-		return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params );
1130
+		$where['Datetime.EVT_ID'] = $this->ID();
1131
+		$query_params = array($where, 'order_by' => array('TKT_end_date' => 'DESC'));
1132
+		return EE_Registry::instance()->load_model('Ticket')->get_one($query_params);
1133 1133
 	}
1134 1134
 
1135 1135
 
@@ -1141,11 +1141,11 @@  discard block
 block discarded – undo
1141 1141
 	public function tickets_on_sale() {
1142 1142
 		$earliest_ticket = $this->get_ticket_with_earliest_start_time();
1143 1143
 		$latest_ticket = $this->get_ticket_with_latest_end_time();
1144
-		if ( !$latest_ticket instanceof EE_Ticket && !$earliest_ticket instanceof EE_Ticket ) {
1144
+		if ( ! $latest_ticket instanceof EE_Ticket && ! $earliest_ticket instanceof EE_Ticket) {
1145 1145
 			return FALSE;
1146 1146
 		}
1147 1147
 		//check on sale for these two tickets.
1148
-		if ( $latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale() ) {
1148
+		if ($latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale()) {
1149 1149
 			return TRUE;
1150 1150
 		}
1151 1151
 		return FALSE;
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	 * @return string
1160 1160
 	 */
1161 1161
 	public function get_permalink() {
1162
-		if ( $this->external_url() ) {
1162
+		if ($this->external_url()) {
1163 1163
 			return $this->external_url();
1164 1164
 		}
1165 1165
 		else {
@@ -1174,10 +1174,10 @@  discard block
 block discarded – undo
1174 1174
 	 * @param array $query_params like EEM_Base::get_all
1175 1175
 	 * @return EE_Term
1176 1176
 	 */
1177
-	public function first_event_category( $query_params = array() ) {
1178
-		$query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories';
1179
-		$query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID();
1180
-		return EEM_Term::instance()->get_one( $query_params );
1177
+	public function first_event_category($query_params = array()) {
1178
+		$query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1179
+		$query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID();
1180
+		return EEM_Term::instance()->get_one($query_params);
1181 1181
 	}
1182 1182
 
1183 1183
 
@@ -1187,10 +1187,10 @@  discard block
 block discarded – undo
1187 1187
 	 * @param array $query_params
1188 1188
 	 * @return EE_Term[]
1189 1189
 	 */
1190
-	public function get_all_event_categories( $query_params = array() ) {
1191
-		$query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories';
1192
-		$query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID();
1193
-		return EEM_Term::instance()->get_all( $query_params );
1190
+	public function get_all_event_categories($query_params = array()) {
1191
+		$query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1192
+		$query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID();
1193
+		return EEM_Term::instance()->get_all($query_params);
1194 1194
 	}
1195 1195
 
1196 1196
 	/**
@@ -1198,8 +1198,8 @@  discard block
 block discarded – undo
1198 1198
 	 * @param array $query_params @see EEM_Base::get_all
1199 1199
 	 * @return EE_Question_Group[]
1200 1200
 	 */
1201
-	public function question_groups($query_params = array()){
1202
-		$query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'QSG_order' => 'ASC' ));
1201
+	public function question_groups($query_params = array()) {
1202
+		$query_params = ! empty($query_params) ? $query_params : array('order_by' => array('QSG_order' => 'ASC'));
1203 1203
 		return $this->get_many_related('Question_Group', $query_params);
1204 1204
 	}
1205 1205
 
@@ -1239,12 +1239,12 @@  discard block
 block discarded – undo
1239 1239
 	 */
1240 1240
 	public function get_admin_edit_link() {
1241 1241
 		EE_Registry::instance()->load_helper('URL');
1242
-		return EEH_URL::add_query_args_and_nonce( array(
1242
+		return EEH_URL::add_query_args_and_nonce(array(
1243 1243
 			'page' => 'espresso_events',
1244 1244
 			'action' => 'edit',
1245 1245
 			'post' => $this->ID()
1246 1246
 			),
1247
-			admin_url( 'admin.php' )
1247
+			admin_url('admin.php')
1248 1248
 		);
1249 1249
 	}
1250 1250
 
@@ -1257,11 +1257,11 @@  discard block
 block discarded – undo
1257 1257
 	 */
1258 1258
 	public function get_admin_settings_link() {
1259 1259
 		EE_Registry::instance()->load_helper('URL');
1260
-		return EEH_URL::add_query_args_and_nonce( array(
1260
+		return EEH_URL::add_query_args_and_nonce(array(
1261 1261
 			'page' => 'espresso_events',
1262 1262
 			'action' => 'default_event_settings'
1263 1263
 			),
1264
-			admin_url( 'admin.php' )
1264
+			admin_url('admin.php')
1265 1265
 		);
1266 1266
 	}
1267 1267
 
@@ -1277,11 +1277,11 @@  discard block
 block discarded – undo
1277 1277
 	public function get_admin_overview_link() {
1278 1278
 
1279 1279
 		EE_Registry::instance()->load_helper('URL');
1280
-		return EEH_URL::add_query_args_and_nonce( array(
1280
+		return EEH_URL::add_query_args_and_nonce(array(
1281 1281
 			'page' => 'espresso_events',
1282 1282
 			'action' => 'default'
1283 1283
 		),
1284
-			admin_url( 'admin.php' )
1284
+			admin_url('admin.php')
1285 1285
 		);
1286 1286
 	}
1287 1287
 
Please login to merge, or discard this patch.
core/libraries/rest_api/Capabilities.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 		}
78 78
 		foreach( $model->field_settings() as $field_name => $field_obj ){
79 79
 			if( $model_version_info->field_has_rendered_format( $field_obj )
80
-			    && isset( $entity[ $field_name ] )
80
+				&& isset( $entity[ $field_name ] )
81 81
 				&& is_array( $entity[ $field_name ] )
82 82
 				&& isset( $entity[ $field_name ][ 'raw' ] )
83 83
 			) {
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 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;
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
 /**
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
 	 * @param string $model_context one of the return values from EEM_Base::valid_cap_contexts()
22 22
 	 * @return boolean
23 23
 	 */
24
-	public static function current_user_has_partial_access_to( $model, $model_context = \EEM_Base::caps_read ) {
25
-		if( apply_filters( 'FHEE__Capabilities__current_user_has_partial_access_to__override_begin', false, $model, $model ) ) {
24
+	public static function current_user_has_partial_access_to($model, $model_context = \EEM_Base::caps_read) {
25
+		if (apply_filters('FHEE__Capabilities__current_user_has_partial_access_to__override_begin', false, $model, $model)) {
26 26
 			return true;
27 27
 		}
28
-		foreach( $model->caps_missing( $model_context ) as $capability_name => $restriction_obj ) {
29
-			if( $restriction_obj instanceof \EE_Return_None_Where_Conditions ){
28
+		foreach ($model->caps_missing($model_context) as $capability_name => $restriction_obj) {
29
+			if ($restriction_obj instanceof \EE_Return_None_Where_Conditions) {
30 30
 				return false;
31 31
 			}
32 32
 		}
33
-		if( apply_filters( 'FHEE__Capabilities__current_user_has_partial_access_to__override_end', false, $model, $model ) ) {
33
+		if (apply_filters('FHEE__Capabilities__current_user_has_partial_access_to__override_end', false, $model, $model)) {
34 34
 			return false;
35 35
 		}
36 36
 		return true;
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @param string $request_type one of the constants on WP_JSON_Server
44 44
 	 * @return array
45 45
 	 */
46
-	public static function get_missing_permissions( $model, $request_type = \EEM_Base::caps_read ) {
47
-		return $model->caps_missing( $request_type );
46
+	public static function get_missing_permissions($model, $request_type = \EEM_Base::caps_read) {
47
+		return $model->caps_missing($request_type);
48 48
 	}
49 49
 	/**
50 50
 	 * Gets a string of all the capabilities the current user is missing that affected
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 * @param string $model_context one of the return values from EEM_Base::valid_cap_contexts()
55 55
 	 * @return string
56 56
 	 */
57
-	public static function get_missing_permissions_string( $model, $model_context = \EEM_Base::caps_read ) {
58
-		return implode(',', array_keys( self::get_missing_permissions( $model, $model_context ) ) );
57
+	public static function get_missing_permissions_string($model, $model_context = \EEM_Base::caps_read) {
58
+		return implode(',', array_keys(self::get_missing_permissions($model, $model_context)));
59 59
 	}
60 60
 
61 61
 	/**
@@ -66,27 +66,27 @@  discard block
 block discarded – undo
66 66
 	 * @param Model_Version_Info $model_version_info
67 67
 	 * @return array ready for converting into json
68 68
 	 */
69
-	public static function filter_out_inaccessible_entity_fields( $entity,  $model, $request_type, $model_version_info ) {
69
+	public static function filter_out_inaccessible_entity_fields($entity, $model, $request_type, $model_version_info) {
70 70
 		//we only care to do this for frontend reads and when the user can't edit the item
71
-		if(  $request_type !== \EEM_Base::caps_read ||
72
-				$model->exists( array(
73
-					array( $model->primary_key_name() => $entity[ $model->primary_key_name() ] ),
71
+		if ($request_type !== \EEM_Base::caps_read ||
72
+				$model->exists(array(
73
+					array($model->primary_key_name() => $entity[$model->primary_key_name()]),
74 74
 					'default_where_conditions' => 'none',
75
-					'caps' => \EEM_Base::caps_edit ) ) ) {
75
+					'caps' => \EEM_Base::caps_edit ))) {
76 76
 			return $entity;
77 77
 		}
78
-		foreach( $model->field_settings() as $field_name => $field_obj ){
79
-			if( $model_version_info->field_has_rendered_format( $field_obj )
80
-			    && isset( $entity[ $field_name ] )
81
-				&& is_array( $entity[ $field_name ] )
82
-				&& isset( $entity[ $field_name ][ 'raw' ] )
78
+		foreach ($model->field_settings() as $field_name => $field_obj) {
79
+			if ($model_version_info->field_has_rendered_format($field_obj)
80
+			    && isset($entity[$field_name])
81
+				&& is_array($entity[$field_name])
82
+				&& isset($entity[$field_name]['raw'])
83 83
 			) {
84
-				unset( $entity[ $field_name ][ 'raw' ] );
84
+				unset($entity[$field_name]['raw']);
85 85
 			}
86 86
 		}
87 87
 		//theoretically we may want to filter out specific fields for specific models
88 88
 
89
-		return apply_filters( 'FHEE__Capabilities__filter_out_inaccessible_entity_fields', $entity, $model, $request_type );
89
+		return apply_filters('FHEE__Capabilities__filter_out_inaccessible_entity_fields', $entity, $model, $request_type);
90 90
 	}
91 91
 }
92 92
 
Please login to merge, or discard this patch.
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 1 patch
Spacing   +282 added lines, -282 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	 * @return EED_Single_Page_Checkout
39 39
 	 */
40 40
 	public static function instance() {
41
-		add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' );
42
-		return parent::get_instance( __CLASS__ );
41
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
42
+		return parent::get_instance(__CLASS__);
43 43
 	}
44 44
 
45 45
 
@@ -84,22 +84,22 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function set_hooks_admin() {
86 86
 		EED_Single_Page_Checkout::set_definitions();
87
-		if ( defined( 'DOING_AJAX' )) {
87
+		if (defined('DOING_AJAX')) {
88 88
 			// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
89 89
 			ob_start();
90 90
 			EED_Single_Page_Checkout::load_request_handler();
91 91
 			EED_Single_Page_Checkout::load_reg_steps();
92 92
 		} else {
93 93
 			// hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called
94
-			add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 );
94
+			add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1);
95 95
 		}
96 96
 		// set ajax hooks
97
-		add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
98
-		add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' ));
99
-		add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
100
-		add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' ));
101
-		add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
102
-		add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' ));
97
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
98
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
99
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
100
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
101
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
102
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
103 103
 	}
104 104
 
105 105
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * 	process ajax request
109 109
 	 * @param string $ajax_action
110 110
 	 */
111
-	public static function process_ajax_request( $ajax_action ) {
112
-		EE_Registry::instance()->REQ->set( 'action', $ajax_action );
111
+	public static function process_ajax_request($ajax_action) {
112
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
113 113
 		EED_Single_Page_Checkout::instance()->_initialize();
114 114
 	}
115 115
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * 	ajax display registration step
120 120
 	 */
121 121
 	public static function display_reg_step() {
122
-		EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' );
122
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
123 123
 	}
124 124
 
125 125
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * 	ajax process registration step
129 129
 	 */
130 130
 	public static function process_reg_step() {
131
-		EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' );
131
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
132 132
 	}
133 133
 
134 134
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * 	ajax process registration step
138 138
 	 */
139 139
 	public static function update_reg_step() {
140
-		EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' );
140
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
141 141
 	}
142 142
 
143 143
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @return void
150 150
 	 */
151 151
 	public static function update_checkout() {
152
-		EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' );
152
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
153 153
 	}
154 154
 
155 155
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public static function load_request_handler() {
164 164
 		// load core Request_Handler class
165
-		if ( ! isset( EE_Registry::instance()->REQ )) {
166
-			EE_Registry::instance()->load_core( 'Request_Handler' );
165
+		if ( ! isset(EE_Registry::instance()->REQ)) {
166
+			EE_Registry::instance()->load_core('Request_Handler');
167 167
 		}
168 168
 	}
169 169
 
@@ -176,21 +176,21 @@  discard block
 block discarded – undo
176 176
 	 *  @return 	void
177 177
 	 */
178 178
 	public static function set_definitions() {
179
-		define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS );
180
-		define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS );
181
-		define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS );
182
-		define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS );
183
-		define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS );
184
-		define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS );
185
-		define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS );
186
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE );
187
-		EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ] = sprintf(
188
-			__( '%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ),
179
+		define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
180
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
181
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
182
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
183
+		define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
184
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
185
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
186
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE);
187
+		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
188
+			__('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'),
189 189
 			'<h4 class="important-notice">',
190 190
 			'</h4>',
191 191
 			'<br />',
192 192
 			'<p>',
193
-			'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
193
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
194 194
 			'">',
195 195
 			'</a>',
196 196
 			'</p>'
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public static function load_reg_steps() {
211 211
 		static $reg_steps_loaded = FALSE;
212
-		if ( $reg_steps_loaded ) {
212
+		if ($reg_steps_loaded) {
213 213
 			return;
214 214
 		}
215 215
 		// filter list of reg_steps
@@ -218,24 +218,24 @@  discard block
 block discarded – undo
218 218
 			EED_Single_Page_Checkout::get_reg_steps()
219 219
 		);
220 220
 		// sort by key (order)
221
-		ksort( $reg_steps_to_load );
221
+		ksort($reg_steps_to_load);
222 222
 		// loop through folders
223
-		foreach ( $reg_steps_to_load as $order => $reg_step ) {
223
+		foreach ($reg_steps_to_load as $order => $reg_step) {
224 224
 			// we need a
225
-			if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
225
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
226 226
 				// copy over to the reg_steps_array
227
-				EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step;
227
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
228 228
 				// register custom key route for each reg step
229 229
 				// ie: step=>"slug" - this is the entire reason we load the reg steps array now
230
-				EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' );
230
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
231 231
 				// add AJAX or other hooks
232
-				if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) {
232
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
233 233
 					// setup autoloaders if necessary
234
-					if ( ! class_exists( $reg_step['class_name'] )) {
235
-						EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE );
234
+					if ( ! class_exists($reg_step['class_name'])) {
235
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE);
236 236
 					}
237
-					if ( is_callable( $reg_step['class_name'], 'set_hooks' )) {
238
-						call_user_func( array( $reg_step['class_name'], 'set_hooks' ));
237
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
238
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
239 239
 					}
240 240
 				}
241 241
 			}
@@ -254,28 +254,28 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public static function get_reg_steps() {
256 256
 		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
257
-		if ( empty( $reg_steps )) {
257
+		if (empty($reg_steps)) {
258 258
 			$reg_steps = array(
259 259
 				10 => array(
260
-					'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information',
260
+					'file_path' => SPCO_REG_STEPS_PATH.'attendee_information',
261 261
 					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
262 262
 					'slug' => 'attendee_information',
263 263
 					'has_hooks' => FALSE
264 264
 				),
265 265
 				20 => array(
266
-					'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation',
266
+					'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation',
267 267
 					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
268 268
 					'slug' => 'registration_confirmation',
269 269
 					'has_hooks' => FALSE
270 270
 				),
271 271
 				30 => array(
272
-					'file_path' => SPCO_REG_STEPS_PATH . 'payment_options',
272
+					'file_path' => SPCO_REG_STEPS_PATH.'payment_options',
273 273
 					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
274 274
 					'slug' => 'payment_options',
275 275
 					'has_hooks' => TRUE
276 276
 				),
277 277
 				999 => array(
278
-					'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration',
278
+					'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration',
279 279
 					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
280 280
 					'slug' => 'finalize_registration',
281 281
 					'has_hooks' => FALSE
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
 	 */
296 296
 	public static function registration_checkout_for_admin() {
297 297
 		EED_Single_Page_Checkout::load_reg_steps();
298
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
299
-		EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' );
300
-		EE_Registry::instance()->REQ->set( 'process_form_submission', false );
298
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
299
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
300
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
301 301
 		EED_Single_Page_Checkout::instance()->_initialize();
302 302
 		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
303 303
 		return EE_Registry::instance()->REQ->get_output();
@@ -313,15 +313,15 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	public static function process_registration_from_admin() {
315 315
 		EED_Single_Page_Checkout::load_reg_steps();
316
-		EE_Registry::instance()->REQ->set( 'step', 'attendee_information' );
317
-		EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' );
318
-		EE_Registry::instance()->REQ->set( 'process_form_submission', true );
316
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
317
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
318
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
319 319
 		EED_Single_Page_Checkout::instance()->_initialize();
320
-		if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) {
321
-			$final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps );
322
-			if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
323
-				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step );
324
-				if ( $final_reg_step->process_reg_step() ) {
320
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
321
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
322
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
323
+				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step);
324
+				if ($final_reg_step->process_reg_step()) {
325 325
 					$final_reg_step->set_completed();
326 326
 					EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array();
327 327
 					return EED_Single_Page_Checkout::instance()->checkout->transaction;
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
 	 * @param WP_Query $WP_Query
341 341
 	 * @return    void
342 342
 	 */
343
-	public function run( $WP_Query ) {
343
+	public function run($WP_Query) {
344 344
 		if (
345 345
 			$WP_Query instanceof WP_Query
346 346
 			&& $WP_Query->is_main_query()
347
-			&& apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )
347
+			&& apply_filters('FHEE__EED_Single_Page_Checkout__run', true)
348 348
 		) {
349 349
 			$this->_initialize();
350 350
 		}
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 	 * @param WP_Query $WP_Query
361 361
 	 * @return    void
362 362
 	 */
363
-	public static function init( $WP_Query ) {
364
-		EED_Single_Page_Checkout::instance()->run( $WP_Query );
363
+	public static function init($WP_Query) {
364
+		EED_Single_Page_Checkout::instance()->run($WP_Query);
365 365
 	}
366 366
 
367 367
 
@@ -375,29 +375,29 @@  discard block
 block discarded – undo
375 375
 	 */
376 376
 	private function _initialize() {
377 377
 		// ensure SPCO doesn't run twice
378
-		if ( EED_Single_Page_Checkout::$_initialized ) {
378
+		if (EED_Single_Page_Checkout::$_initialized) {
379 379
 			return;
380 380
 		}
381 381
 		$this->_verify_session();
382 382
 		// setup the EE_Checkout object
383 383
 		$this->checkout = $this->_initialize_checkout();
384 384
 		// filter checkout
385
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout );
385
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
386 386
 		// get the $_GET
387 387
 		$this->_get_request_vars();
388 388
 		// filter continue_reg
389
-		$this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout );
389
+		$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout);
390 390
 		// load the reg steps array
391
-		if ( ! $this->_load_and_instantiate_reg_steps() ) {
391
+		if ( ! $this->_load_and_instantiate_reg_steps()) {
392 392
 			EED_Single_Page_Checkout::$_initialized = true;
393 393
 			return;
394 394
 		}
395 395
 		// set the current step
396
-		$this->checkout->set_current_step( $this->checkout->step );
396
+		$this->checkout->set_current_step($this->checkout->step);
397 397
 		// and the next step
398 398
 		$this->checkout->set_next_step();
399 399
 		// verify that everything has been setup correctly
400
-		if ( ! ( $this->_verify_transaction_and_get_registrations() && $this->_final_verifications() ) ) {
400
+		if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) {
401 401
 			EED_Single_Page_Checkout::$_initialized = true;
402 402
 			return;
403 403
 		}
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
 		// set no cache headers and constants
423 423
 		EE_System::do_not_cache();
424 424
 		// add anchor
425
-		add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 );
425
+		add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
426 426
 		// remove transaction lock
427
-		add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 );
427
+		add_action('shutdown', array($this, 'unlock_transaction'), 1);
428 428
 	}
429 429
 
430 430
 
@@ -437,16 +437,16 @@  discard block
 block discarded – undo
437 437
 	 * @throws EE_Error
438 438
 	 */
439 439
 	private function _verify_session() {
440
-		if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) {
441
-			throw new EE_Error( __( 'The EE_Session class could not be loaded.', 'event_espresso' ) );
440
+		if ( ! EE_Registry::instance()->SSN instanceof EE_Session) {
441
+			throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso'));
442 442
 		}
443 443
 		// is session still valid ?
444
-		if ( EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) === '' ) {
444
+		if (EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '') {
445 445
 			$this->checkout = new EE_Checkout();
446 446
 			EE_Registry::instance()->SSN->reset_cart();
447 447
 			EE_Registry::instance()->SSN->reset_checkout();
448 448
 			EE_Registry::instance()->SSN->reset_transaction();
449
-			EE_Error::add_attention( EE_Registry::$i18n_js_strings[ 'registration_expiration_notice' ], __FILE__, __FUNCTION__, __LINE__ );
449
+			EE_Error::add_attention(EE_Registry::$i18n_js_strings['registration_expiration_notice'], __FILE__, __FUNCTION__, __LINE__);
450 450
 			EE_Registry::instance()->SSN->reset_expired();
451 451
 		}
452 452
 	}
@@ -466,20 +466,20 @@  discard block
 block discarded – undo
466 466
 		/** @type EE_Checkout $checkout */
467 467
 		$checkout = EE_Registry::instance()->SSN->checkout();
468 468
 		// verify
469
-		if ( ! $checkout instanceof EE_Checkout ) {
469
+		if ( ! $checkout instanceof EE_Checkout) {
470 470
 			// instantiate EE_Checkout object for handling the properties of the current checkout process
471
-			$checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE  );
471
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE);
472 472
 			// verify again
473
-			if ( ! $checkout instanceof EE_Checkout ) {
474
-				throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) );
473
+			if ( ! $checkout instanceof EE_Checkout) {
474
+				throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
475 475
 			}
476 476
 		} else {
477
-			if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true )  {
478
-				wp_safe_redirect( $checkout->redirect_url );
477
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
478
+				wp_safe_redirect($checkout->redirect_url);
479 479
 				exit();
480 480
 			}
481 481
 		}
482
-		$checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout );
482
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
483 483
 		// reset anything that needs a clean slate for each request
484 484
 		$checkout->reset_for_current_request();
485 485
 		return $checkout;
@@ -497,24 +497,24 @@  discard block
 block discarded – undo
497 497
 		// load classes
498 498
 		EED_Single_Page_Checkout::load_request_handler();
499 499
 		//make sure this request is marked as belonging to EE
500
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
500
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
501 501
 		// which step is being requested ?
502
-		$this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() );
502
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
503 503
 		// which step is being edited ?
504
-		$this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' );
504
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
505 505
 		// and what we're doing on the current step
506
-		$this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' );
506
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
507 507
 		// returning to edit ?
508
-		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' );
508
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
509 509
 		// or some other kind of revisit ?
510
-		$this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE );
510
+		$this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE);
511 511
 		// and whether or not to generate a reg form for this request
512
-		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); 		// TRUE 	FALSE
512
+		$this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE 	FALSE
513 513
 		// and whether or not to process a reg form submission for this request
514
-		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); 		// TRUE 	FALSE
514
+		$this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE 	FALSE
515 515
 		$this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step'
516 516
 			? $this->checkout->process_form_submission
517
-			: FALSE; 		// TRUE 	FALSE
517
+			: FALSE; // TRUE 	FALSE
518 518
 		//$this->_display_request_vars();
519 519
 	}
520 520
 
@@ -527,17 +527,17 @@  discard block
 block discarded – undo
527 527
 	 * @return    void
528 528
 	 */
529 529
 	protected function _display_request_vars() {
530
-		if ( ! WP_DEBUG ) {
530
+		if ( ! WP_DEBUG) {
531 531
 			return;
532 532
 		}
533
-		EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
534
-		EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ );
535
-		EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ );
536
-		EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ );
537
-		EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ );
538
-		EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ );
539
-		EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ );
540
-		EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ );
533
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
534
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
535
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
536
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
537
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
538
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
539
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
540
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
541 541
 	}
542 542
 
543 543
 
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 	 * @return    array
552 552
 	 */
553 553
 	private function _get_first_step() {
554
-		$first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array );
555
-		return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information';
554
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
555
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
556 556
 	}
557 557
 
558 558
 
@@ -568,27 +568,27 @@  discard block
 block discarded – undo
568 568
 	private function _load_and_instantiate_reg_steps() {
569 569
 		// have reg_steps already been instantiated ?
570 570
 		if (
571
-			empty( $this->checkout->reg_steps ) ||
572
-			apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout )
571
+			empty($this->checkout->reg_steps) ||
572
+			apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
573 573
 		) {
574 574
 			// if not, then loop through raw reg steps array
575
-			foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) {
576
-				if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) {
575
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
576
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
577 577
 					return false;
578 578
 				}
579 579
 			}
580 580
 			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE;
581 581
 			EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE;
582 582
 			// skip the registration_confirmation page ?
583
-			if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) {
583
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
584 584
 				// just remove it from the reg steps array
585
-				$this->checkout->remove_reg_step( 'registration_confirmation', false );
585
+				$this->checkout->remove_reg_step('registration_confirmation', false);
586 586
 			} else if (
587 587
 				EE_Registry::instance()->CFG->registration->reg_confirmation_last
588
-				&& isset( $this->checkout->reg_steps['registration_confirmation'] )
588
+				&& isset($this->checkout->reg_steps['registration_confirmation'])
589 589
 			) {
590 590
 				// set the order to something big like 100
591
-				$this->checkout->set_reg_step_order( 'registration_confirmation', 100 );
591
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
592 592
 			}
593 593
 			// filter the array for good luck
594 594
 			$this->checkout->reg_steps = apply_filters(
@@ -598,13 +598,13 @@  discard block
 block discarded – undo
598 598
 			// finally re-sort based on the reg step class order properties
599 599
 			$this->checkout->sort_reg_steps();
600 600
 		} else {
601
-			foreach ( $this->checkout->reg_steps as $reg_step ) {
601
+			foreach ($this->checkout->reg_steps as $reg_step) {
602 602
 				// set all current step stati to FALSE
603
-				$reg_step->set_is_current_step( FALSE );
603
+				$reg_step->set_is_current_step(FALSE);
604 604
 			}
605 605
 		}
606
-		if ( empty( $this->checkout->reg_steps )) {
607
-			EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
606
+		if (empty($this->checkout->reg_steps)) {
607
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
608 608
 			return false;
609 609
 		}
610 610
 			// make reg step details available to JS
@@ -622,10 +622,10 @@  discard block
 block discarded – undo
622 622
 	 * @param int   $order
623 623
 	 * @return bool
624 624
 	 */
625
-	private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) {
625
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) {
626 626
 
627 627
 		// we need a file_path, class_name, and slug to add a reg step
628
-		if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) {
628
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
629 629
 			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
630 630
 			if (
631 631
 				$this->checkout->reg_url_link
@@ -643,26 +643,26 @@  discard block
 block discarded – undo
643 643
 				FALSE
644 644
 			);
645 645
 			// did we gets the goods ?
646
-			if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) {
646
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
647 647
 				// set reg step order based on config
648
-				$reg_step_obj->set_order( $order );
648
+				$reg_step_obj->set_order($order);
649 649
 				// add instantiated reg step object to the master reg steps array
650
-				$this->checkout->add_reg_step( $reg_step_obj );
650
+				$this->checkout->add_reg_step($reg_step_obj);
651 651
 			} else {
652 652
 				EE_Error::add_error(
653
-					__( 'The current step could not be set.', 'event_espresso' ),
653
+					__('The current step could not be set.', 'event_espresso'),
654 654
 					__FILE__, __FUNCTION__, __LINE__
655 655
 				);
656 656
 				return false;
657 657
 			}
658 658
 		} else {
659
-			if ( WP_DEBUG ) {
659
+			if (WP_DEBUG) {
660 660
 				EE_Error::add_error(
661 661
 					sprintf(
662
-						__( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ),
663
-						isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '',
664
-						isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '',
665
-						isset( $reg_step['slug'] ) ? $reg_step['slug'] : '',
662
+						__('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'),
663
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
664
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
665
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
666 666
 						'<ul>',
667 667
 						'<li>',
668 668
 						'</li>',
@@ -686,15 +686,15 @@  discard block
 block discarded – undo
686 686
 	 */
687 687
 	private function _verify_transaction_and_get_registrations() {
688 688
 		// was there already a valid transaction in the checkout from the session ?
689
-		if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
689
+		if ( ! $this->checkout->transaction instanceof EE_Transaction) {
690 690
 			// get transaction from db or session
691 691
 			$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin()
692 692
 				? $this->_get_transaction_and_cart_for_previous_visit()
693 693
 				: $this->_get_cart_for_current_session_and_setup_new_transaction();
694 694
 
695
-			if ( ! $this->checkout->transaction instanceof EE_Transaction ) {
695
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
696 696
 				EE_Error::add_error(
697
-					__( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ),
697
+					__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'),
698 698
 					__FILE__, __FUNCTION__, __LINE__
699 699
 				);
700 700
 				$this->checkout->transaction = EE_Transaction::new_instance();
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 				return false;
705 705
 			}
706 706
 			// and the registrations for the transaction
707
-			$this->_get_registrations( $this->checkout->transaction );
707
+			$this->_get_registrations($this->checkout->transaction);
708 708
 		}
709 709
 		return true;
710 710
 	}
@@ -719,16 +719,16 @@  discard block
 block discarded – undo
719 719
 	 */
720 720
 	private function _get_transaction_and_cart_for_previous_visit() {
721 721
 		/** @var $TXN_model EEM_Transaction */
722
-		$TXN_model = EE_Registry::instance()->load_model( 'Transaction' );
722
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
723 723
 		// because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db
724
-		$transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link );
724
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
725 725
 		// verify transaction
726
-		if ( $transaction instanceof EE_Transaction ) {
726
+		if ($transaction instanceof EE_Transaction) {
727 727
 			// and get the cart that was used for that transaction
728
-			$this->checkout->cart = $this->_get_cart_for_transaction( $transaction );
728
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
729 729
 			return $transaction;
730 730
 		} else {
731
-			EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
731
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
732 732
 			return NULL;
733 733
 		}
734 734
 	}
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
 	 * @param EE_Transaction $transaction
743 743
 	 * @return EE_Cart
744 744
 	 */
745
-	private function _get_cart_for_transaction( $transaction ) {
746
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL;
745
+	private function _get_cart_for_transaction($transaction) {
746
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL;
747 747
 		// verify cart
748
-		if ( ! $cart instanceof EE_Cart ) {
749
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
748
+		if ( ! $cart instanceof EE_Cart) {
749
+			$cart = EE_Registry::instance()->load_core('Cart');
750 750
 		}
751 751
 		return $cart;
752 752
 	}
@@ -761,8 +761,8 @@  discard block
 block discarded – undo
761 761
 	 * @param EE_Transaction $transaction
762 762
 	 * 	@return EE_Cart
763 763
 	 */
764
-	public function get_cart_for_transaction( EE_Transaction $transaction ) {
765
-		return EE_Cart::get_cart_from_txn( $transaction );
764
+	public function get_cart_for_transaction(EE_Transaction $transaction) {
765
+		return EE_Cart::get_cart_from_txn($transaction);
766 766
 	}
767 767
 
768 768
 
@@ -777,15 +777,15 @@  discard block
 block discarded – undo
777 777
 	private function _get_cart_for_current_session_and_setup_new_transaction() {
778 778
 		//  if there's no transaction, then this is the FIRST visit to SPCO
779 779
 		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
780
-		$this->checkout->cart = $this->_get_cart_for_transaction( NULL );
780
+		$this->checkout->cart = $this->_get_cart_for_transaction(NULL);
781 781
 		// and then create a new transaction
782 782
 		$transaction = $this->_initialize_transaction();
783 783
 		// verify transaction
784
-		if ( $transaction instanceof EE_Transaction ) {
784
+		if ($transaction instanceof EE_Transaction) {
785 785
 			// and save TXN data to the cart
786
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() );
786
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
787 787
 		} else {
788
-			EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
788
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
789 789
 		}
790 790
 		return $transaction;
791 791
 	}
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 			// grab the cart grand total
806 806
 			$cart_total = $this->checkout->cart->get_cart_grand_total();
807 807
 			// create new TXN
808
-			$transaction = EE_Transaction::new_instance( array(
808
+			$transaction = EE_Transaction::new_instance(array(
809 809
 				'TXN_timestamp' 	=> time(),
810 810
 				'TXN_reg_steps' 		=> $this->checkout->initialize_txn_reg_steps_array(),
811 811
 				'TXN_total' 				=> $cart_total > 0 ? $cart_total : 0,
@@ -820,8 +820,8 @@  discard block
 block discarded – undo
820 820
 				$transaction->ID()
821 821
 			);
822 822
 			return $transaction;
823
-		} catch( Exception $e ) {
824
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
823
+		} catch (Exception $e) {
824
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
825 825
 		}
826 826
 		return NULL;
827 827
 	}
@@ -835,34 +835,34 @@  discard block
 block discarded – undo
835 835
 	 * @param EE_Transaction $transaction
836 836
 	 * @return EE_Cart
837 837
 	 */
838
-	private function _get_registrations( EE_Transaction $transaction ) {
838
+	private function _get_registrations(EE_Transaction $transaction) {
839 839
 		// first step: grab the registrants  { : o
840
-		$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true );
840
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
841 841
 		// verify registrations have been set
842
-		if ( empty( $registrations )) {
842
+		if (empty($registrations)) {
843 843
 			// if no cached registrations, then check the db
844
-			$registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false );
844
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
845 845
 			// still nothing ? well as long as this isn't a revisit
846
-			if ( empty( $registrations ) && ! $this->checkout->revisit ) {
846
+			if (empty($registrations) && ! $this->checkout->revisit) {
847 847
 				// generate new registrations from scratch
848
-				$registrations = $this->_initialize_registrations( $transaction );
848
+				$registrations = $this->_initialize_registrations($transaction);
849 849
 			}
850 850
 		}
851 851
 		// sort by their original registration order
852
-		usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' ));
852
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
853 853
 		// then loop thru the array
854
-		foreach ( $registrations as $registration ) {
854
+		foreach ($registrations as $registration) {
855 855
 			// verify each registration
856
-			if ( $registration instanceof EE_Registration ) {
856
+			if ($registration instanceof EE_Registration) {
857 857
 				// we display all attendee info for the primary registrant
858
-				if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) {
858
+				if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) {
859 859
 					$this->checkout->primary_revisit = TRUE;
860 860
 					break;
861
-				} else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) {
861
+				} else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) {
862 862
 					// but hide info if it doesn't belong to you
863
-					$transaction->clear_cache( 'Registration', $registration->ID() );
863
+					$transaction->clear_cache('Registration', $registration->ID());
864 864
 				}
865
-				$this->checkout->set_reg_status_updated( $registration->ID(), false );
865
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
866 866
 			}
867 867
 		}
868 868
 	}
@@ -876,17 +876,17 @@  discard block
 block discarded – undo
876 876
 	 * @param EE_Transaction $transaction
877 877
 	 * @return    array
878 878
 	 */
879
-	private function _initialize_registrations( EE_Transaction $transaction ) {
879
+	private function _initialize_registrations(EE_Transaction $transaction) {
880 880
 		$att_nmbr = 0;
881 881
 		$registrations = array();
882
-		if ( $transaction instanceof EE_Transaction ) {
882
+		if ($transaction instanceof EE_Transaction) {
883 883
 			/** @type EE_Registration_Processor $registration_processor */
884
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
884
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
885 885
 			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
886 886
 			// now let's add the cart items to the $transaction
887
-			foreach ( $this->checkout->cart->get_tickets() as $line_item ) {
887
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
888 888
 				//do the following for each ticket of this type they selected
889
-				for ( $x = 1; $x <= $line_item->quantity(); $x++ ) {
889
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
890 890
 					$att_nmbr++;
891 891
 					$registration = $registration_processor->generate_ONE_registration_from_line_item(
892 892
 						$line_item,
@@ -894,12 +894,12 @@  discard block
 block discarded – undo
894 894
 						$att_nmbr,
895 895
 						$this->checkout->total_ticket_count
896 896
 					);
897
-					if ( $registration instanceof EE_Registration ) {
898
-						$registrations[ $registration->ID() ] = $registration;
897
+					if ($registration instanceof EE_Registration) {
898
+						$registrations[$registration->ID()] = $registration;
899 899
 					}
900 900
 				}
901 901
 			}
902
-			$registration_processor->fix_reg_final_price_rounding_issue( $transaction );
902
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
903 903
 		}
904 904
 		return $registrations;
905 905
 	}
@@ -914,12 +914,12 @@  discard block
 block discarded – undo
914 914
 	 * @param EE_Registration $reg_B
915 915
 	 * @return array()
916 916
 	 */
917
-	public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) {
917
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) {
918 918
 		// this shouldn't ever happen within the same TXN, but oh well
919
-		if ( $reg_A->count() == $reg_B->count() ) {
919
+		if ($reg_A->count() == $reg_B->count()) {
920 920
 			return 0;
921 921
 		}
922
-		return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1;
922
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
923 923
 	}
924 924
 
925 925
 
@@ -934,35 +934,35 @@  discard block
 block discarded – undo
934 934
 	 */
935 935
 	private function _final_verifications() {
936 936
 		// filter checkout
937
-		$this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout );
937
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
938 938
 		//verify that current step is still set correctly
939
-		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) {
940
-			EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
939
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
940
+			EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
941 941
 			return false;
942 942
 		}
943 943
 		// if returning to SPCO, then verify that primary registrant is set
944
-		if ( ! empty( $this->checkout->reg_url_link )) {
944
+		if ( ! empty($this->checkout->reg_url_link)) {
945 945
 			$valid_registrant = $this->checkout->transaction->primary_registration();
946
-			if ( ! $valid_registrant instanceof EE_Registration ) {
947
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
946
+			if ( ! $valid_registrant instanceof EE_Registration) {
947
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
948 948
 				return false;
949 949
 			}
950 950
 			$valid_registrant = null;
951
-			foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) {
952
-				if ( $registration instanceof EE_Registration ) {
953
-					if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) {
951
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
952
+				if ($registration instanceof EE_Registration) {
953
+					if ($registration->reg_url_link() == $this->checkout->reg_url_link) {
954 954
 						$valid_registrant = $registration;
955 955
 					}
956 956
 				}
957 957
 			}
958
-			if ( ! $valid_registrant instanceof EE_Registration ) {
959
-				EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
958
+			if ( ! $valid_registrant instanceof EE_Registration) {
959
+				EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
960 960
 				return false;
961 961
 			}
962 962
 		}
963 963
 		// now that things have been kinda sufficiently verified,
964 964
 		// let's add the checkout to the session so that's available other systems
965
-		EE_Registry::instance()->SSN->set_checkout( $this->checkout );
965
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
966 966
 		return true;
967 967
 	}
968 968
 
@@ -978,28 +978,28 @@  discard block
 block discarded – undo
978 978
 	 * @access    private
979 979
 	 * @param bool $reinitializing
980 980
 	 */
981
-	private function _initialize_reg_steps( $reinitializing = false ) {
982
-		$this->checkout->set_reg_step_initiated( $this->checkout->current_step );
981
+	private function _initialize_reg_steps($reinitializing = false) {
982
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
983 983
 		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
984
-		foreach ( $this->checkout->reg_steps as $reg_step ) {
985
-			if ( ! $reg_step->initialize_reg_step() ) {
984
+		foreach ($this->checkout->reg_steps as $reg_step) {
985
+			if ( ! $reg_step->initialize_reg_step()) {
986 986
 				// if not initialized then maybe this step is being removed...
987
-				if ( $reg_step->is_current_step() && ! $reinitializing ) {
987
+				if ($reg_step->is_current_step() && ! $reinitializing) {
988 988
 					// if it was the current step, then we need to start over here
989
-					$this->_initialize_reg_steps( true );
989
+					$this->_initialize_reg_steps(true);
990 990
 					return;
991 991
 				}
992 992
 				continue;
993 993
 			}
994 994
 			// i18n
995 995
 			$reg_step->translate_js_strings();
996
-			if ( $reg_step->is_current_step() ) {
996
+			if ($reg_step->is_current_step()) {
997 997
 				// the text that appears on the reg step form submit button
998 998
 				$reg_step->set_submit_button_text();
999 999
 			}
1000 1000
 		}
1001 1001
 		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
1002
-		do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step );
1002
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
1003 1003
 	}
1004 1004
 
1005 1005
 
@@ -1012,39 +1012,39 @@  discard block
 block discarded – undo
1012 1012
 	 */
1013 1013
 	private function _check_form_submission() {
1014 1014
 		//does this request require the reg form to be generated ?
1015
-		if ( $this->checkout->generate_reg_form ) {
1015
+		if ($this->checkout->generate_reg_form) {
1016 1016
 			// ever heard that song by Blue Rodeo ?
1017 1017
 			try {
1018 1018
 				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
1019 1019
 				// if not displaying a form, then check for form submission
1020
-				if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) {
1020
+				if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) {
1021 1021
 					// clear out any old data in case this step is being run again
1022
-					$this->checkout->current_step->set_valid_data( array() );
1022
+					$this->checkout->current_step->set_valid_data(array());
1023 1023
 					// capture submitted form data
1024 1024
 					$this->checkout->current_step->reg_form->receive_form_submission(
1025
-						apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout )
1025
+						apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout)
1026 1026
 					);
1027 1027
 					// validate submitted form data
1028
-					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) {
1028
+					if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) {
1029 1029
 						// thou shall not pass !!!
1030 1030
 						$this->checkout->continue_reg = FALSE;
1031 1031
 						// any form validation errors?
1032
-						if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) {
1032
+						if ($this->checkout->current_step->reg_form->submission_error_message() != '') {
1033 1033
 							$submission_error_messages = array();
1034 1034
 							// bad, bad, bad registrant
1035
-							foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){
1036
-								if ( $validation_error instanceof EE_Validation_Error ) {
1037
-									$submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() );
1035
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
1036
+								if ($validation_error instanceof EE_Validation_Error) {
1037
+									$submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage());
1038 1038
 								}
1039 1039
 							}
1040
-							EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1040
+							EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1041 1041
 						}
1042 1042
 						// well not really... what will happen is we'll just get redirected back to redo the current step
1043 1043
 						$this->go_to_next_step();
1044 1044
 						return;
1045 1045
 					}
1046 1046
 				}
1047
-			} catch( EE_Error $e ) {
1047
+			} catch (EE_Error $e) {
1048 1048
 				$e->get_error();
1049 1049
 			}
1050 1050
 		}
@@ -1060,38 +1060,38 @@  discard block
 block discarded – undo
1060 1060
 	 */
1061 1061
 	private function _process_form_action() {
1062 1062
 		// what cha wanna do?
1063
-		switch( $this->checkout->action ) {
1063
+		switch ($this->checkout->action) {
1064 1064
 			// AJAX next step reg form
1065 1065
 			case 'display_spco_reg_step' :
1066 1066
 				$this->checkout->redirect = FALSE;
1067
-				if ( EE_Registry::instance()->REQ->ajax ) {
1068
-					$this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() );
1067
+				if (EE_Registry::instance()->REQ->ajax) {
1068
+					$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
1069 1069
 				}
1070 1070
 				break;
1071 1071
 
1072 1072
 			default :
1073 1073
 				// meh... do one of those other steps first
1074
-				if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) {
1074
+				if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
1075 1075
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
1076
-					do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1076
+					do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1077 1077
 					// call action on current step
1078
-					if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) {
1078
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
1079 1079
 						// good registrant, you get to proceed
1080
-						if ( $this->checkout->current_step->success_message() != '' ) {
1081
-							if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) {
1082
-								EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() );
1080
+						if ($this->checkout->current_step->success_message() != '') {
1081
+							if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) {
1082
+								EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions());
1083 1083
 							}
1084 1084
 						}
1085 1085
 						// pack it up, pack it in...
1086 1086
 						$this->_setup_redirect();
1087 1087
 					}
1088 1088
 					// dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
1089
-					do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step );
1089
+					do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1090 1090
 
1091 1091
 				} else {
1092 1092
 					EE_Error::add_error(
1093 1093
 						sprintf(
1094
-							__( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ),
1094
+							__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1095 1095
 							$this->checkout->action,
1096 1096
 							$this->checkout->current_step->name()
1097 1097
 						),
@@ -1117,10 +1117,10 @@  discard block
 block discarded – undo
1117 1117
 	public function add_styles_and_scripts() {
1118 1118
 		// i18n
1119 1119
 		$this->translate_js_strings();
1120
-		if ( $this->checkout->admin_request ) {
1121
-			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 );
1120
+		if ($this->checkout->admin_request) {
1121
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1122 1122
 		} else {
1123
-			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 );
1123
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1124 1124
 		}
1125 1125
 	}
1126 1126
 
@@ -1136,50 +1136,50 @@  discard block
 block discarded – undo
1136 1136
 		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1137 1137
 		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1138 1138
 		EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1139
-		EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' );
1140
-		EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' );
1141
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' );
1139
+		EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1140
+		EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso');
1141
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso');
1142 1142
 		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1143 1143
 		EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso');
1144 1144
 		EE_Registry::$i18n_js_strings['process_registration'] = sprintf(
1145
-			__( 'Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso' ),
1145
+			__('Please wait while we process your registration.%1$sDo not refresh the page or navigate away while this is happening.%1$sThank you for your patience.', 'event_espresso'),
1146 1146
 			'<br/>'
1147 1147
 		);
1148
-		EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' );
1148
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1149 1149
 		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1150 1150
 		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1151 1151
 		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1152
-		EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' );
1153
-		EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' );
1154
-		EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' );
1155
-		EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' );
1156
-		EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' );
1157
-		EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' );
1158
-		EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' );
1159
-		EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' );
1160
-		EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' );
1161
-		EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' );
1162
-		EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' );
1163
-		EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' );
1164
-		EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' );
1165
-		EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' );
1152
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1153
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1154
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1155
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1156
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1157
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1158
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1159
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1160
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1161
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1162
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1163
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1164
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1165
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1166 1166
 		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1167
-			__( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ),
1167
+			__('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'),
1168 1168
 			'<h4 class="important-notice">',
1169 1169
 			'</h4>',
1170 1170
 			'<br />',
1171 1171
 			'<p>',
1172
-			'<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="',
1172
+			'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1173 1173
 			'">',
1174 1174
 			'</a>',
1175 1175
 			'</p>'
1176 1176
 		);
1177
-		EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true );
1178
-		EE_Registry::$i18n_js_strings[ 'session_extension' ] = absint(
1179
-			apply_filters( 'FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS )
1177
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1178
+		EE_Registry::$i18n_js_strings['session_extension'] = absint(
1179
+			apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS)
1180 1180
 		);
1181
-		EE_Registry::$i18n_js_strings[ 'session_expiration' ] = gmdate(
1182
-			'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS )
1181
+		EE_Registry::$i18n_js_strings['session_expiration'] = gmdate(
1182
+			'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)
1183 1183
 		);
1184 1184
 
1185 1185
 
@@ -1195,31 +1195,31 @@  discard block
 block discarded – undo
1195 1195
 	 */
1196 1196
 	public function enqueue_styles_and_scripts() {
1197 1197
 		// load css
1198
-		wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION );
1199
-		wp_enqueue_style( 'single_page_checkout' );
1198
+		wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1199
+		wp_enqueue_style('single_page_checkout');
1200 1200
 		// load JS
1201
-		wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array( 'jquery' ), '1.0.1', TRUE );
1202
-		wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE );
1201
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', TRUE);
1202
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE);
1203 1203
 		wp_register_script(
1204 1204
 			'single_page_checkout',
1205
-			SPCO_JS_URL . 'single_page_checkout.js',
1206
-			array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ),
1205
+			SPCO_JS_URL.'single_page_checkout.js',
1206
+			array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'),
1207 1207
 			EVENT_ESPRESSO_VERSION,
1208 1208
 			TRUE
1209 1209
 		);
1210
-		wp_enqueue_script( 'single_page_checkout' );
1210
+		wp_enqueue_script('single_page_checkout');
1211 1211
 
1212 1212
 		/**
1213 1213
 		 * global action hook for enqueueing styles and scripts with
1214 1214
 		 * spco calls.
1215 1215
 		 */
1216
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this );
1216
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1217 1217
 
1218 1218
 		/**
1219 1219
 		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1220 1220
 		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1221 1221
 		 */
1222
-		do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this );
1222
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1223 1223
 
1224 1224
 		// add css and JS for current step
1225 1225
 		$this->checkout->current_step->enqueue_styles_and_scripts();
@@ -1235,21 +1235,21 @@  discard block
 block discarded – undo
1235 1235
 	 */
1236 1236
 	private function _display_spco_reg_form() {
1237 1237
 		// if registering via the admin, just display the reg form for the current step
1238
-		if ( $this->checkout->admin_request ) {
1239
-			EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() );
1238
+		if ($this->checkout->admin_request) {
1239
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1240 1240
 		} else {
1241 1241
 			// add powered by EE msg
1242
-			add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' ));
1242
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1243 1243
 
1244
-			$empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false;
1245
-			EE_Registry::$i18n_js_strings[ 'empty_cart' ] = $empty_cart;
1244
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false;
1245
+			EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart;
1246 1246
 			$cookies_not_set_msg = '';
1247
-			if ( $empty_cart ) {
1248
-				if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) {
1247
+			if ($empty_cart) {
1248
+				if ( ! isset($_COOKIE['ee_cookie_test'])) {
1249 1249
 					$cookies_not_set_msg = apply_filters(
1250 1250
 						'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1251 1251
 						sprintf(
1252
-							__( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ),
1252
+							__('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'),
1253 1253
 							'<div class="ee-attention">',
1254 1254
 							'</div>',
1255 1255
 							'<h6 class="important-notice">',
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
 					'layout_strategy' =>
1271 1271
 						new EE_Template_Layout(
1272 1272
 							array(
1273
-								'layout_template_file' 			=> SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1273
+								'layout_template_file' 			=> SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1274 1274
 								'template_args' => array(
1275 1275
 									'empty_cart' 		=> $empty_cart,
1276 1276
 									'revisit' 				=> $this->checkout->revisit,
@@ -1279,8 +1279,8 @@  discard block
 block discarded – undo
1279 1279
 									'empty_msg' 		=> apply_filters(
1280 1280
 										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1281 1281
 										sprintf(
1282
-											__( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ),
1283
-											'<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="',
1282
+											__('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'),
1283
+											'<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1284 1284
 											'">',
1285 1285
 											'</a>'
1286 1286
 										)
@@ -1298,7 +1298,7 @@  discard block
 block discarded – undo
1298 1298
 				)
1299 1299
 			);
1300 1300
 			// load template and add to output sent that gets filtered into the_content()
1301
-			EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() );
1301
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js());
1302 1302
 		}
1303 1303
 	}
1304 1304
 
@@ -1312,8 +1312,8 @@  discard block
 block discarded – undo
1312 1312
 	 * @internal  param string $label
1313 1313
 	 * @return        string
1314 1314
 	 */
1315
-	public function add_extra_finalize_registration_inputs( $next_step ) {
1316
-		if ( $next_step == 'finalize_registration' ) {
1315
+	public function add_extra_finalize_registration_inputs($next_step) {
1316
+		if ($next_step == 'finalize_registration') {
1317 1317
 			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1318 1318
 		}
1319 1319
 	}
@@ -1327,18 +1327,18 @@  discard block
 block discarded – undo
1327 1327
 	 *  @return 	string
1328 1328
 	 */
1329 1329
 	public static function display_registration_footer() {
1330
-		if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) {
1331
-			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1332
-			$url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' );
1333
-			$url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url );
1330
+		if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) {
1331
+			EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default';
1332
+			$url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/');
1333
+			$url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1334 1334
 			echo apply_filters(
1335 1335
 				'FHEE__EE_Front_Controller__display_registration_footer',
1336 1336
 				sprintf(
1337
-					__( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ),
1338
-					'<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="',
1337
+					__('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'),
1338
+					'<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="',
1339 1339
 					'" target="_blank">',
1340 1340
 					'</a>',
1341
-					'<a href="' . $url . '" title="',
1341
+					'<a href="'.$url.'" title="',
1342 1342
 					'" target="_blank">',
1343 1343
 					'</a></div>'
1344 1344
 				)
@@ -1369,12 +1369,12 @@  discard block
 block discarded – undo
1369 1369
 	 * @return 	array
1370 1370
 	 */
1371 1371
 	private function _setup_redirect() {
1372
-		if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) {
1372
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1373 1373
 			$this->checkout->redirect = TRUE;
1374
-			if ( empty( $this->checkout->redirect_url )) {
1374
+			if (empty($this->checkout->redirect_url)) {
1375 1375
 				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1376 1376
 			}
1377
-			$this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout );
1377
+			$this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout);
1378 1378
 		}
1379 1379
 	}
1380 1380
 
@@ -1387,12 +1387,12 @@  discard block
 block discarded – undo
1387 1387
 	 * @return void
1388 1388
 	 */
1389 1389
 	public function go_to_next_step() {
1390
-		if ( EE_Registry::instance()->REQ->ajax ) {
1390
+		if (EE_Registry::instance()->REQ->ajax) {
1391 1391
 			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1392
-			$this->checkout->json_response->set_unexpected_errors( ob_get_clean() );
1392
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1393 1393
 		}
1394 1394
 		// just return for these conditions
1395
-		if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) {
1395
+		if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') {
1396 1396
 			return;
1397 1397
 		}
1398 1398
 		// AJAX response
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
 	 */
1414 1414
 	protected function _handle_json_response() {
1415 1415
 		// if this is an ajax request
1416
-		if ( EE_Registry::instance()->REQ->ajax ) {
1416
+		if (EE_Registry::instance()->REQ->ajax) {
1417 1417
 			// DEBUG LOG
1418 1418
 			//$this->checkout->log(
1419 1419
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -1423,10 +1423,10 @@  discard block
 block discarded – undo
1423 1423
 			//		'continue_reg'               => $this->checkout->continue_reg,
1424 1424
 			//	)
1425 1425
 			//);
1426
-			$this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() );
1427
-			$this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing );
1426
+			$this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit());
1427
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1428 1428
 			// just send the ajax (
1429
-			$json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response );
1429
+			$json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response);
1430 1430
 			$this->unlock_transaction();
1431 1431
 			echo $json_response;
1432 1432
 			exit();
@@ -1443,9 +1443,9 @@  discard block
 block discarded – undo
1443 1443
 	 */
1444 1444
 	protected function _handle_html_redirects() {
1445 1445
 		// going somewhere ?
1446
-		if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) {
1446
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1447 1447
 			// store notices in a transient
1448
-			EE_Error::get_notices( false, true, true );
1448
+			EE_Error::get_notices(false, true, true);
1449 1449
 			$this->unlock_transaction();
1450 1450
 			// DEBUG LOG
1451 1451
 			//$this->checkout->log(
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 			//		'headers_list'    => headers_list(),
1457 1457
 			//	)
1458 1458
 			//);
1459
-			wp_safe_redirect( $this->checkout->redirect_url );
1459
+			wp_safe_redirect($this->checkout->redirect_url);
1460 1460
 			exit();
1461 1461
 		}
1462 1462
 	}
Please login to merge, or discard this patch.
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 1 patch
Spacing   +385 added lines, -385 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 	 *  @return 	void
29 29
 	 */
30 30
 	public static function set_hooks() {
31
-		add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) );
32
-		add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
33
-		add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ));
34
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
35
-		add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ));
36
-		add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) );
37
-		add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
31
+		add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters'));
32
+		add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
33
+		add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form'));
34
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
35
+		add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
36
+		add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details'));
37
+		add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
38 38
 		);
39
-		add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 );
39
+		add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1);
40 40
 	}
41 41
 
42 42
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * 	ajax switch_spco_billing_form
46 46
 	 */
47 47
 	public static function switch_spco_billing_form() {
48
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
48
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
49 49
 	}
50 50
 
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * 	ajax save_payer_details
55 55
 	 */
56 56
 	public static function save_payer_details() {
57
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
57
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
58 58
 	}
59 59
 
60 60
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * 	ajax get_transaction_details
64 64
 	 */
65 65
 	public static function get_transaction_details() {
66
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
66
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
67 67
 	}
68 68
 
69 69
 
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 	 * @param    EE_Checkout $checkout
92 92
 	 * @return    \EE_SPCO_Reg_Step_Payment_Options
93 93
 	 */
94
-	public function __construct( EE_Checkout $checkout ) {
94
+	public function __construct(EE_Checkout $checkout) {
95 95
 		$this->_slug = 'payment_options';
96 96
 		$this->_name = __('Payment Options', 'event_espresso');
97
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
97
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
98 98
 		$this->checkout = $checkout;
99 99
 		$this->_reset_success_message();
100
-		$this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
100
+		$this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso'));
101 101
 	}
102 102
 
103 103
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * @param null $line_item_display
116 116
 	 */
117
-	public function set_line_item_display( $line_item_display ) {
117
+	public function set_line_item_display($line_item_display) {
118 118
 		$this->line_item_display = $line_item_display;
119 119
 	}
120 120
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 * @return void
126 126
 	 */
127 127
 	public function translate_js_strings() {
128
-		EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' );
129
-		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' );
130
-		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' );
128
+		EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso');
129
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso');
130
+		EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso');
131 131
 	}
132 132
 
133 133
 
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
 			// 	$ 0.00 transactions (no payment required)
157 157
 			! $this->checkout->payment_required()
158 158
 			// but do NOT remove if current action being called belongs to this reg step
159
-			&& ! is_callable( array( $this, $this->checkout->action ) )
159
+			&& ! is_callable(array($this, $this->checkout->action))
160 160
 			&& ! $this->completed()
161 161
 		) {
162 162
 			// and if so, then we no longer need the Payment Options step
163
-			if ( $this->is_current_step() ) {
163
+			if ($this->is_current_step()) {
164 164
 				$this->checkout->generate_reg_form = false;
165 165
 			}
166
-			$this->checkout->remove_reg_step( $this->_slug );
166
+			$this->checkout->remove_reg_step($this->_slug);
167 167
 			// DEBUG LOG
168 168
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
169 169
 			return false;
170 170
 		}
171 171
 		// load EEM_Payment_Method
172
-		EE_Registry::instance()->load_model( 'Payment_Method' );
172
+		EE_Registry::instance()->load_model('Payment_Method');
173 173
 		// get all active payment methods
174 174
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
175 175
 			$this->checkout->transaction, EEM_Payment_Method::scope_cart
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return bool
184 184
 	 */
185 185
 	public function generate_reg_form() {
186
-		EE_Registry::instance()->load_helper( 'HTML' );
186
+		EE_Registry::instance()->load_helper('HTML');
187 187
 		// reset in case someone changes their mind
188 188
 		$this->_reset_selected_method_of_payment();
189 189
 		// set some defaults
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 		$reg_count = 0;
196 196
 		$no_payment_required = true;
197 197
 		// loop thru registrations to gather info
198
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
199
-		foreach ( $registrations as $registration ) {
198
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
199
+		foreach ($registrations as $registration) {
200 200
 			/** @var $registration EE_Registration */
201 201
 			$reg_count++;
202 202
 			// registrant is NOT Approved
203
-			if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) {
203
+			if ($registration->status_ID() === EEM_Registration::status_id_not_approved) {
204 204
 				// add event to list of events with pre-approval reg status
205
-				$registrations_requiring_pre_approval[ $registration->ID() ] = $registration;
205
+				$registrations_requiring_pre_approval[$registration->ID()] = $registration;
206 206
 				do_action(
207 207
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
208 208
 					$registration->event(),
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 				// anything other than Approved
217 217
 				&& $registration->status_ID() !== EEM_Registration::status_id_approved
218 218
 				// event hasn't sold out since initial visit
219
-				&& $registration->event()->is_sold_out( true )
219
+				&& $registration->event()->is_sold_out(true)
220 220
 			) {
221 221
 				// add event to list of events that are sold out
222
-				$sold_out_events[ $registration->event()->ID() ] = $registration->event();
222
+				$sold_out_events[$registration->event()->ID()] = $registration->event();
223 223
 				do_action(
224 224
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
225 225
 					$registration->event(),
@@ -228,29 +228,29 @@  discard block
 block discarded – undo
228 228
 				continue;
229 229
 			}
230 230
 			// are they allowed to pay now and is there monies owing?
231
-			if ( $registration->owes_monies_and_can_pay() ) {
232
-				$registrations_requiring_payment[ $registration->ID() ] = $registration;
231
+			if ($registration->owes_monies_and_can_pay()) {
232
+				$registrations_requiring_payment[$registration->ID()] = $registration;
233 233
 				do_action(
234 234
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
235 235
 					$registration->event(),
236 236
 					$this
237 237
 				);
238
-			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()  ) {
239
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
238
+			} else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) {
239
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
240 240
 			}
241 241
 		}
242 242
 		$subsections = array();
243 243
 		// now decide which template to load
244
-		if ( ! empty( $sold_out_events )) {
245
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
244
+		if ( ! empty($sold_out_events)) {
245
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
246 246
 		}
247
-		if ( ! empty( $registrations_requiring_pre_approval )) {
248
-			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval );
247
+		if ( ! empty($registrations_requiring_pre_approval)) {
248
+			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval);
249 249
 		}
250
-		if ( ! empty( $registrations_for_free_events ) ) {
251
-			$subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events );
250
+		if ( ! empty($registrations_for_free_events)) {
251
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
252 252
 		}
253
-		if ( ! empty( $registrations_requiring_payment ) ) {
253
+		if ( ! empty($registrations_requiring_payment)) {
254 254
 			// autoload Line_Item_Display classes
255 255
 			EEH_Autoloader::register_line_item_filter_autoloaders();
256 256
 			$line_item_filter_processor = new EE_Line_Item_Filter_Processor(
@@ -261,17 +261,17 @@  discard block
 block discarded – undo
261 261
 				$this->checkout->cart->get_grand_total()
262 262
 			);
263 263
 			$filtered_line_item_tree = $line_item_filter_processor->process();
264
-			if ( $this->checkout->amount_owing > 0 ) {
264
+			if ($this->checkout->amount_owing > 0) {
265 265
 				EEH_Autoloader::register_line_item_display_autoloaders();
266
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
267
-				$subsections[ 'payment_options' ] = $this->_display_payment_options(
266
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
267
+				$subsections['payment_options'] = $this->_display_payment_options(
268 268
 					$this->line_item_display->display_line_item(
269 269
 						$filtered_line_item_tree,
270
-						array( 'registrations' => $registrations )
270
+						array('registrations' => $registrations)
271 271
 					)
272 272
 				);
273 273
 				$this->checkout->amount_owing = $filtered_line_item_tree->total();
274
-				$this->_apply_registration_payments_to_amount_owing( $registrations );
274
+				$this->_apply_registration_payments_to_amount_owing($registrations);
275 275
 			}
276 276
 			$no_payment_required = false;
277 277
 		} else {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 		$this->_save_selected_method_of_payment();
281 281
 
282 282
 		$subsections['default_hidden_inputs'] = $this->reg_step_hidden_inputs();
283
-		$subsections['extra_hidden_inputs' ] = $this->_extra_hidden_inputs( $no_payment_required );
283
+		$subsections['extra_hidden_inputs'] = $this->_extra_hidden_inputs($no_payment_required);
284 284
 
285 285
 		return new EE_Form_Section_Proper(
286 286
 			array(
@@ -308,21 +308,21 @@  discard block
 block discarded – undo
308 308
 	 * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection
309 309
 	 * @return \EE_Line_Item_Filter_Collection
310 310
 	 */
311
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
312
-		if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) {
311
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
312
+		if ( ! EE_Registry::instance()->SSN instanceof EE_Session) {
313 313
 			return $line_item_filter_collection;
314 314
 		}
315
-		if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout ) {
315
+		if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout) {
316 316
 			return $line_item_filter_collection;
317 317
 		}
318
-		if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction ) {
318
+		if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction) {
319 319
 			return $line_item_filter_collection;
320 320
 		}
321 321
 		$registrations = EE_Registry::instance()->SSN->checkout()->transaction->registrations(
322 322
 			EE_Registry::instance()->SSN->checkout()->reg_cache_where_params
323 323
 		);
324
-		$line_item_filter_collection->add( new EE_Billable_Line_Item_Filter( $registrations ) );
325
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
324
+		$line_item_filter_collection->add(new EE_Billable_Line_Item_Filter($registrations));
325
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
326 326
 		return $line_item_filter_collection;
327 327
 	}
328 328
 
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * @return void
337 337
 	 */
338 338
 	protected function _hide_reg_step_submit_button_if_revisit() {
339
-		if ( $this->checkout->revisit ) {
340
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
339
+		if ($this->checkout->revisit) {
340
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
341 341
 		}
342 342
 	}
343 343
 
@@ -348,18 +348,18 @@  discard block
 block discarded – undo
348 348
 	 * @param \EE_Event[] $sold_out_events_array
349 349
 	 * @return \EE_Form_Section_Proper
350 350
 	 */
351
-	private function _sold_out_events( $sold_out_events_array = array() ) {
351
+	private function _sold_out_events($sold_out_events_array = array()) {
352 352
 		// set some defaults
353 353
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
354 354
 		$sold_out_events = '';
355
-		foreach ( $sold_out_events_array as $sold_out_event ) {
356
-			$sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ));
355
+		foreach ($sold_out_events_array as $sold_out_event) {
356
+			$sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text'));
357 357
 		}
358 358
 		return new EE_Form_Section_Proper(
359 359
 			array(
360 360
 				'layout_strategy'		=> new EE_Template_Layout(
361 361
 					array(
362
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template
362
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template
363 363
 						'template_args'  				=> apply_filters(
364 364
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
365 365
 							array(
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 								'sold_out_events_msg' 	=> apply_filters(
368 368
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg',
369 369
 									sprintf(
370
-										__( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.%3$s%3$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%2$s', 'event_espresso' ),
370
+										__('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.%3$s%3$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%2$s', 'event_espresso'),
371 371
 										'<strong>',
372 372
 										'</strong>',
373 373
 										'<br />'
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
 	 * @param array $registrations_requiring_pre_approval
389 389
 	 * @return \EE_Form_Section_Proper
390 390
 	 */
391
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) {
391
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
392 392
 		$events_requiring_pre_approval = '';
393
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
394
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
395
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
396
-					EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
393
+		foreach ($registrations_requiring_pre_approval as $registration) {
394
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
395
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
396
+					EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text'
397 397
 					)
398
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
398
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
399 399
 				);
400 400
 			}
401 401
 		}
@@ -403,14 +403,14 @@  discard block
 block discarded – undo
403 403
 			array(
404 404
 				'layout_strategy'		=> new EE_Template_Layout(
405 405
 					array(
406
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template
406
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template
407 407
 						'template_args'  				=> apply_filters(
408 408
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
409 409
 							array(
410
-								'events_requiring_pre_approval' 			=> implode( '', $events_requiring_pre_approval ),
410
+								'events_requiring_pre_approval' 			=> implode('', $events_requiring_pre_approval),
411 411
 								'events_requiring_pre_approval_msg' 	=> apply_filters(
412 412
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
413
-									__( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' )
413
+									__('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso')
414 414
 								)
415 415
 							)
416 416
 						),
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 * @param \EE_Event[] $registrations_for_free_events
429 429
 	 * @return \EE_Form_Section_Proper
430 430
 	 */
431
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
431
+	private function _no_payment_required($registrations_for_free_events = array()) {
432 432
 		// set some defaults
433 433
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
434 434
 		// generate no_payment_required form
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 			array(
437 437
 				'layout_strategy' 	=> new EE_Template_Layout(
438 438
 					array(
439
-						'layout_template_file' 	=> SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template
439
+						'layout_template_file' 	=> SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template
440 440
 						'template_args'  				=> apply_filters(
441 441
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
442 442
 							array(
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 								'registrations' => array(),
445 445
 								'ticket_count' 	=> array(),
446 446
 								'registrations_for_free_events' 	=> $registrations_for_free_events,
447
-								'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' ))
447
+								'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso'))
448 448
 							)
449 449
 						),
450 450
 					)
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	 * @param string $transaction_details
462 462
 	 * @return \EE_Form_Section_Proper
463 463
 	 */
464
-	private function _display_payment_options( $transaction_details = '' ) {
464
+	private function _display_payment_options($transaction_details = '') {
465 465
 		// has method_of_payment been set by no-js user?
466 466
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
467 467
 		// build payment options form
@@ -473,18 +473,18 @@  discard block
 block discarded – undo
473 473
 						'before_payment_options' => apply_filters(
474 474
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
475 475
 							new EE_Form_Section_Proper(
476
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
476
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
477 477
 							)
478 478
 						),
479 479
 						'payment_options' => $this->_setup_payment_options(),
480 480
 						'after_payment_options' => apply_filters(
481 481
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
482 482
 							new EE_Form_Section_Proper(
483
-								array( 'layout_strategy'	=> new EE_Div_Per_Section_Layout() )
483
+								array('layout_strategy'	=> new EE_Div_Per_Section_Layout())
484 484
 							)
485 485
 						),
486 486
 					),
487
-					'layout_strategy'	=> new EE_Template_Layout( array(
487
+					'layout_strategy'	=> new EE_Template_Layout(array(
488 488
 							'layout_template_file' 	=> $this->_template,
489 489
 							'template_args'  				=> apply_filters(
490 490
 								'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args',
@@ -508,11 +508,11 @@  discard block
 block discarded – undo
508 508
 	 * @param bool $no_payment_required
509 509
 	 * @return \EE_Form_Section_Proper
510 510
 	 */
511
-	private function _extra_hidden_inputs( $no_payment_required = TRUE ) {
511
+	private function _extra_hidden_inputs($no_payment_required = TRUE) {
512 512
 
513 513
 		return new EE_Form_Section_Proper(
514 514
 			array(
515
-				'html_id' 				=> 'ee-' . $this->slug() . '-extra-hidden-inputs',
515
+				'html_id' 				=> 'ee-'.$this->slug().'-extra-hidden-inputs',
516 516
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
517 517
 				'subsections' 		=> array(
518 518
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -545,16 +545,16 @@  discard block
 block discarded – undo
545 545
 	 * @access    protected
546 546
 	 * @return    void
547 547
 	 */
548
-	protected function _apply_registration_payments_to_amount_owing( $registrations ) {
548
+	protected function _apply_registration_payments_to_amount_owing($registrations) {
549 549
 		$payments = array();
550
-		foreach ( $registrations as $registration ) {
551
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
550
+		foreach ($registrations as $registration) {
551
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
552 552
 				$payments = $payments + $registration->registration_payments();
553 553
 			}
554 554
 		}
555
-		if ( ! empty( $payments ) ) {
556
-			foreach ( $payments as $payment ) {
557
-				if ( $payment instanceof EE_Registration_Payment ) {
555
+		if ( ! empty($payments)) {
556
+			foreach ($payments as $payment) {
557
+				if ($payment instanceof EE_Registration_Payment) {
558 558
 					$this->checkout->amount_owing -= $payment->amount();
559 559
 				}
560 560
 			}
@@ -569,9 +569,9 @@  discard block
 block discarded – undo
569 569
 	 * @param 	bool $force_reset
570 570
 	 * @return 	void
571 571
 	 */
572
-	private function _reset_selected_method_of_payment( $force_reset = FALSE ) {
573
-		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE ));
574
-		if ( $reset_payment_method ) {
572
+	private function _reset_selected_method_of_payment($force_reset = FALSE) {
573
+		$reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE));
574
+		if ($reset_payment_method) {
575 575
 			$this->checkout->selected_method_of_payment = NULL;
576 576
 			$this->checkout->payment_method = NULL;
577 577
 			$this->checkout->billing_form = NULL;
@@ -590,9 +590,9 @@  discard block
 block discarded – undo
590 590
 	 * @param string $selected_method_of_payment
591 591
 	 * 	@return 		EE_Billing_Info_Form
592 592
 	 */
593
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
594
-		$selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
595
-		EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment ));
593
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
594
+		$selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment;
595
+		EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment));
596 596
 	}
597 597
 
598 598
 
@@ -605,40 +605,40 @@  discard block
 block discarded – undo
605 605
 		// load payment method classes
606 606
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
607 607
 		// switch up header depending on number of available payment methods
608
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
609
-			? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' ))
610
-			: apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' ));
608
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
609
+			? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso'))
610
+			: apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso'));
611 611
 		$available_payment_methods = array(
612 612
 			// display the "Payment Method" header
613 613
 			'payment_method_header' => new EE_Form_Section_HTML(
614
-				EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' )
614
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
615 615
 			)
616 616
 		);
617 617
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
618 618
 		$available_payment_method_options = array();
619 619
 		$default_payment_method_option = array();
620 620
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
621
-		$payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' )));
621
+		$payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;')));
622 622
 		// loop through payment methods
623
-		foreach( $this->checkout->available_payment_methods as $payment_method ) {
624
-			if ( $payment_method instanceof EE_Payment_Method ) {
625
-				$payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' );
623
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
624
+			if ($payment_method instanceof EE_Payment_Method) {
625
+				$payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img');
626 626
 				// check if any payment methods are set as default
627 627
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
628
-				if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) {
628
+				if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) {
629 629
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
630 630
 					$this->_save_selected_method_of_payment();
631
-					$default_payment_method_option[ $payment_method->slug() ] =  $payment_method_button;
631
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
632 632
 				} else {
633
-					$available_payment_method_options[ $payment_method->slug() ] =  $payment_method_button;
633
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
634 634
 				}
635
-				$payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method );
635
+				$payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method);
636 636
 			}
637 637
 		}
638 638
 		// prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs
639 639
 		$available_payment_method_options = $default_payment_method_option + $available_payment_method_options;
640 640
 		// now generate the actual form  inputs
641
-		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options );
641
+		$available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options);
642 642
 		$available_payment_methods = $available_payment_methods + $payment_methods_billing_info;
643 643
 
644 644
 		// build the available payment methods form
@@ -658,19 +658,19 @@  discard block
 block discarded – undo
658 658
 	 * @return EE_Payment_Method[]
659 659
 	 */
660 660
 	protected function _get_available_payment_methods() {
661
-		if ( ! empty( $this->checkout->available_payment_methods )) {
661
+		if ( ! empty($this->checkout->available_payment_methods)) {
662 662
 			return $this->checkout->available_payment_methods;
663 663
 		}
664 664
 		$available_payment_methods = array();
665 665
 		// load EEM_Payment_Method
666
-		EE_Registry::instance()->load_model( 'Payment_Method' );
666
+		EE_Registry::instance()->load_model('Payment_Method');
667 667
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
668 668
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
669 669
 		// get all active payment methods
670
-		$payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart );
671
-		foreach ( $payment_methods as $payment_method ) {
672
-			if ( $payment_method instanceof EE_Payment_Method ) {
673
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
670
+		$payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart);
671
+		foreach ($payment_methods as $payment_method) {
672
+			if ($payment_method instanceof EE_Payment_Method) {
673
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
674 674
 			}
675 675
 		}
676 676
 		return $available_payment_methods;
@@ -686,14 +686,14 @@  discard block
 block discarded – undo
686 686
 	 * @param 	array $available_payment_method_options
687 687
 	 * @return 	\EE_Form_Section_Proper
688 688
 	 */
689
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
689
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
690 690
 		// generate inputs
691 691
 		return new EE_Form_Section_Proper(
692 692
 			array(
693 693
 				'html_id' 				=> 'ee-available-payment-method-inputs',
694 694
 				'layout_strategy'	=> new EE_Div_Per_Section_Layout(),
695 695
 				'subsections' 		=> array(
696
-					'' => new EE_Radio_Button_Input (
696
+					'' => new EE_Radio_Button_Input(
697 697
 						$available_payment_method_options,
698 698
 						array(
699 699
 							'html_name' 				=> 'selected_method_of_payment',
@@ -717,36 +717,36 @@  discard block
 block discarded – undo
717 717
 	 * @param 	EE_Payment_Method $payment_method
718 718
 	 * @return 	\EE_Form_Section_Proper
719 719
 	 */
720
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
720
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
721 721
 		$currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE;
722 722
 		// generate the billing form for payment method
723
-		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML();
723
+		$billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML();
724 724
 		$this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form;
725 725
 		// it's all in the details
726
-		$info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' );
726
+		$info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr');
727 727
 		// add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not
728
-		if ( $payment_method->description() ) {
728
+		if ($payment_method->description()) {
729 729
 			$payment_method_info = $payment_method->description();
730
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
731
-			$payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
730
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
731
+			$payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
732 732
 		} else {
733
-			$payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() );
733
+			$payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text());
734 734
 		}
735
-		$info_html .= EEH_HTML::p (
736
-			apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ),
735
+		$info_html .= EEH_HTML::p(
736
+			apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info),
737 737
 			'',
738 738
 			'spco-payment-method-desc ee-attention'
739 739
 		);
740 740
 
741 741
 		return new EE_Form_Section_Proper(
742 742
 			array(
743
-				'html_id' 					=> 'spco-payment-method-info-' . $payment_method->slug(),
743
+				'html_id' 					=> 'spco-payment-method-info-'.$payment_method->slug(),
744 744
 				'html_class' 			=> 'spco-payment-method-info-dv',
745 745
 				// only display the selected or default PM
746 746
 				'html_style' 			=> $currently_selected ? '' : 'display:none;',
747 747
 				'layout_strategy'		=> new EE_Div_Per_Section_Layout(),
748 748
 				'subsections' 			=> array(
749
-					'info' 					=> new EE_Form_Section_HTML( $info_html ),
749
+					'info' 					=> new EE_Form_Section_HTML($info_html),
750 750
 					'billing_form' 		=> $currently_selected ? $billing_form : new EE_Form_Section_HTML()
751 751
 				)
752 752
 			)
@@ -764,12 +764,12 @@  discard block
 block discarded – undo
764 764
 	 */
765 765
 	public function get_billing_form_html_for_payment_method() {
766 766
 		// how have they chosen to pay?
767
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
767
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
768 768
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
769
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
769
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
770 770
 			return FALSE;
771 771
 		}
772
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
772
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
773 773
             EE_Error::add_success(
774 774
                 apply_filters(
775 775
                     'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -778,20 +778,20 @@  discard block
 block discarded – undo
778 778
             );
779 779
         }
780 780
 		// now generate billing form for selected method of payment
781
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
781
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
782 782
 		// fill form with attendee info if applicable
783
-		if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
784
-			$payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
783
+		if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
784
+			$payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
785 785
 		}
786 786
 		// and debug content
787
-		if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
788
-			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form );
787
+		if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
788
+			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form);
789 789
 		}
790 790
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : '';
791
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ));
791
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
792 792
 		// localize validation rules for main form
793 793
 		$this->checkout->current_step->reg_form->localize_validation_rules();
794
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
794
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
795 795
 		return TRUE;
796 796
 	}
797 797
 
@@ -804,15 +804,15 @@  discard block
 block discarded – undo
804 804
 	 * @param EE_Payment_Method $payment_method
805 805
 	 * @return \EE_Billing_Info_Form
806 806
 	 */
807
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
808
-		$billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) );
809
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
810
-			if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) {
811
-                if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) {
807
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
808
+		$billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing));
809
+		if ($billing_form instanceof EE_Billing_Info_Form) {
810
+			if (EE_Registry::instance()->REQ->is_set('payment_method')) {
811
+                if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
812 812
                     EE_Error::add_success(
813 813
                         apply_filters(
814 814
                             'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
815
-                            sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() )
815
+                            sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name())
816 816
                         )
817 817
                     );
818 818
                 }
@@ -837,27 +837,27 @@  discard block
 block discarded – undo
837 837
 	 * @param string 		$request_param
838 838
 	 * @return NULL|string
839 839
 	 */
840
-	private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) {
840
+	private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') {
841 841
 		// is selected_method_of_payment set in the request ?
842
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE );
843
-		if ( $selected_method_of_payment ) {
842
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE);
843
+		if ($selected_method_of_payment) {
844 844
 			// sanitize it
845
-			$selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment;
846
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
845
+			$selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment;
846
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
847 847
 			// store it in the session so that it's available for all subsequent requests including AJAX
848
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
848
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
849 849
 		} else {
850 850
 			// or is is set in the session ?
851
-			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' );
851
+			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment');
852 852
 		}
853 853
 		// do ya really really gotta have it?
854
-		if ( empty( $selected_method_of_payment ) && $required ) {
854
+		if (empty($selected_method_of_payment) && $required) {
855 855
 			EE_Error::add_error(
856 856
 				sprintf(
857
-					__( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ),
857
+					__('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'),
858 858
 					'<br/>',
859 859
 					'<br/>',
860
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
860
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
861 861
 				),
862 862
 				__FILE__, __FUNCTION__, __LINE__
863 863
 			);
@@ -883,37 +883,37 @@  discard block
 block discarded – undo
883 883
 	 * @return string
884 884
 	 */
885 885
 	public function switch_payment_method() {
886
-		if ( ! $this->_verify_payment_method_is_set() ) {
886
+		if ( ! $this->_verify_payment_method_is_set()) {
887 887
 			return false;
888 888
 		}
889
-		if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) {
889
+		if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) {
890 890
 			EE_Error::add_success(
891 891
 				apply_filters(
892 892
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
893
-					sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() )
893
+					sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name())
894 894
 				)
895 895
 			);
896 896
 		}
897 897
 		// generate billing form for selected method of payment if it hasn't been done already
898
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
899
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
898
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
899
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
900 900
 		}
901 901
 		// fill form with attendee info if applicable
902
-		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) {
903
-			$this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() );
902
+		if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) {
903
+			$this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee());
904 904
 		}
905 905
 		// and debug content
906
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) {
907
-			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form );
906
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) {
907
+			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form);
908 908
 		}
909 909
 		// get html and validation rules for form
910
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
911
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() ));
910
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
911
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html()));
912 912
 			// localize validation rules for main form
913
-			$this->checkout->billing_form->localize_validation_rules( TRUE );
914
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
913
+			$this->checkout->billing_form->localize_validation_rules(TRUE);
914
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
915 915
 		} else {
916
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ));
916
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
917 917
 		}
918 918
 		//prevents advancement to next step
919 919
 		$this->checkout->continue_reg = FALSE;
@@ -928,18 +928,18 @@  discard block
 block discarded – undo
928 928
 	 */
929 929
 	protected function _verify_payment_method_is_set() {
930 930
 		// generate billing form for selected method of payment if it hasn't been done already
931
-		if ( empty( $this->checkout->selected_method_of_payment )) {
931
+		if (empty($this->checkout->selected_method_of_payment)) {
932 932
 			// how have they chosen to pay?
933
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE );
933
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE);
934 934
 		} else {
935 935
 			// choose your own adventure based on method_of_payment
936
-			switch ( $this->checkout->selected_method_of_payment ) {
936
+			switch ($this->checkout->selected_method_of_payment) {
937 937
 				case 'events_sold_out' :
938 938
 					EE_Error::add_attention(
939 939
 						apply_filters(
940 940
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__sold_out_events_msg',
941
-							__( 'It appears that the event you were about to make a payment for has sold out since this form first loaded. Please contact the event administrator if you believe this is an error.',
942
-								'event_espresso' )
941
+							__('It appears that the event you were about to make a payment for has sold out since this form first loaded. Please contact the event administrator if you believe this is an error.',
942
+								'event_espresso')
943 943
 						),
944 944
 						__FILE__, __FUNCTION__, __LINE__
945 945
 					);
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 					EE_Error::add_attention(
950 950
 						apply_filters(
951 951
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__payments_closed_msg',
952
-							__( 'It appears that the event you were about to make a payment for is not accepting payments at this time. Please contact the event administrator if you believe this is an error.', 'event_espresso' )
952
+							__('It appears that the event you were about to make a payment for is not accepting payments at this time. Please contact the event administrator if you believe this is an error.', 'event_espresso')
953 953
 						),
954 954
 						__FILE__, __FUNCTION__, __LINE__
955 955
 					);
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 					EE_Error::add_attention(
960 960
 						apply_filters(
961 961
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__no_payment_required_msg',
962
-							__( 'It appears that the event you were about to make a payment for does not require payment. Please contact the event administrator if you believe this is an error.', 'event_espresso' )
962
+							__('It appears that the event you were about to make a payment for does not require payment. Please contact the event administrator if you believe this is an error.', 'event_espresso')
963 963
 						),
964 964
 						__FILE__, __FUNCTION__, __LINE__
965 965
 					);
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 			}
970 970
 		}
971 971
 		// verify payment method
972
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
972
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
973 973
 			// get payment method for selected method of payment
974 974
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
975 975
 		}
@@ -989,23 +989,23 @@  discard block
 block discarded – undo
989 989
 	 * @return void
990 990
 	 */
991 991
 	public function save_payer_details_via_ajax() {
992
-		if ( ! $this->_verify_payment_method_is_set() ) {
992
+		if ( ! $this->_verify_payment_method_is_set()) {
993 993
 			return;
994 994
 		}
995 995
 		// generate billing form for selected method of payment if it hasn't been done already
996
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
997
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
996
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
997
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
998 998
 		}
999 999
 		// generate primary attendee from payer info if applicable
1000 1000
 		if ( ! $this->checkout->transaction_has_primary_registrant()) {
1001 1001
 			$attendee = $this->_create_attendee_from_request_data();
1002
-			if ( $attendee instanceof EE_Attendee ) {
1003
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
1004
-					if ( $registration->is_primary_registrant() ) {
1002
+			if ($attendee instanceof EE_Attendee) {
1003
+				foreach ($this->checkout->transaction->registrations() as $registration) {
1004
+					if ($registration->is_primary_registrant()) {
1005 1005
 						$this->checkout->primary_attendee_obj = $attendee;
1006
-						$registration->_add_relation_to( $attendee, 'Attendee' );
1007
-						$registration->set_attendee_id( $attendee->ID() );
1008
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
1006
+						$registration->_add_relation_to($attendee, 'Attendee');
1007
+						$registration->set_attendee_id($attendee->ID());
1008
+						$registration->update_cache_after_object_save('Attendee', $attendee);
1009 1009
 					}
1010 1010
 				}
1011 1011
 			}
@@ -1018,56 +1018,56 @@  discard block
 block discarded – undo
1018 1018
 	 * uses info from alternate GET or POST data (such as AJAX) to create a new attendee
1019 1019
 	 * @return \EE_Attendee
1020 1020
 	 */
1021
-	protected function _create_attendee_from_request_data(){
1021
+	protected function _create_attendee_from_request_data() {
1022 1022
 		// get State ID
1023
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
1024
-		if ( ! empty( $STA_ID )) {
1023
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
1024
+		if ( ! empty($STA_ID)) {
1025 1025
 			// can we get state object from name ?
1026
-			EE_Registry::instance()->load_model( 'State' );
1027
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' );
1028
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
1026
+			EE_Registry::instance()->load_model('State');
1027
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
1028
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
1029 1029
 		}
1030 1030
 		// get Country ISO
1031
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
1032
-		if ( ! empty( $CNT_ISO )) {
1031
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
1032
+		if ( ! empty($CNT_ISO)) {
1033 1033
 			// can we get country object from name ?
1034
-			EE_Registry::instance()->load_model( 'Country' );
1035
-			$country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' );
1036
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
1034
+			EE_Registry::instance()->load_model('Country');
1035
+			$country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO');
1036
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
1037 1037
 		}
1038 1038
 		// grab attendee data
1039 1039
 		$attendee_data = array(
1040
-			'ATT_fname' 		=> ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
1041
-			'ATT_lname' 		=> ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1042
-			'ATT_email' 		=> ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1043
-			'ATT_address' 		=> ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1044
-			'ATT_address2' 	=> ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1045
-			'ATT_city' 			=> ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
1040
+			'ATT_fname' 		=> ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
1041
+			'ATT_lname' 		=> ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1042
+			'ATT_email' 		=> ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1043
+			'ATT_address' 		=> ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1044
+			'ATT_address2' 	=> ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1045
+			'ATT_city' 			=> ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1046 1046
 			'STA_ID' 				=> $STA_ID,
1047 1047
 			'CNT_ISO' 			=> $CNT_ISO,
1048
-			'ATT_zip' 				=> ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1049
-			'ATT_phone' 		=> ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1048
+			'ATT_zip' 				=> ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1049
+			'ATT_phone' 		=> ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1050 1050
 		);
1051 1051
 		// validate the email address since it is the most important piece of info
1052
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) {
1053
-			EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1052
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) {
1053
+			EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1054 1054
 		}
1055 1055
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1056
-		if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) {
1057
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1056
+		if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) {
1057
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1058 1058
 				'ATT_fname' => $attendee_data['ATT_fname'],
1059 1059
 				'ATT_lname' => $attendee_data['ATT_lname'],
1060 1060
 				'ATT_email' => $attendee_data['ATT_email']
1061 1061
 			));
1062
-			if ( $existing_attendee instanceof EE_Attendee ) {
1062
+			if ($existing_attendee instanceof EE_Attendee) {
1063 1063
 				return $existing_attendee;
1064 1064
 			}
1065 1065
 		}
1066 1066
 		// no existing attendee? kk let's create a new one
1067 1067
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1068
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1069
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1070
-		return EE_Attendee::new_instance( $attendee_data );
1068
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email'];
1069
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email'];
1070
+		return EE_Attendee::new_instance($attendee_data);
1071 1071
 	}
1072 1072
 
1073 1073
 
@@ -1087,22 +1087,22 @@  discard block
 block discarded – undo
1087 1087
 	 */
1088 1088
 	public function process_reg_step() {
1089 1089
 		// how have they chosen to pay?
1090
-		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE );
1090
+		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE);
1091 1091
 		// choose your own adventure based on method_of_payment
1092
-		switch(  $this->checkout->selected_method_of_payment ) {
1092
+		switch ($this->checkout->selected_method_of_payment) {
1093 1093
 
1094 1094
 			case 'events_sold_out' :
1095 1095
 				$this->checkout->redirect = TRUE;
1096 1096
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1097
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1097
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1098 1098
 				// mark this reg step as completed
1099 1099
 				$this->set_completed();
1100 1100
 				return FALSE;
1101 1101
 				break;
1102 1102
 
1103 1103
 			case 'payments_closed' :
1104
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) {
1105
-					EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1104
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) {
1105
+					EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1106 1106
 				}
1107 1107
 				// mark this reg step as completed
1108 1108
 				$this->set_completed();
@@ -1110,8 +1110,8 @@  discard block
 block discarded – undo
1110 1110
 				break;
1111 1111
 
1112 1112
 			case 'no_payment_required' :
1113
-				if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) {
1114
-					EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1113
+				if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) {
1114
+					EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1115 1115
 				}
1116 1116
 				// mark this reg step as completed
1117 1117
 				$this->set_completed();
@@ -1120,9 +1120,9 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
 			default:
1122 1122
 				$payment_successful = $this->_process_payment();
1123
-				if ( $payment_successful ) {
1123
+				if ($payment_successful) {
1124 1124
 					$this->checkout->continue_reg = true;
1125
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1125
+					$this->_maybe_set_completed($this->checkout->payment_method);
1126 1126
 				} else {
1127 1127
 					$this->checkout->continue_reg = false;
1128 1128
 				}
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
 	 * @param \EE_Payment_Method $payment_method
1141 1141
 	 * @return void
1142 1142
 	 */
1143
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1144
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1143
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1144
+		switch ($payment_method->type_obj()->payment_occurs()) {
1145 1145
 			case EE_PMT_Base::offsite :
1146 1146
 				break;
1147 1147
 			case EE_PMT_Base::onsite :
@@ -1164,15 +1164,15 @@  discard block
 block discarded – undo
1164 1164
 	public function update_reg_step() {
1165 1165
 		$success = TRUE;
1166 1166
 		// if payment required
1167
-		if ( $this->checkout->transaction->total() > 0 ) {
1168
-			do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction );
1167
+		if ($this->checkout->transaction->total() > 0) {
1168
+			do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction);
1169 1169
 			// attempt payment via payment method
1170 1170
 			$success = $this->process_reg_step();
1171 1171
 		}
1172
-		if ( $success && ! $this->checkout->redirect ) {
1173
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
1172
+		if ($success && ! $this->checkout->redirect) {
1173
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
1174 1174
 			 // set return URL
1175
-			$this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url );
1175
+			$this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url);
1176 1176
 		}
1177 1177
 		return $success;
1178 1178
 	}
@@ -1190,32 +1190,32 @@  discard block
 block discarded – undo
1190 1190
 	 */
1191 1191
 	private function _process_payment() {
1192 1192
 		// basically confirm that the event hasn't sold out since they hit the page
1193
-		if ( ! $this->_last_second_ticket_verifications() ) {
1193
+		if ( ! $this->_last_second_ticket_verifications()) {
1194 1194
 			return false;
1195 1195
 		}
1196 1196
 		// ya gotta make a choice man
1197
-		if ( empty( $this->checkout->selected_method_of_payment )) {
1198
-			$this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' ));
1197
+		if (empty($this->checkout->selected_method_of_payment)) {
1198
+			$this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso'));
1199 1199
 			return FALSE;
1200 1200
 		}
1201 1201
 		// get EE_Payment_Method object
1202
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1202
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1203 1203
 			return FALSE;
1204 1204
 		}
1205 1205
 		// setup billing form
1206
-		if ( $this->checkout->payment_method->is_on_site() ) {
1207
-			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1206
+		if ($this->checkout->payment_method->is_on_site()) {
1207
+			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1208 1208
 			// bad billing form ?
1209
-			if ( ! $this->_billing_form_is_valid() ) {
1209
+			if ( ! $this->_billing_form_is_valid()) {
1210 1210
 				return FALSE;
1211 1211
 			}
1212 1212
 		}
1213 1213
 		// ensure primary registrant has been fully processed
1214
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1214
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1215 1215
 			return FALSE;
1216 1216
 		}
1217 1217
 		// if session is close to expiring (under 10 minutes by default)
1218
-		if ( ( time() - EE_Registry::instance()->SSN->expiration() ) < EE_Registry::instance()->SSN->extension() ) {
1218
+		if ((time() - EE_Registry::instance()->SSN->expiration()) < EE_Registry::instance()->SSN->extension()) {
1219 1219
 			// add some time to session expiration so that payment can be completed
1220 1220
 			EE_Registry::instance()->SSN->extend_expiration();
1221 1221
 		}
@@ -1224,24 +1224,24 @@  discard block
 block discarded – undo
1224 1224
 		// in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved
1225 1225
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1226 1226
 		// attempt payment
1227
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1227
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1228 1228
 		// process results
1229
-		$payment = $this->_validate_payment( $payment );
1230
-		$payment = $this->_post_payment_processing( $payment );
1229
+		$payment = $this->_validate_payment($payment);
1230
+		$payment = $this->_post_payment_processing($payment);
1231 1231
 		// verify payment
1232
-		if ( $payment instanceof EE_Payment ) {
1232
+		if ($payment instanceof EE_Payment) {
1233 1233
 			// store that for later
1234 1234
 			$this->checkout->payment = $payment;
1235 1235
 			/** @type EE_Transaction_Processor $transaction_processor */
1236
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1236
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1237 1237
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1238
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1239
-			if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) {
1238
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1239
+			if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) {
1240 1240
 				return true;
1241 1241
 			} else {
1242 1242
 				return false;
1243 1243
 			}
1244
-		} else if ( $payment === true ) {
1244
+		} else if ($payment === true) {
1245 1245
 			// please note that offline payment methods will NOT make a payment,
1246 1246
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1247 1247
 			$this->checkout->payment = $payment;
@@ -1261,22 +1261,22 @@  discard block
 block discarded – undo
1261 1261
 	 */
1262 1262
 	protected function _last_second_ticket_verifications() {
1263 1263
 		// don't bother re-validating if not a return visit
1264
-		if ( ! $this->checkout->revisit ) {
1264
+		if ( ! $this->checkout->revisit) {
1265 1265
 			return true;
1266 1266
 		}
1267 1267
 		$registrations = $this->checkout->transaction->registrations();
1268
-		if ( empty( $registrations ) ) {
1268
+		if (empty($registrations)) {
1269 1269
 			return false;
1270 1270
 		}
1271
-		foreach ( $registrations as $registration ) {
1272
-			if ( $registration instanceof EE_Registration ) {
1271
+		foreach ($registrations as $registration) {
1272
+			if ($registration instanceof EE_Registration) {
1273 1273
 				$event = $registration->event_obj();
1274
-				if ( $event instanceof EE_Event && $event->is_sold_out( true ) ) {
1274
+				if ($event instanceof EE_Event && $event->is_sold_out(true)) {
1275 1275
 					EE_Error::add_error(
1276 1276
 						apply_filters(
1277 1277
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___last_second_ticket_verifications__sold_out_events_msg',
1278 1278
 							sprintf(
1279
-								__( 'It appears that the %1$s event that you were about to make a payment for has sold out since you first registered and/or arrived at this page. Please refresh the page and try again. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' ),
1279
+								__('It appears that the %1$s event that you were about to make a payment for has sold out since you first registered and/or arrived at this page. Please refresh the page and try again. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso'),
1280 1280
 								$event->name()
1281 1281
 							)
1282 1282
 						),
@@ -1300,10 +1300,10 @@  discard block
 block discarded – undo
1300 1300
 	 * @return bool
1301 1301
 	 */
1302 1302
 	public function redirect_form() {
1303
-		$payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() );
1303
+		$payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment());
1304 1304
 		$html = $payment_method_billing_info->get_html_and_js();
1305 1305
 		$html .= $this->checkout->redirect_form;
1306
-		EE_Registry::instance()->REQ->add_output( $html );
1306
+		EE_Registry::instance()->REQ->add_output($html);
1307 1307
 		return TRUE;
1308 1308
 	}
1309 1309
 
@@ -1316,36 +1316,36 @@  discard block
 block discarded – undo
1316 1316
 	 * @return bool
1317 1317
 	 */
1318 1318
 	private function _billing_form_is_valid() {
1319
-		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1319
+		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) {
1320 1320
 			return TRUE;
1321 1321
 		}
1322
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1323
-			if ( $this->checkout->billing_form->was_submitted() ) {
1322
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1323
+			if ($this->checkout->billing_form->was_submitted()) {
1324 1324
 				$this->checkout->billing_form->receive_form_submission();
1325
-				if ( $this->checkout->billing_form->is_valid() ) {
1325
+				if ($this->checkout->billing_form->is_valid()) {
1326 1326
 					return TRUE;
1327 1327
 				}
1328 1328
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1329 1329
 				$error_strings = array();
1330
-				foreach( $validation_errors as $validation_error ){
1331
-					if( $validation_error instanceof EE_Validation_Error ){
1330
+				foreach ($validation_errors as $validation_error) {
1331
+					if ($validation_error instanceof EE_Validation_Error) {
1332 1332
 						$form_section = $validation_error->get_form_section();
1333
-						if( $form_section instanceof EE_Form_Input_Base ){
1333
+						if ($form_section instanceof EE_Form_Input_Base) {
1334 1334
 							$label = $form_section->html_label_text();
1335
-						}elseif( $form_section instanceof EE_Form_Section_Base ){
1335
+						}elseif ($form_section instanceof EE_Form_Section_Base) {
1336 1336
 							$label = $form_section->name();
1337
-						}else{
1338
-							$label = __( 'Validation Error', 'event_espresso' );
1337
+						} else {
1338
+							$label = __('Validation Error', 'event_espresso');
1339 1339
 						}
1340
-						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() );
1340
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1341 1341
 					}
1342 1342
 				}
1343
-				EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings )  ), __FILE__, __FUNCTION__, __LINE__ );
1343
+				EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__);
1344 1344
 			} else {
1345
-				EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1345
+				EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1346 1346
 			}
1347 1347
 		} else {
1348
-			EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1348
+			EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1349 1349
 		}
1350 1350
 		return FALSE;
1351 1351
 	}
@@ -1363,9 +1363,9 @@  discard block
 block discarded – undo
1363 1363
 	 */
1364 1364
 		private function _setup_primary_registrant_prior_to_payment() {
1365 1365
 			// check if transaction has a primary registrant and that it has a related Attendee object
1366
-			if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1366
+			if ( ! $this->checkout->transaction_has_primary_registrant()) {
1367 1367
 				// need to at least gather some primary registrant data before attempting payment
1368
-				if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) {
1368
+				if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) {
1369 1369
 					return FALSE;
1370 1370
 				}
1371 1371
 			}
@@ -1373,13 +1373,13 @@  discard block
 block discarded – undo
1373 1373
 			// grab the primary_registration object
1374 1374
 			$primary_registration = $this->checkout->transaction->primary_registration();
1375 1375
 			/** @type EE_Transaction_Processor $transaction_processor */
1376
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1376
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1377 1377
 			// at this point we'll consider a TXN to not have been failed
1378
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1378
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1379 1379
 			// save the TXN ( which clears cached copy of primary_registration)
1380 1380
 			$this->checkout->transaction->save();
1381 1381
 			// grab TXN ID and save it to the primary_registration
1382
-			$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1382
+			$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1383 1383
 			// save what we have so far
1384 1384
 			$primary_registration->save();
1385 1385
 			return TRUE;
@@ -1396,41 +1396,41 @@  discard block
 block discarded – undo
1396 1396
 		private function _capture_primary_registration_data_from_billing_form() {
1397 1397
 			// convert billing form data into an attendee
1398 1398
 			$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1399
-			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1399
+			if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1400 1400
 				EE_Error::add_error(
1401 1401
 					sprintf(
1402
-						__( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1402
+						__('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1403 1403
 						'<br/>',
1404
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1404
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1405 1405
 					), __FILE__, __FUNCTION__, __LINE__
1406 1406
 				);
1407 1407
 				return FALSE;
1408 1408
 			}
1409 1409
 			$primary_registration = $this->checkout->transaction->primary_registration();
1410
-			if ( ! $primary_registration instanceof EE_Registration ) {
1410
+			if ( ! $primary_registration instanceof EE_Registration) {
1411 1411
 				EE_Error::add_error(
1412 1412
 					sprintf(
1413
-						__( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1413
+						__('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1414 1414
 						'<br/>',
1415
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1415
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1416 1416
 					), __FILE__, __FUNCTION__, __LINE__
1417 1417
 				);
1418 1418
 				return FALSE;
1419 1419
 			}
1420
-			if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) {
1420
+			if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) {
1421 1421
 				EE_Error::add_error(
1422 1422
 					sprintf(
1423
-						__( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1423
+						__('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1424 1424
 						'<br/>',
1425
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1425
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1426 1426
 					), __FILE__, __FUNCTION__, __LINE__
1427 1427
 				);
1428 1428
 				return FALSE;
1429 1429
 			}
1430 1430
 			/** @type EE_Registration_Processor $registration_processor */
1431
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1431
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1432 1432
 			// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1433
-			$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1433
+			$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1434 1434
 
1435 1435
 			return TRUE;
1436 1436
 		}
@@ -1446,35 +1446,35 @@  discard block
 block discarded – undo
1446 1446
 	 */
1447 1447
 		private function _get_payment_method_for_selected_method_of_payment() {
1448 1448
 			// get EE_Payment_Method object
1449
-			if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) {
1450
-				$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1449
+			if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1450
+				$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1451 1451
 			} else {
1452 1452
 				// load EEM_Payment_Method
1453
-				EE_Registry::instance()->load_model( 'Payment_Method' );
1453
+				EE_Registry::instance()->load_model('Payment_Method');
1454 1454
 				/** @type EEM_Payment_Method $EEM_Payment_Method */
1455 1455
 				$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1456
-				$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1456
+				$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1457 1457
 			}
1458 1458
 			// verify $payment_method
1459
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
1459
+			if ( ! $payment_method instanceof EE_Payment_Method) {
1460 1460
 				// not a payment
1461 1461
 				EE_Error::add_error(
1462 1462
 					sprintf(
1463
-						__( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1463
+						__('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1464 1464
 						'<br/>',
1465
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1465
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1466 1466
 					), __FILE__, __FUNCTION__, __LINE__
1467 1467
 				);
1468 1468
 				return NULL;
1469 1469
 			}
1470 1470
 			// and verify it has a valid Payment_Method Type object
1471
-			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1471
+			if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1472 1472
 				// not a payment
1473 1473
 				EE_Error::add_error(
1474 1474
 					sprintf(
1475
-						__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1475
+						__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1476 1476
 						'<br/>',
1477
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1477
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1478 1478
 					), __FILE__, __FUNCTION__, __LINE__
1479 1479
 				);
1480 1480
 				return NULL;
@@ -1493,30 +1493,30 @@  discard block
 block discarded – undo
1493 1493
 	 * 	@type 	EE_Payment_Method $payment_method
1494 1494
 	 * 	@return 	mixed	EE_Payment | boolean
1495 1495
 	 */
1496
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1497
-		$payment =NULL;
1496
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1497
+		$payment = NULL;
1498 1498
 		$this->checkout->transaction->save();
1499
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1500
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1499
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1500
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1501 1501
 			return FALSE;
1502 1502
 		}
1503 1503
 		try {
1504
-			$payment_processor->set_revisit( $this->checkout->revisit );
1504
+			$payment_processor->set_revisit($this->checkout->revisit);
1505 1505
 			// generate payment object
1506 1506
 			$payment = $payment_processor->process_payment(
1507 1507
 				$payment_method,
1508 1508
 				$this->checkout->transaction,
1509 1509
 				$this->checkout->amount_owing,
1510 1510
 				$this->checkout->billing_form,
1511
-				$this->_get_return_url( $payment_method ),
1511
+				$this->_get_return_url($payment_method),
1512 1512
 				'CART',
1513 1513
 				$this->checkout->admin_request,
1514 1514
 				TRUE,
1515 1515
 				$this->reg_step_url()
1516 1516
 			);
1517 1517
 
1518
-		} catch( Exception $e ) {
1519
-			$this->_handle_payment_processor_exception( $e );
1518
+		} catch (Exception $e) {
1519
+			$this->_handle_payment_processor_exception($e);
1520 1520
 		}
1521 1521
 		return $payment;
1522 1522
 	}
@@ -1530,12 +1530,12 @@  discard block
 block discarded – undo
1530 1530
 	 * @param \Exception $e
1531 1531
 	 * @return void
1532 1532
 	 */
1533
-	protected function _handle_payment_processor_exception( Exception $e ) {
1533
+	protected function _handle_payment_processor_exception(Exception $e) {
1534 1534
 		EE_Error::add_error(
1535 1535
 			sprintf(
1536
-				__( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ),
1536
+				__('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'),
1537 1537
 				'<br/>',
1538
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
1538
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
1539 1539
 				$e->getMessage(),
1540 1540
 				$e->getFile(),
1541 1541
 				$e->getLine()
@@ -1552,9 +1552,9 @@  discard block
 block discarded – undo
1552 1552
 	 * @param \EE_Payment_Method $payment_method
1553 1553
 	 * @return string
1554 1554
 	 */
1555
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
1555
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
1556 1556
 		$return_url = '';
1557
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1557
+		switch ($payment_method->type_obj()->payment_occurs()) {
1558 1558
 
1559 1559
 			case EE_PMT_Base::offsite :
1560 1560
 				$return_url = add_query_arg(
@@ -1585,18 +1585,18 @@  discard block
 block discarded – undo
1585 1585
 	 * @param EE_Payment $payment
1586 1586
 	 * @return EE_Payment | FALSE
1587 1587
 	 */
1588
-	private function _validate_payment( $payment = NULL ) {
1589
-		if (  $this->checkout->payment_method->is_off_line() ) {
1588
+	private function _validate_payment($payment = NULL) {
1589
+		if ($this->checkout->payment_method->is_off_line()) {
1590 1590
 			return TRUE;
1591 1591
 		}
1592 1592
 		// verify payment object
1593
-		if ( ! $payment instanceof EE_Payment ) {
1593
+		if ( ! $payment instanceof EE_Payment) {
1594 1594
 			// not a payment
1595 1595
 			EE_Error::add_error(
1596 1596
 				sprintf(
1597
-					__( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1597
+					__('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1598 1598
 					'<br/>',
1599
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1599
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1600 1600
 				), __FILE__, __FUNCTION__, __LINE__
1601 1601
 			);
1602 1602
 			return FALSE;
@@ -1613,23 +1613,23 @@  discard block
 block discarded – undo
1613 1613
 	 * @param EE_Payment $payment
1614 1614
 	 * @return bool
1615 1615
 	 */
1616
-	private function _post_payment_processing( $payment = NULL ) {
1616
+	private function _post_payment_processing($payment = NULL) {
1617 1617
 		// On-Site payment?
1618
-		if ( $this->checkout->payment_method->is_on_site() ) {
1619
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) {
1618
+		if ($this->checkout->payment_method->is_on_site()) {
1619
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
1620 1620
 				//$this->_setup_redirect_for_next_step();
1621 1621
 				$this->checkout->continue_reg = false;
1622 1622
 			}
1623 1623
 			// Off-Site payment?
1624
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
1624
+		} else if ($this->checkout->payment_method->is_off_site()) {
1625 1625
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
1626
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ){
1627
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
1626
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
1627
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
1628 1628
 				$this->checkout->redirect = TRUE;
1629 1629
 				$this->checkout->redirect_form = $payment->redirect_form();
1630
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
1630
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
1631 1631
 				// set JSON response
1632
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
1632
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
1633 1633
 				// set cron job for finalizing the TXN
1634 1634
 				// in case the user does not return from the off-site gateway
1635 1635
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -1637,21 +1637,21 @@  discard block
 block discarded – undo
1637 1637
 					$this->checkout->transaction->ID()
1638 1638
 				);
1639 1639
 				// and lastly, let's bump the payment status to pending
1640
-				$payment->set_status( EEM_Payment::status_id_pending );
1640
+				$payment->set_status(EEM_Payment::status_id_pending);
1641 1641
 				$payment->save();
1642 1642
 			} else {
1643 1643
 				// not a payment
1644 1644
 				$this->checkout->continue_reg = false;
1645 1645
 				EE_Error::add_error(
1646 1646
 					sprintf(
1647
-						__( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1647
+						__('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1648 1648
 						'<br/>',
1649
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1649
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1650 1650
 					), __FILE__, __FUNCTION__, __LINE__
1651 1651
 				);
1652 1652
 			}
1653 1653
 			// Off-Line payment?
1654
-		} else if ( $payment === TRUE ) {
1654
+		} else if ($payment === TRUE) {
1655 1655
 			//$this->_setup_redirect_for_next_step();
1656 1656
 			return TRUE;
1657 1657
 		} else {
@@ -1687,65 +1687,65 @@  discard block
 block discarded – undo
1687 1687
 	 * @return bool
1688 1688
 	 * @throws \EE_Error
1689 1689
 	 */
1690
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
1690
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
1691 1691
 		// off-line payment? carry on
1692
-		if ( $payment_occurs == EE_PMT_Base::offline ) {
1692
+		if ($payment_occurs == EE_PMT_Base::offline) {
1693 1693
 			return true;
1694 1694
 		}
1695 1695
 		// verify payment validity
1696
-		if ( $payment instanceof EE_Payment ) {
1697
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
1696
+		if ($payment instanceof EE_Payment) {
1697
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
1698 1698
 			$msg = $payment->gateway_response();
1699 1699
 			// check results
1700
-			switch ( $payment->status() ) {
1700
+			switch ($payment->status()) {
1701 1701
 
1702 1702
 				// good payment
1703 1703
 				case EEM_Payment::status_id_approved :
1704
-					EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1704
+					EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1705 1705
 					return TRUE;
1706 1706
 					break;
1707 1707
 
1708 1708
 				// slow payment
1709 1709
 				case EEM_Payment::status_id_pending :
1710
-					if ( empty( $msg )) {
1711
-						$msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' );
1710
+					if (empty($msg)) {
1711
+						$msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso');
1712 1712
 					}
1713
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
1713
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
1714 1714
 					return TRUE;
1715 1715
 					break;
1716 1716
 
1717 1717
 				// don't wanna payment
1718 1718
 				case EEM_Payment::status_id_cancelled :
1719
-					if ( empty( $msg )) {
1719
+					if (empty($msg)) {
1720 1720
 						$msg = _n(
1721 1721
 							'Payment cancelled. Please try again.',
1722 1722
 							'Payment cancelled. Please try again or select another method of payment.',
1723
-							count( $this->checkout->available_payment_methods ),
1723
+							count($this->checkout->available_payment_methods),
1724 1724
 							'event_espresso'
1725 1725
 						);
1726 1726
 					}
1727
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1727
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1728 1728
 					return FALSE;
1729 1729
 					break;
1730 1730
 
1731 1731
 				// not enough payment
1732 1732
 				case EEM_Payment::status_id_declined :
1733
-					if ( empty( $msg )) {
1733
+					if (empty($msg)) {
1734 1734
 						$msg = _n(
1735 1735
 							'We\'re sorry but your payment was declined. Please try again.',
1736 1736
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
1737
-							count( $this->checkout->available_payment_methods ),
1737
+							count($this->checkout->available_payment_methods),
1738 1738
 							'event_espresso'
1739 1739
 						);
1740 1740
 					}
1741
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
1741
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
1742 1742
 					return FALSE;
1743 1743
 					break;
1744 1744
 
1745 1745
 				// bad payment
1746 1746
 				case EEM_Payment::status_id_failed :
1747
-					if ( ! empty( $msg ) ) {
1748
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1747
+					if ( ! empty($msg)) {
1748
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1749 1749
 						return false;
1750 1750
 					}
1751 1751
 					// default to error below
@@ -1755,14 +1755,14 @@  discard block
 block discarded – undo
1755 1755
 		}
1756 1756
 		// off-site payment gateway responses are too unreliable, so let's just assume that
1757 1757
 		// the payment processing is just running slower than the registrant's request
1758
-		if ( $payment_occurs == EE_PMT_Base::offsite ) {
1758
+		if ($payment_occurs == EE_PMT_Base::offsite) {
1759 1759
 			return true;
1760 1760
 		}
1761 1761
 		EE_Error::add_error(
1762 1762
 				sprintf(
1763
-					__( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
1763
+					__('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
1764 1764
 					'<br/>',
1765
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1765
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1766 1766
 				),
1767 1767
 				__FILE__, __FUNCTION__, __LINE__
1768 1768
 			);
@@ -1795,13 +1795,13 @@  discard block
 block discarded – undo
1795 1795
 	public function process_gateway_response() {
1796 1796
 		$payment = null;
1797 1797
 		// how have they chosen to pay?
1798
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1798
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1799 1799
 		// get EE_Payment_Method object
1800
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1800
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1801 1801
 			$this->checkout->continue_reg = false;
1802 1802
 			return false;
1803 1803
 		}
1804
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
1804
+		if ( ! $this->checkout->payment_method->is_off_site()) {
1805 1805
 			return false;
1806 1806
 		}
1807 1807
 		$this->_validate_offsite_return();
@@ -1815,23 +1815,23 @@  discard block
 block discarded – undo
1815 1815
 		//	true
1816 1816
 		//);
1817 1817
 		// verify TXN
1818
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
1818
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1819 1819
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
1820
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
1820
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
1821 1821
 				$this->checkout->continue_reg = false;
1822 1822
 				return false;
1823 1823
 			}
1824
-			$payment = $this->_process_off_site_payment( $gateway );
1825
-			$payment = $this->_process_cancelled_payments( $payment );
1826
-			$payment = $this->_validate_payment( $payment );
1824
+			$payment = $this->_process_off_site_payment($gateway);
1825
+			$payment = $this->_process_cancelled_payments($payment);
1826
+			$payment = $this->_validate_payment($payment);
1827 1827
 			// if payment was not declined by the payment gateway or cancelled by the registrant
1828
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
1828
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
1829 1829
 				//$this->_setup_redirect_for_next_step();
1830 1830
 				// store that for later
1831 1831
 				$this->checkout->payment = $payment;
1832 1832
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
1833 1833
 				// because we will complete this step during the IPN processing then
1834
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) {
1834
+				if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) {
1835 1835
 					$this->set_completed();
1836 1836
 				}
1837 1837
 				return true;
@@ -1854,19 +1854,19 @@  discard block
 block discarded – undo
1854 1854
 	 * @return bool
1855 1855
 	 */
1856 1856
 	private function _validate_offsite_return() {
1857
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
1858
-		if ( $TXN_ID != $this->checkout->transaction->ID() ) {
1857
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
1858
+		if ($TXN_ID != $this->checkout->transaction->ID()) {
1859 1859
 			// Houston... we might have a problem
1860 1860
 			$invalid_TXN = false;
1861 1861
 			// first gather some info
1862
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1862
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1863 1863
 			$primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null;
1864 1864
 			// let's start by retrieving the cart for this TXN
1865
-			$cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction );
1866
-			if ( $cart instanceof EE_Cart ) {
1865
+			$cart = EE_Cart::get_cart_from_txn($this->checkout->transaction);
1866
+			if ($cart instanceof EE_Cart) {
1867 1867
 				// verify that the current cart has tickets
1868 1868
 				$tickets = $cart->get_tickets();
1869
-				if ( empty( $tickets ) ) {
1869
+				if (empty($tickets)) {
1870 1870
 					$invalid_TXN = true;
1871 1871
 				}
1872 1872
 			} else {
@@ -1874,39 +1874,39 @@  discard block
 block discarded – undo
1874 1874
 			}
1875 1875
 			$valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null;
1876 1876
 			// validate current Session ID and compare against valid TXN session ID
1877
-			if ( EE_Session::instance()->id() === null ) {
1877
+			if (EE_Session::instance()->id() === null) {
1878 1878
 				$invalid_TXN = true;
1879
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
1879
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
1880 1880
 				// WARNING !!!
1881 1881
 				// this could be PayPal sending back duplicate requests (ya they do that)
1882 1882
 				// or it **could** mean someone is simply registering AGAIN after having just done so
1883 1883
 				// so now we need to determine if this current TXN looks valid or not
1884 1884
 				/** @type EE_Transaction_Processor $transaction_processor */
1885
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1885
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1886 1886
 				// has this step even been started ?
1887
-				if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false )
1887
+				if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false)
1888 1888
 				) {
1889 1889
 					// really? you're half way through this reg step, but you never started it ?
1890 1890
 					$invalid_TXN = true;
1891 1891
 				}
1892 1892
 			}
1893
-			if ( $invalid_TXN ) {
1893
+			if ($invalid_TXN) {
1894 1894
 				// is the valid TXN completed ?
1895
-				if ( $valid_TXN instanceof EE_Transaction ) {
1895
+				if ($valid_TXN instanceof EE_Transaction) {
1896 1896
 					/** @type EE_Transaction_Processor $transaction_processor */
1897
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1897
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1898 1898
 					// has this step even been started ?
1899
-					$reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() );
1900
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
1899
+					$reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug());
1900
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
1901 1901
 						// so it **looks** like this is a double request from PayPal
1902 1902
 						// so let's try to pick up where we left off
1903 1903
 						$this->checkout->transaction = $valid_TXN;
1904
-						$this->checkout->refresh_all_entities( true );
1904
+						$this->checkout->refresh_all_entities(true);
1905 1905
 						return;
1906 1906
 					}
1907 1907
 				}
1908 1908
 				// you appear to be lost?
1909
-				$this->_redirect_wayward_request( $primary_registrant );
1909
+				$this->_redirect_wayward_request($primary_registrant);
1910 1910
 			}
1911 1911
 		}
1912 1912
 	}
@@ -1920,16 +1920,16 @@  discard block
 block discarded – undo
1920 1920
 	 * @param \EE_Registration $primary_registrant
1921 1921
 	 * @return bool
1922 1922
 	 */
1923
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
1924
-		if ( ! $primary_registrant instanceof EE_Registration ) {
1923
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
1924
+		if ( ! $primary_registrant instanceof EE_Registration) {
1925 1925
 			// try redirecting based on the current TXN
1926 1926
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null;
1927
-			if ( ! $primary_registrant instanceof EE_Registration ) {
1927
+			if ( ! $primary_registrant instanceof EE_Registration) {
1928 1928
 				EE_Error::add_error(
1929 1929
 					sprintf(
1930
-						__( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ),
1930
+						__('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'),
1931 1931
 						'<br/>',
1932
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1932
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
1933 1933
 					),
1934 1934
 					__FILE__, __FUNCTION__, __LINE__
1935 1935
 				);
@@ -1957,16 +1957,16 @@  discard block
 block discarded – undo
1957 1957
 	 * @param \EE_Offsite_Gateway $gateway
1958 1958
 	 * @return \EE_Payment
1959 1959
 	 */
1960
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
1960
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
1961 1961
 		try {
1962 1962
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
1963
-			if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) {
1963
+			if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
1964 1964
 				$payment = $this->checkout->transaction->last_payment();
1965 1965
 				//$payment_source = 'last_payment';
1966 1966
 			} else {
1967 1967
 				// get payment details and process results
1968 1968
 				/** @type EE_Payment_Processor $payment_processor */
1969
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1969
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1970 1970
 				$payment = $payment_processor->process_ipn(
1971 1971
 					$_REQUEST,
1972 1972
 					$this->checkout->transaction,
@@ -1976,14 +1976,14 @@  discard block
 block discarded – undo
1976 1976
 				);
1977 1977
 				//$payment_source = 'process_ipn';
1978 1978
 			}
1979
-		} catch ( Exception $e ) {
1979
+		} catch (Exception $e) {
1980 1980
 			// let's just eat the exception and try to move on using any previously set payment info
1981 1981
 			$payment = $this->checkout->transaction->last_payment();
1982 1982
 			//$payment_source = 'last_payment after Exception';
1983 1983
 			// but if we STILL don't have a payment object
1984
-			if ( ! $payment instanceof EE_Payment ) {
1984
+			if ( ! $payment instanceof EE_Payment) {
1985 1985
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
1986
-				$this->_handle_payment_processor_exception( $e );
1986
+				$this->_handle_payment_processor_exception($e);
1987 1987
 			}
1988 1988
 		}
1989 1989
 		// DEBUG LOG
@@ -2007,13 +2007,13 @@  discard block
 block discarded – undo
2007 2007
 	 * @param EE_Payment $payment
2008 2008
 	 * @return EE_Payment | FALSE
2009 2009
 	 */
2010
-	private function _process_cancelled_payments( $payment = NULL ) {
2010
+	private function _process_cancelled_payments($payment = NULL) {
2011 2011
 		if (
2012
-			isset( $_REQUEST[ 'ee_cancel_payment' ] )
2012
+			isset($_REQUEST['ee_cancel_payment'])
2013 2013
 			&& $payment instanceof EE_Payment
2014 2014
 			&& $payment->status() == EEM_Payment::status_id_failed
2015 2015
 		) {
2016
-			$payment->set_status( EEM_Payment::status_id_cancelled );
2016
+			$payment->set_status(EEM_Payment::status_id_cancelled);
2017 2017
 		}
2018 2018
 		return $payment;
2019 2019
 	}
@@ -2030,23 +2030,23 @@  discard block
 block discarded – undo
2030 2030
 	public function get_transaction_details_for_gateways() {
2031 2031
 		$txn_details = array();
2032 2032
 		// ya gotta make a choice man
2033
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
2033
+		if (empty($this->checkout->selected_method_of_payment)) {
2034 2034
 			$txn_details = array(
2035
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
2035
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
2036 2036
 			);
2037 2037
 		}
2038 2038
 		// get EE_Payment_Method object
2039 2039
 		if (
2040
-			empty( $txn_details ) &&
2040
+			empty($txn_details) &&
2041 2041
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
2042 2042
 		) {
2043 2043
 			$txn_details = array(
2044 2044
 				'selected_method_of_payment' => $this->checkout->selected_method_of_payment,
2045
-				'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' )
2045
+				'error' => __('A valid Payment Method could not be determined.', 'event_espresso')
2046 2046
 			);
2047 2047
 		}
2048
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
2049
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
2048
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
2049
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
2050 2050
 			$txn_details = array(
2051 2051
 				'TXN_ID'        			=> $this->checkout->transaction->ID(),
2052 2052
 				'TXN_timestamp' 	=> $this->checkout->transaction->datetime(),
@@ -2057,7 +2057,7 @@  discard block
 block discarded – undo
2057 2057
 				'PMD_ID'        			=> $this->checkout->transaction->payment_method_ID(),
2058 2058
 				'payment_amount' => $this->checkout->amount_owing,
2059 2059
 				'return_url' 				=> $return_url,
2060
-				'cancel_url' 				=> add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
2060
+				'cancel_url' 				=> add_query_arg(array('ee_cancel_payment' => true), $return_url),
2061 2061
 				'notify_url' 				=> EE_Config::instance()->core->txn_page_url(
2062 2062
 					array(
2063 2063
 						'e_reg_url_link'    			=> $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -2066,7 +2066,7 @@  discard block
 block discarded – undo
2066 2066
 				)
2067 2067
 			);
2068 2068
 		}
2069
-		echo json_encode( $txn_details );
2069
+		echo json_encode($txn_details);
2070 2070
 		exit();
2071 2071
 	}
2072 2072
 
Please login to merge, or discard this patch.
core/EE_Payment_Processor.core.php 1 patch
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 /**
4 4
  *
5 5
  * EE_Payment_Processor
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function instance() {
29 29
 		// check if class object is instantiated
30
-		if ( ! self::$_instance instanceof EE_Payment_Processor ) {
30
+		if ( ! self::$_instance instanceof EE_Payment_Processor) {
31 31
 			self::$_instance = new self();
32 32
 		}
33 33
 		return self::$_instance;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *@return EE_Payment_Processor
43 43
 	 */
44 44
 	private function __construct() {
45
-		do_action( 'AHEE__EE_Payment_Processor__construct' );
45
+		do_action('AHEE__EE_Payment_Processor__construct');
46 46
 	}
47 47
 
48 48
 
@@ -64,42 +64,42 @@  discard block
 block discarded – undo
64 64
 	 * @param string 	       						$cancel_url 	URL to return to if off-site payments are cancelled
65 65
 	 * @return EE_Payment
66 66
 	 */
67
-	public function process_payment( EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '' ) {
68
-		if( $amount < 0 ) {
67
+	public function process_payment(EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '') {
68
+		if ($amount < 0) {
69 69
 			throw new EE_Error( 
70 70
 					sprintf(
71
-							__( 'Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso' ),
71
+							__('Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso'),
72 72
 							$amount,
73 73
 							$transaction->ID() ) );
74 74
 		}
75 75
 		// verify payment method
76
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE );
76
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE);
77 77
 		// verify transaction
78
-		EEM_Transaction::instance()->ensure_is_obj( $transaction );
79
-		$transaction->set_payment_method_ID( $payment_method->ID() );
78
+		EEM_Transaction::instance()->ensure_is_obj($transaction);
79
+		$transaction->set_payment_method_ID($payment_method->ID());
80 80
 		// verify payment method type
81
-		if ( $payment_method->type_obj() instanceof EE_PMT_Base ){
81
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
82 82
 			$payment = $payment_method->type_obj()->process_payment(
83 83
 				$transaction,
84
-				min( $amount, $transaction->remaining() ),//make sure we don't overcharge
84
+				min($amount, $transaction->remaining()), //make sure we don't overcharge
85 85
 				$billing_form,
86 86
 				$return_url,
87
-				add_query_arg( array( 'ee_cancel_payment' => true ), $cancel_url ),
87
+				add_query_arg(array('ee_cancel_payment' => true), $cancel_url),
88 88
 				$method,
89 89
 				$by_admin
90 90
 			);
91 91
 			// check if payment method uses an off-site gateway
92
-			if ( $payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite ) {
92
+			if ($payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite) {
93 93
 				// don't process payments for off-site gateways yet because no payment has occurred yet
94
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
94
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
95 95
 			}
96 96
 			return $payment;
97 97
 		} else {
98 98
 			EE_Error::add_error(
99 99
 				sprintf(
100
-					__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
100
+					__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
101 101
 					'<br/>',
102
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
102
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
103 103
 				), __FILE__, __FUNCTION__, __LINE__
104 104
 			);
105 105
 			return NULL;
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 	 * @throws EE_Error
116 116
 	 * @return string
117 117
 	 */
118
-	public function get_ipn_url_for_payment_method( $transaction, $payment_method ){
118
+	public function get_ipn_url_for_payment_method($transaction, $payment_method) {
119 119
 		/** @type EE_Transaction $transaction */
120
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
120
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
121 121
 		$primary_reg = $transaction->primary_registration();
122
-		if( ! $primary_reg instanceof EE_Registration ){
123
-			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"),$transaction->ID()));
122
+		if ( ! $primary_reg instanceof EE_Registration) {
123
+			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"), $transaction->ID()));
124 124
 		}
125
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true);
125
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true);
126 126
 		$url = add_query_arg(
127 127
 			array(
128 128
 				'e_reg_url_link'=>$primary_reg->reg_url_link(),
@@ -149,81 +149,81 @@  discard block
 block discarded – undo
149 149
 	 * @throws Exception
150 150
 	 * @return EE_Payment
151 151
 	 */
152
-	public function process_ipn( $_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true ){
153
-		$_req_data = $this->_remove_unusable_characters( $_req_data );
154
-		EE_Registry::instance()->load_model( 'Change_Log' );
155
-		EE_Processor_Base::set_IPN( $separate_IPN_request );
156
-		if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){
157
-			$obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) );
158
-		}elseif( $payment_method instanceof EE_Payment ){
152
+	public function process_ipn($_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true) {
153
+		$_req_data = $this->_remove_unusable_characters($_req_data);
154
+		EE_Registry::instance()->load_model('Change_Log');
155
+		EE_Processor_Base::set_IPN($separate_IPN_request);
156
+		if ($transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method) {
157
+			$obj_for_log = EEM_Payment::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), 'order_by' => array('PAY_timestamp' => 'desc')));
158
+		}elseif ($payment_method instanceof EE_Payment) {
159 159
 			$obj_for_log = $payment_method;
160
-		}elseif( $transaction instanceof EE_Transaction ){
160
+		}elseif ($transaction instanceof EE_Transaction) {
161 161
 			$obj_for_log = $transaction;
162
-		}else{
162
+		} else {
163 163
 			$obj_for_log = null;
164 164
 		}
165 165
 		$log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log);
166
-		try{
166
+		try {
167 167
 			/**
168 168
 			 * @var EE_Payment $payment
169 169
 			 */
170 170
 			$payment = NULL;
171
-			if($transaction && $payment_method){
171
+			if ($transaction && $payment_method) {
172 172
 				/** @type EE_Transaction $transaction */
173 173
 				$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
174 174
 				/** @type EE_Payment_Method $payment_method */
175 175
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
176
-				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
177
-						$payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction );
176
+				if ($payment_method->type_obj() instanceof EE_PMT_Base) {
177
+						$payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
178 178
 						$log->set_object($payment);
179 179
 				} else {
180 180
 					// not a payment
181 181
 					EE_Error::add_error(
182 182
 						sprintf(
183
-							__( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ),
183
+							__('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'),
184 184
 							'<br/>',
185
-							EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
185
+							EE_Registry::instance()->CFG->organization->get_pretty('email')
186 186
 						),
187 187
 						__FILE__, __FUNCTION__, __LINE__
188 188
 					);
189 189
 				}
190
-			}else{
190
+			} else {
191 191
 				//that's actually pretty ok. The IPN just wasn't able
192 192
 				//to identify which transaction or payment method this was for
193 193
 				// give all active payment methods a chance to claim it
194 194
 				$active_pms = EEM_Payment_Method::instance()->get_all_active();
195
-				foreach( $active_pms as $payment_method ){
196
-					try{
197
-						$payment = $payment_method->type_obj()->handle_unclaimed_ipn( $_req_data );
195
+				foreach ($active_pms as $payment_method) {
196
+					try {
197
+						$payment = $payment_method->type_obj()->handle_unclaimed_ipn($_req_data);
198 198
 						EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment);
199 199
 						break;
200
-					} catch( EE_Error $e ) {
200
+					} catch (EE_Error $e) {
201 201
 						//that's fine- it apparently couldn't handle the IPN
202 202
 					}
203 203
 				}
204 204
 
205 205
 			}
206 206
 // 			EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method);
207
-			if( $payment instanceof EE_Payment){
207
+			if ($payment instanceof EE_Payment) {
208 208
 				$payment->save();
209 209
 				//  update the TXN
210
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
211
-			}else{
210
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request);
211
+			} else {
212 212
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
213
-				if($payment_method){
213
+				if ($payment_method) {
214 214
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
215
-				}elseif($transaction){
215
+				}elseif ($transaction) {
216 216
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
217 217
 				}
218 218
 			}
219 219
 			return $payment;
220 220
 
221
-		} catch( EE_Error $e ) {
221
+		} catch (EE_Error $e) {
222 222
 			do_action(
223 223
 				'AHEE__log', __FILE__, __FUNCTION__, sprintf(
224
-					__( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ),
225
-					print_r( $transaction, TRUE ),
226
-					print_r( $_req_data, TRUE ),
224
+					__('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'),
225
+					print_r($transaction, TRUE),
226
+					print_r($_req_data, TRUE),
227 227
 					$e->getMessage()
228 228
 				)
229 229
 			);
@@ -237,14 +237,14 @@  discard block
 block discarded – undo
237 237
 	 * @param array $request_data
238 238
 	 * @return array|string
239 239
 	 */
240
-	protected function _remove_unusable_characters( $request_data ) {
241
-		if( is_array( $request_data ) ) {
240
+	protected function _remove_unusable_characters($request_data) {
241
+		if (is_array($request_data)) {
242 242
 			$return_data = array();
243
-			foreach( $request_data as $key => $value ) {
244
-				$return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value );
243
+			foreach ($request_data as $key => $value) {
244
+				$return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value);
245 245
 			}
246
-		}else{
247
-			$return_data =  preg_replace('/[^[:print:]]/', '', $request_data);
246
+		} else {
247
+			$return_data = preg_replace('/[^[:print:]]/', '', $request_data);
248 248
 		}
249 249
 		return $return_data;
250 250
 	}
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
 	 * @return EE_Payment
267 267
 	 * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO, to call handle_ipn() for offsite gateways that don't receive separate IPNs
268 268
 	 */
269
-	public function finalize_payment_for( $transaction, $update_txn = TRUE ){
269
+	public function finalize_payment_for($transaction, $update_txn = TRUE) {
270 270
 		/** @var $transaction EE_Transaction */
271
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
271
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
272 272
 		$last_payment_method = $transaction->payment_method();
273
-		if ( $last_payment_method instanceof EE_Payment_Method ) {
274
-			$payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction );
275
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
273
+		if ($last_payment_method instanceof EE_Payment_Method) {
274
+			$payment = $last_payment_method->type_obj()->finalize_payment_for($transaction);
275
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
276 276
 			return $payment;
277 277
 		} else {
278 278
 			return NULL;
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 	 * @internal param float $amount
290 290
 	 * @return EE_Payment
291 291
 	 */
292
-	public function process_refund( EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array() ){
293
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) {
294
-			$payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info );
295
-			$this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund );
292
+	public function process_refund(EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array()) {
293
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) {
294
+			$payment_method->type_obj()->process_refund($payment_to_refund, $refund_info);
295
+			$this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund);
296 296
 		}
297 297
 		return $payment_to_refund;
298 298
 	}
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
 	 *                        TXN is locked before updating
335 335
 	 * @throws \EE_Error
336 336
 	 */
337
-	public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){
337
+	public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) {
338 338
 		$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful';
339 339
 		/** @type EE_Transaction $transaction */
340
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
340
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
341 341
 		// can we freely update the TXN at this moment?
342
-		if ( $IPN && $transaction->is_locked() ) {
342
+		if ($IPN && $transaction->is_locked()) {
343 343
 			// don't update the transaction at this exact moment
344 344
 			// because the TXN is active in another request
345 345
 			EE_Cron_Tasks::schedule_update_transaction_with_payment(
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 			);
350 350
 		} else {
351 351
 			// verify payment and that it has been saved
352
-			if ( $payment instanceof EE_Payment && $payment->ID() ) {
352
+			if ($payment instanceof EE_Payment && $payment->ID()) {
353 353
 				//$this->log(
354 354
 				//	__CLASS__, __FUNCTION__, __LINE__,
355 355
 				//	$payment->transaction(),
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
 				//		'payment' => $payment,
359 359
 				//	)
360 360
 				//);
361
-				if( $payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base ){
362
-					$payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment );
361
+				if ($payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base) {
362
+					$payment->payment_method()->type_obj()->update_txn_based_on_payment($payment);
363 363
 					//$this->log(
364 364
 					//	__CLASS__, __FUNCTION__, __LINE__,
365 365
 					//	$payment->transaction(),
@@ -368,36 +368,36 @@  discard block
 block discarded – undo
368 368
 					//	)
369 369
 					//);
370 370
 					// update TXN registrations with payment info
371
-					$this->process_registration_payments( $transaction, $payment );
371
+					$this->process_registration_payments($transaction, $payment);
372 372
 				}
373 373
 				$do_action = $payment->just_approved() ? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful' : $do_action;
374 374
 			} else {
375 375
 				// send out notifications
376
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
376
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
377 377
 				$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made';
378 378
 			}
379 379
 			// if this is an IPN, then we want to know the initial TXN status prior to updating the TXN
380 380
 			// so that we know whether the status has changed and notifications should be triggered
381
-			if ( $IPN ) {
381
+			if ($IPN) {
382 382
 				/** @type EE_Transaction_Processor $transaction_processor */
383
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
384
-				$transaction_processor->set_old_txn_status( $transaction->status_ID() );
383
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
384
+				$transaction_processor->set_old_txn_status($transaction->status_ID());
385 385
 			}
386
-			if ( $payment->status() !== EEM_Payment::status_id_failed ) {
386
+			if ($payment->status() !== EEM_Payment::status_id_failed) {
387 387
 				/** @type EE_Transaction_Payments $transaction_payments */
388
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
388
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
389 389
 				// set new value for total paid
390
-				$transaction_payments->calculate_total_payments_and_update_status( $transaction );
390
+				$transaction_payments->calculate_total_payments_and_update_status($transaction);
391 391
 				// call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ???
392
-				if ( $update_txn ) {
393
-					$this->_post_payment_processing( $transaction, $payment, $IPN );
392
+				if ($update_txn) {
393
+					$this->_post_payment_processing($transaction, $payment, $IPN);
394 394
 				}
395 395
 			}
396 396
 			// granular hook for others to use.
397
-			do_action( $do_action, $transaction, $payment );
398
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' );
397
+			do_action($do_action, $transaction, $payment);
398
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action');
399 399
 			//global hook for others to use.
400
-			do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment );
400
+			do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment);
401 401
 		}
402 402
 	}
403 403
 
@@ -411,25 +411,25 @@  discard block
 block discarded – undo
411 411
 	 * @param EE_Registration[] $registrations
412 412
 	 * @throws \EE_Error
413 413
 	 */
414
-	public function process_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $registrations = array() ) {
414
+	public function process_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registrations = array()) {
415 415
 		// only process if payment was successful
416
-		if ( $payment->status() !== EEM_Payment::status_id_approved ) {
416
+		if ($payment->status() !== EEM_Payment::status_id_approved) {
417 417
 			return;
418 418
 		}
419 419
 		//EEM_Registration::instance()->show_next_x_db_queries();
420
-		if ( empty( $registrations )) {
420
+		if (empty($registrations)) {
421 421
 			// find registrations with monies owing that can receive a payment
422
-			$registrations = $transaction->registrations( array(
422
+			$registrations = $transaction->registrations(array(
423 423
 				array(
424 424
 					// only these reg statuses can receive payments
425
-					'STS_ID'  => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ),
426
-					'REG_final_price'  => array( '!=', 0 ),
427
-					'REG_final_price*' => array( '!=', 'REG_paid', true ),
425
+					'STS_ID'  => array('IN', EEM_Registration::reg_statuses_that_allow_payment()),
426
+					'REG_final_price'  => array('!=', 0),
427
+					'REG_final_price*' => array('!=', 'REG_paid', true),
428 428
 				)
429
-			) );
429
+			));
430 430
 		}
431 431
 		// still nothing ??!??
432
-		if ( empty( $registrations )) {
432
+		if (empty($registrations)) {
433 433
 			return;
434 434
 		}
435 435
 		// todo: break out the following logic into a separate strategy class
@@ -441,28 +441,28 @@  discard block
 block discarded – undo
441 441
 
442 442
 		$refund = $payment->is_a_refund();
443 443
 		// how much is available to apply to registrations?
444
-		$available_payment_amount = abs( $payment->amount() );
445
-		foreach ( $registrations as $registration ) {
446
-			if ( $registration instanceof EE_Registration ) {
444
+		$available_payment_amount = abs($payment->amount());
445
+		foreach ($registrations as $registration) {
446
+			if ($registration instanceof EE_Registration) {
447 447
 				// nothing left?
448
-				if ( $available_payment_amount <= 0 ) {
448
+				if ($available_payment_amount <= 0) {
449 449
 					break;
450 450
 				}
451
-				if ( $refund ) {
452
-					$available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount );
451
+				if ($refund) {
452
+					$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
453 453
 				} else {
454
-					$available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount );
454
+					$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
455 455
 				}
456 456
 			}
457 457
 		}
458
-		if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) {
458
+		if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) {
459 459
 			EE_Error::add_attention(
460 460
 				sprintf(
461
-					__( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ),
462
-					EEH_Template::format_currency( $available_payment_amount ),
463
-					implode( ', ',  array_keys( $registrations ) ),
461
+					__('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'),
462
+					EEH_Template::format_currency($available_payment_amount),
463
+					implode(', ', array_keys($registrations)),
464 464
 					'<br/>',
465
-					EEH_Template::format_currency( $payment->amount() )
465
+					EEH_Template::format_currency($payment->amount())
466 466
 				),
467 467
 				__FILE__, __FUNCTION__, __LINE__
468 468
 			);
@@ -479,17 +479,17 @@  discard block
 block discarded – undo
479 479
 	 * @param float $available_payment_amount
480 480
 	 * @return float
481 481
 	 */
482
-	public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) {
482
+	public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) {
483 483
 		$owing = $registration->final_price() - $registration->paid();
484
-		if ( $owing > 0 ) {
484
+		if ($owing > 0) {
485 485
 			// don't allow payment amount to exceed the available payment amount, OR the amount owing
486
-			$payment_amount = min( $available_payment_amount, $owing );
486
+			$payment_amount = min($available_payment_amount, $owing);
487 487
 			// update $available_payment_amount
488 488
 			$available_payment_amount = $available_payment_amount - $payment_amount;
489 489
 			//calculate and set new REG_paid
490
-			$registration->set_paid( $registration->paid() + $payment_amount );
490
+			$registration->set_paid($registration->paid() + $payment_amount);
491 491
 			// now save it
492
-			$this->_apply_registration_payment( $registration, $payment, $payment_amount );
492
+			$this->_apply_registration_payment($registration, $payment, $payment_amount);
493 493
 		}
494 494
 		return $available_payment_amount;
495 495
 	}
@@ -504,19 +504,19 @@  discard block
 block discarded – undo
504 504
 	 * @param float $payment_amount
505 505
 	 * @return float
506 506
 	 */
507
-	protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) {
507
+	protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) {
508 508
 		// find any existing reg payment records for this registration and payment
509 509
 		$existing_reg_payment = EEM_Registration_Payment::instance()->get_one(
510
-			array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) )
510
+			array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID()))
511 511
 		);
512 512
 		// if existing registration payment exists
513
-		if ( $existing_reg_payment instanceof EE_Registration_Payment ) {
513
+		if ($existing_reg_payment instanceof EE_Registration_Payment) {
514 514
 			// then update that record
515
-			$existing_reg_payment->set_amount( $payment_amount );
515
+			$existing_reg_payment->set_amount($payment_amount);
516 516
 			$existing_reg_payment->save();
517 517
 		} else {
518 518
 			// or add new relation between registration and payment and set amount
519
-			$registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) );
519
+			$registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount));
520 520
 			// make it stick
521 521
 			$registration->save();
522 522
 		}
@@ -532,21 +532,21 @@  discard block
 block discarded – undo
532 532
 	 * @param float $available_refund_amount - IMPORTANT !!! SEND AVAILABLE REFUND AMOUNT AS A POSITIVE NUMBER
533 533
 	 * @return float
534 534
 	 */
535
-	public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) {
535
+	public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) {
536 536
 		//EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ );
537
-		if ( $registration->paid() > 0 ) {
537
+		if ($registration->paid() > 0) {
538 538
 			// ensure $available_refund_amount is NOT negative
539
-			$available_refund_amount = abs( $available_refund_amount );
539
+			$available_refund_amount = abs($available_refund_amount);
540 540
 			// don't allow refund amount to exceed the available payment amount, OR the amount paid
541
-			$refund_amount = min( $available_refund_amount, $registration->paid() );
541
+			$refund_amount = min($available_refund_amount, $registration->paid());
542 542
 			// update $available_payment_amount
543 543
 			$available_refund_amount = $available_refund_amount - $refund_amount;
544 544
 			//calculate and set new REG_paid
545
-			$registration->set_paid( $registration->paid() - $refund_amount );
545
+			$registration->set_paid($registration->paid() - $refund_amount);
546 546
 			// convert payment amount back to a negative value for storage in the db
547
-			$refund_amount = abs( $refund_amount ) * -1;
547
+			$refund_amount = abs($refund_amount) * -1;
548 548
 			// now save it
549
-			$this->_apply_registration_payment( $registration, $payment, $refund_amount );
549
+			$this->_apply_registration_payment($registration, $payment, $refund_amount);
550 550
 		}
551 551
 		return $available_refund_amount;
552 552
 	}
@@ -564,12 +564,12 @@  discard block
 block discarded – undo
564 564
 	 * @param EE_Payment     $payment
565 565
 	 * @param bool           $IPN
566 566
 	 */
567
-	protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) {
567
+	protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) {
568 568
 
569 569
 		/** @type EE_Transaction_Processor $transaction_processor */
570
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
570
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
571 571
 		// is the Payment Options Reg Step completed ?
572
-		$payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' );
572
+		$payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options');
573 573
 		// DEBUG LOG
574 574
 		//$this->log(
575 575
 		//	__CLASS__, __FUNCTION__, __LINE__,
@@ -582,14 +582,14 @@  discard block
 block discarded – undo
582 582
 		// if the Payment Options Reg Step is completed...
583 583
 		$revisit = $payment_options_step_completed === true ? true : false;
584 584
 		// then this is kinda sorta a revisit with regards to payments at least
585
-		$transaction_processor->set_revisit( $revisit );
585
+		$transaction_processor->set_revisit($revisit);
586 586
 		// if this is an IPN, let's consider the Payment Options Reg Step completed if not already
587 587
 		if (
588 588
 			$IPN &&
589 589
 			$payment_options_step_completed !== true &&
590
-			( $payment->is_approved() || $payment->is_pending() )
590
+			($payment->is_approved() || $payment->is_pending())
591 591
 		) {
592
-			$payment_options_step_completed = $transaction_processor->set_reg_step_completed( $transaction, 'payment_options' );
592
+			$payment_options_step_completed = $transaction_processor->set_reg_step_completed($transaction, 'payment_options');
593 593
 		}
594 594
 		// DEBUG LOG
595 595
 		//$this->log(
@@ -601,11 +601,11 @@  discard block
 block discarded – undo
601 601
 		//	)
602 602
 		//);
603 603
 		/** @type EE_Transaction_Payments $transaction_payments */
604
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
604
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
605 605
 		// maybe update status, but don't save transaction just yet
606
-		$transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false );
606
+		$transaction_payments->update_transaction_status_based_on_total_paid($transaction, false);
607 607
 		// check if 'finalize_registration' step has been completed...
608
-		$finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' );
608
+		$finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration');
609 609
 		// DEBUG LOG
610 610
 		//$this->log(
611 611
 		//	__CLASS__, __FUNCTION__, __LINE__,
@@ -616,9 +616,9 @@  discard block
 block discarded – undo
616 616
 		//	)
617 617
 		//);
618 618
 		//  if this is an IPN and the final step has not been initiated
619
-		if ( $IPN && $payment_options_step_completed && $finalized === false ) {
619
+		if ($IPN && $payment_options_step_completed && $finalized === false) {
620 620
 			// and if it hasn't already been set as being started...
621
-			$finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' );
621
+			$finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration');
622 622
 			// DEBUG LOG
623 623
 			//$this->log(
624 624
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -631,13 +631,13 @@  discard block
 block discarded – undo
631 631
 		}
632 632
 		$transaction->save();
633 633
 		// because the above will return false if the final step was not fully completed, we need to check again...
634
-		if ( $IPN && $finalized !== false ) {
634
+		if ($IPN && $finalized !== false) {
635 635
 			// and if we are all good to go, then send out notifications
636
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
636
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
637 637
 			// DEBUG LOG
638 638
 			//$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction );
639 639
 			//ok, now process the transaction according to the payment
640
-			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment );
640
+			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment);
641 641
 		}
642 642
 		// DEBUG LOG
643 643
 		//$this->log(
Please login to merge, or discard this patch.
core/db_classes/EE_Ticket.class.php 1 patch
Spacing   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 *                             		    date_format and the second value is the time format
67 67
 	 * @return EE_Ticket
68 68
 	 */
69
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
70
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
71
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
69
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
70
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
71
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
72 72
 	}
73 73
 
74 74
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 *                          		the website will be used.
80 80
 	 * @return EE_Ticket
81 81
 	 */
82
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
83
-		return new self( $props_n_values, TRUE, $timezone );
82
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
83
+		return new self($props_n_values, TRUE, $timezone);
84 84
 	}
85 85
 
86 86
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return bool
90 90
 	 */
91 91
 	public function parent() {
92
-		return $this->get( 'TKT_parent' );
92
+		return $this->get('TKT_parent');
93 93
 	}
94 94
 
95 95
 
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 	 * @param  int $DTT_ID the primary key for a particular datetime
100 100
 	 * @return boolean
101 101
 	 */
102
-	public function available( $DTT_ID = 0 ) {
102
+	public function available($DTT_ID = 0) {
103 103
 		// are we checking availability for a particular datetime ?
104
-		if ( $DTT_ID ) {
104
+		if ($DTT_ID) {
105 105
 			// get that datetime object
106
-			$datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) );
106
+			$datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID)));
107 107
 			// if  ticket sales for this datetime have exceeded the reg limit...
108
-			if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) {
108
+			if ($datetime instanceof EE_Datetime && $datetime->sold_out()) {
109 109
 				return FALSE;
110 110
 			}
111 111
 		}
@@ -121,22 +121,22 @@  discard block
 block discarded – undo
121 121
 	 * @param bool | null $remaining  if it is already known that tickets are available, then simply pass a bool to save further processing
122 122
 	 * @return mixed status int if the display string isn't requested
123 123
 	 */
124
-	public function ticket_status( $display = FALSE, $remaining = null ) {
125
-		$remaining = is_bool( $remaining ) ? $remaining : $this->is_remaining();
126
-		if ( ! $remaining ) {
127
-			return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out;
124
+	public function ticket_status($display = FALSE, $remaining = null) {
125
+		$remaining = is_bool($remaining) ? $remaining : $this->is_remaining();
126
+		if ( ! $remaining) {
127
+			return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out;
128 128
 		}
129
-		if ( $this->get( 'TKT_deleted' ) ) {
130
-			return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived;
129
+		if ($this->get('TKT_deleted')) {
130
+			return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived;
131 131
 		}
132
-		if ( $this->is_expired() ) {
133
-			return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired;
132
+		if ($this->is_expired()) {
133
+			return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired;
134 134
 		}
135
-		if ( $this->is_pending() ) {
136
-			return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending;
135
+		if ($this->is_pending()) {
136
+			return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending;
137 137
 		}
138
-		if ( $this->is_on_sale() ) {
139
-			return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale;
138
+		if ($this->is_on_sale()) {
139
+			return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale;
140 140
 		}
141 141
 		return '';
142 142
 	}
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 	 * @param  int $DTT_ID if an int above 0 is included here then we get a specific dtt.
151 151
 	 * @return boolean         true = tickets remaining, false not.
152 152
 	 */
153
-	public function is_remaining( $DTT_ID = 0 ) {
154
-		$num_remaining = $this->remaining( $DTT_ID );
155
-		if ( $num_remaining === 0 ) {
153
+	public function is_remaining($DTT_ID = 0) {
154
+		$num_remaining = $this->remaining($DTT_ID);
155
+		if ($num_remaining === 0) {
156 156
 			return FALSE;
157 157
 		}
158
-		if ( $num_remaining > 0 && $num_remaining < $this->min() ) {
158
+		if ($num_remaining > 0 && $num_remaining < $this->min()) {
159 159
 			return FALSE;
160 160
 		}
161 161
 		return TRUE;
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 *                     set to 0 for all related datetimes
171 171
 	 * @return int
172 172
 	 */
173
-	public function remaining( $DTT_ID = 0 ) {
174
-		return $this->real_quantity_on_ticket('saleable', $DTT_ID );
173
+	public function remaining($DTT_ID = 0) {
174
+		return $this->real_quantity_on_ticket('saleable', $DTT_ID);
175 175
 	}
176 176
 
177 177
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @return int
182 182
 	 */
183 183
 	function min() {
184
-		return $this->get( 'TKT_min' );
184
+		return $this->get('TKT_min');
185 185
 	}
186 186
 
187 187
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 * @return boolean
192 192
 	 */
193 193
 	public function is_expired() {
194
-		return ( $this->get_raw( 'TKT_end_date' ) < time() );
194
+		return ($this->get_raw('TKT_end_date') < time());
195 195
 	}
196 196
 
197 197
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @return boolean
202 202
 	 */
203 203
 	public function is_pending() {
204
-		return ( $this->get_raw( 'TKT_start_date' ) > time() );
204
+		return ($this->get_raw('TKT_start_date') > time());
205 205
 	}
206 206
 
207 207
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	 * @return boolean
212 212
 	 */
213 213
 	public function is_on_sale() {
214
-		return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() );
214
+		return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time());
215 215
 	}
216 216
 
217 217
 
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	 * @param string 	$conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
223 223
 	 * @return array
224 224
 	 */
225
-	public function date_range( $dt_frmt = '', $conjunction = ' - ' ) {
226
-		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : '';
227
-		$last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : '';
225
+	public function date_range($dt_frmt = '', $conjunction = ' - ') {
226
+		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : '';
227
+		$last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : '';
228 228
 
229
-		return $first_date && $last_date ? $first_date . $conjunction  . $last_date : '';
229
+		return $first_date && $last_date ? $first_date.$conjunction.$last_date : '';
230 230
 	}
231 231
 
232 232
 
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 	 * @return EE_Datetime
237 237
 	 */
238 238
 	public function first_datetime() {
239
-		$datetimes = $this->datetimes( array( 'limit' => 1 ) );
240
-		return reset( $datetimes );
239
+		$datetimes = $this->datetimes(array('limit' => 1));
240
+		return reset($datetimes);
241 241
 	}
242 242
 
243 243
 
@@ -248,11 +248,11 @@  discard block
 block discarded – undo
248 248
 	 * @param array $query_params see EEM_Base::get_all()
249 249
 	 * @return EE_Datetime[]
250 250
 	 */
251
-	public function datetimes( $query_params = array() ) {
252
-		if ( ! isset( $query_params[ 'order_by' ] ) ) {
253
-			$query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC';
251
+	public function datetimes($query_params = array()) {
252
+		if ( ! isset($query_params['order_by'])) {
253
+			$query_params['order_by']['DTT_order'] = 'ASC';
254 254
 		}
255
-		return $this->get_many_related( 'Datetime', $query_params );
255
+		return $this->get_many_related('Datetime', $query_params);
256 256
 	}
257 257
 
258 258
 
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 * @return EE_Datetime
263 263
 	 */
264 264
 	public function last_datetime() {
265
-		$datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) );
266
-		return end( $datetimes );
265
+		$datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC')));
266
+		return end($datetimes);
267 267
 	}
268 268
 
269 269
 
@@ -277,22 +277,22 @@  discard block
 block discarded – undo
277 277
 	 * @param  int    $dtt_id [optional] include the dtt_id with $what = 'datetime'.
278 278
 	 * @return mixed (array|int)          how many tickets have sold
279 279
 	 */
280
-	public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) {
280
+	public function tickets_sold($what = 'ticket', $dtt_id = NULL) {
281 281
 		$total = 0;
282 282
 		$tickets_sold = $this->_all_tickets_sold();
283
-		switch ( $what ) {
283
+		switch ($what) {
284 284
 			case 'ticket' :
285
-				return $tickets_sold[ 'ticket' ];
285
+				return $tickets_sold['ticket'];
286 286
 				break;
287 287
 			case 'datetime' :
288
-				if ( empty( $tickets_sold[ 'datetime' ] ) ) {
288
+				if (empty($tickets_sold['datetime'])) {
289 289
 					return $total;
290 290
 				}
291
-				if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) {
292
-					EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
291
+				if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) {
292
+					EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
293 293
 					return $total;
294 294
 				}
295
-				return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ];
295
+				return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id];
296 296
 				break;
297 297
 			default:
298 298
 				return $total;
@@ -306,15 +306,15 @@  discard block
 block discarded – undo
306 306
 	 * @return EE_Ticket[]
307 307
 	 */
308 308
 	protected function _all_tickets_sold() {
309
-		$datetimes = $this->get_many_related( 'Datetime' );
309
+		$datetimes = $this->get_many_related('Datetime');
310 310
 		$tickets_sold = array();
311
-		if ( ! empty( $datetimes ) ) {
312
-			foreach ( $datetimes as $datetime ) {
313
-				$tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' );
311
+		if ( ! empty($datetimes)) {
312
+			foreach ($datetimes as $datetime) {
313
+				$tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold');
314 314
 			}
315 315
 		}
316 316
 		//Tickets sold
317
-		$tickets_sold[ 'ticket' ] = $this->sold();
317
+		$tickets_sold['ticket'] = $this->sold();
318 318
 		return $tickets_sold;
319 319
 	}
320 320
 
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 	 * @param  bool $return_array whether to return as an array indexed by price id or just the object.
328 328
 	 * @return EE_Price
329 329
 	 */
330
-	public function base_price( $return_array = FALSE ) {
331
-		$_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price );
332
-		return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) );
330
+	public function base_price($return_array = FALSE) {
331
+		$_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price);
332
+		return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where));
333 333
 	}
334 334
 
335 335
 
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 	 * @return EE_Price[]
342 342
 	 */
343 343
 	public function price_modifiers() {
344
-		$query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) );
345
-		return $this->prices( $query_params );
344
+		$query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax))));
345
+		return $this->prices($query_params);
346 346
 	}
347 347
 
348 348
 
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
 	 * @param array $query_params like EEM_Base::get_all
353 353
 	 * @return EE_Price[]
354 354
 	 */
355
-	public function prices( $query_params = array() ) {
356
-		return $this->get_many_related( 'Price', $query_params );
355
+	public function prices($query_params = array()) {
356
+		return $this->get_many_related('Price', $query_params);
357 357
 	}
358 358
 
359 359
 
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
 	 * @param array $query_params see EEM_Base::get_all()
364 364
 	 * @return EE_Datetime_Ticket
365 365
 	 */
366
-	public function datetime_tickets( $query_params = array() ) {
367
-		return $this->get_many_related( 'Datetime_Ticket', $query_params );
366
+	public function datetime_tickets($query_params = array()) {
367
+		return $this->get_many_related('Datetime_Ticket', $query_params);
368 368
 	}
369 369
 
370 370
 
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
 	 * @param boolean $show_deleted
376 376
 	 * @return EE_Datetime[]
377 377
 	 */
378
-	public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) {
379
-		return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted );
378
+	public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) {
379
+		return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted);
380 380
 	}
381 381
 
382 382
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 	 * @return string
387 387
 	 */
388 388
 	function ID() {
389
-		return $this->get( 'TKT_ID' );
389
+		return $this->get('TKT_ID');
390 390
 	}
391 391
 
392 392
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * @return EE_Ticket_Template
411 411
 	 */
412 412
 	public function template() {
413
-		return $this->get_first_related( 'Ticket_Template' );
413
+		return $this->get_first_related('Ticket_Template');
414 414
 	}
415 415
 
416 416
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 	 * @return bool
430 430
 	 */
431 431
 	public function ticket_price() {
432
-		return $this->get( 'TKT_price' );
432
+		return $this->get('TKT_price');
433 433
 	}
434 434
 
435 435
 
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	 * @return mixed
439 439
 	 */
440 440
 	public function pretty_price() {
441
-		return $this->get_pretty( 'TKT_price' );
441
+		return $this->get_pretty('TKT_price');
442 442
 	}
443 443
 
444 444
 
@@ -457,17 +457,17 @@  discard block
 block discarded – undo
457 457
 	 * @param bool $no_cache
458 458
 	 * @return float
459 459
 	 */
460
-	public function get_ticket_total_with_taxes( $no_cache = FALSE ) {
461
-		if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) {
460
+	public function get_ticket_total_with_taxes($no_cache = FALSE) {
461
+		if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) {
462 462
 			$this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin();
463 463
 		}
464
-		return (float)$this->_ticket_total_with_taxes;
464
+		return (float) $this->_ticket_total_with_taxes;
465 465
 	}
466 466
 
467 467
 
468 468
 
469 469
 	public function ensure_TKT_Price_correct() {
470
-		$this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) );
470
+		$this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this));
471 471
 		$this->save();
472 472
 	}
473 473
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @return float
478 478
 	 */
479 479
 	public function get_ticket_subtotal() {
480
-		return EE_Taxes::get_subtotal_for_admin( $this );
480
+		return EE_Taxes::get_subtotal_for_admin($this);
481 481
 	}
482 482
 
483 483
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	 * @return float
488 488
 	 */
489 489
 	public function get_ticket_taxes_total_for_admin() {
490
-		return EE_Taxes::get_total_taxes_for_admin( $this );
490
+		return EE_Taxes::get_total_taxes_for_admin($this);
491 491
 	}
492 492
 
493 493
 
@@ -497,8 +497,8 @@  discard block
 block discarded – undo
497 497
 	 * @param string $name
498 498
 	 * @return boolean
499 499
 	 */
500
-	function set_name( $name ) {
501
-		$this->set( 'TKT_name', $name );
500
+	function set_name($name) {
501
+		$this->set('TKT_name', $name);
502 502
 	}
503 503
 
504 504
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	 * @return string
509 509
 	 */
510 510
 	function description() {
511
-		return $this->get( 'TKT_description' );
511
+		return $this->get('TKT_description');
512 512
 	}
513 513
 
514 514
 
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
 	 * @param string $description
519 519
 	 * @return boolean
520 520
 	 */
521
-	function set_description( $description ) {
522
-		$this->set( 'TKT_description', $description );
521
+	function set_description($description) {
522
+		$this->set('TKT_description', $description);
523 523
 	}
524 524
 
525 525
 
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
 	 * @param string $tm_frmt
531 531
 	 * @return string
532 532
 	 */
533
-	function start_date( $dt_frmt = '', $tm_frmt = '' ) {
534
-		return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt );
533
+	function start_date($dt_frmt = '', $tm_frmt = '') {
534
+		return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt);
535 535
 	}
536 536
 
537 537
 
@@ -541,8 +541,8 @@  discard block
 block discarded – undo
541 541
 	 * @param string $start_date
542 542
 	 * @return void
543 543
 	 */
544
-	function set_start_date( $start_date ) {
545
-		$this->_set_date_time( 'B', $start_date, 'TKT_start_date' );
544
+	function set_start_date($start_date) {
545
+		$this->_set_date_time('B', $start_date, 'TKT_start_date');
546 546
 	}
547 547
 
548 548
 
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 	 * @param string $tm_frmt
554 554
 	 * @return string
555 555
 	 */
556
-	function end_date( $dt_frmt = '', $tm_frmt = '' ) {
557
-		return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt );
556
+	function end_date($dt_frmt = '', $tm_frmt = '') {
557
+		return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt);
558 558
 	}
559 559
 
560 560
 
@@ -564,8 +564,8 @@  discard block
 block discarded – undo
564 564
 	 * @param string $end_date
565 565
 	 * @return void
566 566
 	 */
567
-	function set_end_date( $end_date ) {
568
-		$this->_set_date_time( 'B', $end_date, 'TKT_end_date' );
567
+	function set_end_date($end_date) {
568
+		$this->_set_date_time('B', $end_date, 'TKT_end_date');
569 569
 	}
570 570
 
571 571
 
@@ -577,8 +577,8 @@  discard block
 block discarded – undo
577 577
 	 *
578 578
 	 * @param string $time a string representation of the sell until time (ex 9am or 7:30pm)
579 579
 	 */
580
-	function set_end_time( $time ) {
581
-		$this->_set_time_for( $time, 'TKT_end_date' );
580
+	function set_end_time($time) {
581
+		$this->_set_time_for($time, 'TKT_end_date');
582 582
 	}
583 583
 
584 584
 
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
 	 * @param int $min
589 589
 	 * @return boolean
590 590
 	 */
591
-	function set_min( $min ) {
592
-		$this->set( 'TKT_min', $min );
591
+	function set_min($min) {
592
+		$this->set('TKT_min', $min);
593 593
 	}
594 594
 
595 595
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 	 * @return int
600 600
 	 */
601 601
 	function max() {
602
-		return $this->get( 'TKT_max' );
602
+		return $this->get('TKT_max');
603 603
 	}
604 604
 
605 605
 
@@ -609,8 +609,8 @@  discard block
 block discarded – undo
609 609
 	 * @param int $max
610 610
 	 * @return boolean
611 611
 	 */
612
-	function set_max( $max ) {
613
-		$this->set( 'TKT_max', $max );
612
+	function set_max($max) {
613
+		$this->set('TKT_max', $max);
614 614
 	}
615 615
 
616 616
 
@@ -620,8 +620,8 @@  discard block
 block discarded – undo
620 620
 	 * @param float $price
621 621
 	 * @return boolean
622 622
 	 */
623
-	function set_price( $price ) {
624
-		$this->set( 'TKT_price', $price );
623
+	function set_price($price) {
624
+		$this->set('TKT_price', $price);
625 625
 	}
626 626
 
627 627
 
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	 * @return int
632 632
 	 */
633 633
 	function sold() {
634
-		return $this->get_raw( 'TKT_sold' );
634
+		return $this->get_raw('TKT_sold');
635 635
 	}
636 636
 
637 637
 
@@ -641,10 +641,10 @@  discard block
 block discarded – undo
641 641
 	 * @param int $sold
642 642
 	 * @return boolean
643 643
 	 */
644
-	function set_sold( $sold ) {
644
+	function set_sold($sold) {
645 645
 		// sold can not go below zero
646
-		$sold = max( 0, $sold );
647
-		$this->set( 'TKT_sold', $sold );
646
+		$sold = max(0, $sold);
647
+		$this->set('TKT_sold', $sold);
648 648
 	}
649 649
 
650 650
 
@@ -654,13 +654,13 @@  discard block
 block discarded – undo
654 654
 	 * @param int $qty
655 655
 	 * @return boolean
656 656
 	 */
657
-	function increase_sold( $qty = 1 ) {
657
+	function increase_sold($qty = 1) {
658 658
 		$sold = $this->sold() + $qty;
659 659
 		// remove ticket reservation, but don't adjust datetime reservations,  because that will happen
660 660
 		// via \EE_Datetime::increase_sold() when \EE_Ticket::_increase_sold_for_datetimes() is called
661
-		$this->decrease_reserved( $qty, false );
662
-		$this->_increase_sold_for_datetimes( $qty );
663
-		return $this->set_sold( $sold );
661
+		$this->decrease_reserved($qty, false);
662
+		$this->_increase_sold_for_datetimes($qty);
663
+		return $this->set_sold($sold);
664 664
 	}
665 665
 
666 666
 
@@ -670,12 +670,12 @@  discard block
 block discarded – undo
670 670
 	 * @param int $qty
671 671
 	 * @return boolean
672 672
 	 */
673
-	protected function _increase_sold_for_datetimes( $qty = 1 ) {
673
+	protected function _increase_sold_for_datetimes($qty = 1) {
674 674
 		$datetimes = $this->datetimes();
675
-		if ( is_array( $datetimes ) ) {
676
-			foreach ( $datetimes as $datetime ) {
677
-				if ( $datetime instanceof EE_Datetime ) {
678
-					$datetime->increase_sold( $qty );
675
+		if (is_array($datetimes)) {
676
+			foreach ($datetimes as $datetime) {
677
+				if ($datetime instanceof EE_Datetime) {
678
+					$datetime->increase_sold($qty);
679 679
 					$datetime->save();
680 680
 				}
681 681
 			}
@@ -689,10 +689,10 @@  discard block
 block discarded – undo
689 689
 	 * @param int $qty
690 690
 	 * @return boolean
691 691
 	 */
692
-	function decrease_sold( $qty = 1 ) {
692
+	function decrease_sold($qty = 1) {
693 693
 		$sold = $this->sold() - $qty;
694
-		$this->_decrease_sold_for_datetimes( $qty );
695
-		return $this->set_sold( $sold );
694
+		$this->_decrease_sold_for_datetimes($qty);
695
+		return $this->set_sold($sold);
696 696
 	}
697 697
 
698 698
 
@@ -703,12 +703,12 @@  discard block
 block discarded – undo
703 703
 	* @param int $qty
704 704
 	* @return boolean
705 705
 	*/
706
-	protected function _decrease_sold_for_datetimes( $qty = 1 ) {
706
+	protected function _decrease_sold_for_datetimes($qty = 1) {
707 707
 		$datetimes = $this->datetimes();
708
-		if ( is_array( $datetimes ) ) {
709
-			foreach ( $datetimes as $datetime ) {
710
-				if ( $datetime instanceof EE_Datetime ) {
711
-					$datetime->decrease_sold( $qty );
708
+		if (is_array($datetimes)) {
709
+			foreach ($datetimes as $datetime) {
710
+				if ($datetime instanceof EE_Datetime) {
711
+					$datetime->decrease_sold($qty);
712 712
 					$datetime->save();
713 713
 				}
714 714
 			}
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 	 * @return int
723 723
 	 */
724 724
 	function reserved() {
725
-		return $this->get_raw( 'TKT_reserved' );
725
+		return $this->get_raw('TKT_reserved');
726 726
 	}
727 727
 
728 728
 
@@ -732,10 +732,10 @@  discard block
 block discarded – undo
732 732
 	 * @param int $reserved
733 733
 	 * @return boolean
734 734
 	 */
735
-	function set_reserved( $reserved ) {
735
+	function set_reserved($reserved) {
736 736
 		// reserved can not go below zero
737
-		$reserved = max( 0, intval( $reserved ) );
738
-		$this->set( 'TKT_reserved', $reserved );
737
+		$reserved = max(0, intval($reserved));
738
+		$this->set('TKT_reserved', $reserved);
739 739
 	}
740 740
 
741 741
 
@@ -745,11 +745,11 @@  discard block
 block discarded – undo
745 745
 	 * @param int $qty
746 746
 	 * @return boolean
747 747
 	 */
748
-	function increase_reserved( $qty = 1 ) {
749
-		$qty = absint( $qty );
748
+	function increase_reserved($qty = 1) {
749
+		$qty = absint($qty);
750 750
 		$reserved = $this->reserved() + $qty;
751
-		$this->_increase_reserved_for_datetimes( $qty );
752
-		return $this->set_reserved( $reserved );
751
+		$this->_increase_reserved_for_datetimes($qty);
752
+		return $this->set_reserved($reserved);
753 753
 	}
754 754
 
755 755
 
@@ -760,12 +760,12 @@  discard block
 block discarded – undo
760 760
 	 * @param int $qty
761 761
 	 * @return boolean
762 762
 	 */
763
-	protected function _increase_reserved_for_datetimes( $qty = 1 ) {
763
+	protected function _increase_reserved_for_datetimes($qty = 1) {
764 764
 		$datetimes = $this->datetimes();
765
-		if ( is_array( $datetimes ) ) {
766
-			foreach ( $datetimes as $datetime ) {
767
-				if ( $datetime instanceof EE_Datetime ) {
768
-					$datetime->increase_reserved( $qty );
765
+		if (is_array($datetimes)) {
766
+			foreach ($datetimes as $datetime) {
767
+				if ($datetime instanceof EE_Datetime) {
768
+					$datetime->increase_reserved($qty);
769 769
 					$datetime->save();
770 770
 				}
771 771
 			}
@@ -781,12 +781,12 @@  discard block
 block discarded – undo
781 781
 	 * @param bool $adjust_datetimes
782 782
 	 * @return bool
783 783
 	 */
784
-	function decrease_reserved( $qty = 1, $adjust_datetimes = true ) {
785
-		$reserved = $this->reserved() - absint( $qty );
786
-		if ( $adjust_datetimes ) {
787
-			$this->_decrease_reserved_for_datetimes( $qty );
784
+	function decrease_reserved($qty = 1, $adjust_datetimes = true) {
785
+		$reserved = $this->reserved() - absint($qty);
786
+		if ($adjust_datetimes) {
787
+			$this->_decrease_reserved_for_datetimes($qty);
788 788
 		}
789
-		return $this->set_reserved( $reserved );
789
+		return $this->set_reserved($reserved);
790 790
 	}
791 791
 
792 792
 
@@ -797,12 +797,12 @@  discard block
 block discarded – undo
797 797
 	 * @param int $qty
798 798
 	 * @return boolean
799 799
 	 */
800
-	protected function _decrease_reserved_for_datetimes( $qty = 1 ) {
800
+	protected function _decrease_reserved_for_datetimes($qty = 1) {
801 801
 		$datetimes = $this->datetimes();
802
-		if ( is_array( $datetimes ) ) {
803
-			foreach ( $datetimes as $datetime ) {
804
-				if ( $datetime instanceof EE_Datetime ) {
805
-					$datetime->decrease_reserved( $qty );
802
+		if (is_array($datetimes)) {
803
+			foreach ($datetimes as $datetime) {
804
+				if ($datetime instanceof EE_Datetime) {
805
+					$datetime->decrease_reserved($qty);
806 806
 					$datetime->save();
807 807
 				}
808 808
 			}
@@ -823,14 +823,14 @@  discard block
 block discarded – undo
823 823
 	 *
824 824
 	 * @return int
825 825
 	 */
826
-	function qty( $context = '' ) {
827
-		switch ( $context ) {
826
+	function qty($context = '') {
827
+		switch ($context) {
828 828
 			case 'reg_limit' :
829 829
 				return $this->real_quantity_on_ticket();
830 830
 			case 'saleable' :
831
-				return $this->real_quantity_on_ticket( 'saleable' );
831
+				return $this->real_quantity_on_ticket('saleable');
832 832
 			default:
833
-				return $this->get_raw( 'TKT_qty' );
833
+				return $this->get_raw('TKT_qty');
834 834
 		}
835 835
 	}
836 836
 
@@ -849,15 +849,15 @@  discard block
 block discarded – undo
849 849
 	 *
850 850
 	 * @return int
851 851
 	 */
852
-	function real_quantity_on_ticket( $context = 'reg_limit', $DTT_ID = 0 ) {
853
-		$raw = $this->get_raw( 'TKT_qty' );
852
+	function real_quantity_on_ticket($context = 'reg_limit', $DTT_ID = 0) {
853
+		$raw = $this->get_raw('TKT_qty');
854 854
 		// return immediately if it's zero
855
-		if ( $raw === 0 ) {
855
+		if ($raw === 0) {
856 856
 			return $raw;
857 857
 		}
858 858
 		//echo "\n\n<br />Ticket: " . $this->name() . '<br />';
859 859
 		// ensure qty doesn't exceed raw value for THIS ticket
860
-		$qty = min( EE_INF, $raw );
860
+		$qty = min(EE_INF, $raw);
861 861
 		//echo "\n . qty: " . $qty . '<br />';
862 862
 		// calculate this ticket's total sales and reservations
863 863
 		$sold_and_reserved_for_this_ticket = $this->sold() + $this->reserved();
@@ -866,23 +866,23 @@  discard block
 block discarded – undo
866 866
 		//echo "\n . sold_and_reserved_for_this_ticket: " . $sold_and_reserved_for_this_ticket . '<br />';
867 867
 		// first we need to calculate the maximum number of tickets available for the datetime
868 868
 		// do we want data for one datetime or all of them ?
869
-		$query_params = $DTT_ID ? array( array( 'DTT_ID' => $DTT_ID ) ) : array();
870
-		$datetimes = $this->datetimes( $query_params );
871
-		if ( is_array( $datetimes ) && ! empty( $datetimes ) ) {
872
-			foreach ( $datetimes as $datetime ) {
873
-				if ( $datetime instanceof EE_Datetime ) {
869
+		$query_params = $DTT_ID ? array(array('DTT_ID' => $DTT_ID)) : array();
870
+		$datetimes = $this->datetimes($query_params);
871
+		if (is_array($datetimes) && ! empty($datetimes)) {
872
+			foreach ($datetimes as $datetime) {
873
+				if ($datetime instanceof EE_Datetime) {
874 874
 					$datetime->refresh_from_db();
875 875
 					//echo "\n . . datetime name: " . $datetime->name() . '<br />';
876 876
 					//echo "\n . . datetime ID: " . $datetime->ID() . '<br />';
877 877
 					// initialize with no restrictions for each datetime
878 878
 					// but adjust datetime qty based on datetime reg limit
879
-					$datetime_qty = min( EE_INF, $datetime->reg_limit() );
879
+					$datetime_qty = min(EE_INF, $datetime->reg_limit());
880 880
 					//echo "\n . . . datetime reg_limit: " . $datetime->reg_limit() . '<br />';
881 881
 					//echo "\n . . . datetime_qty: " . $datetime_qty . '<br />';
882 882
 					// if we want the actual saleable amount, then we need to consider OTHER ticket sales
883 883
 					// and reservations for this datetime, that do NOT include sales and reservations
884 884
 					// for this ticket (so we add $this->sold() and $this->reserved() back in)
885
-					if ( $context == 'saleable' ) {
885
+					if ($context == 'saleable') {
886 886
 						$datetime_qty = max(
887 887
 							$datetime_qty - $datetime->sold_and_reserved() + $sold_and_reserved_for_this_ticket,
888 888
 							0
@@ -894,16 +894,16 @@  discard block
 block discarded – undo
894 894
 						$datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0;
895 895
 						//echo "\n . . . datetime_qty: " . $datetime_qty . '<br />';
896 896
 					}
897
-					$qty = min( $datetime_qty, $qty );
897
+					$qty = min($datetime_qty, $qty);
898 898
 					//echo "\n . . qty: " . $qty . '<br />';
899 899
 				}
900 900
 			}
901 901
 		}
902 902
 		// NOW that we know the  maximum number of tickets available for the datetime
903 903
 		// we can finally factor in the details for this specific ticket
904
-		if ( $qty > 0 && $context == 'saleable' ) {
904
+		if ($qty > 0 && $context == 'saleable') {
905 905
 			// and subtract the sales for THIS ticket
906
-			$qty = max( $qty - $sold_and_reserved_for_this_ticket, 0 );
906
+			$qty = max($qty - $sold_and_reserved_for_this_ticket, 0);
907 907
 			//echo "\n . qty: " . $qty . '<br />';
908 908
 		}
909 909
 		//echo "\nFINAL QTY: " . $qty . "<br /><br />";
@@ -919,14 +919,14 @@  discard block
 block discarded – undo
919 919
 	 * @return bool
920 920
 	 * @throws \EE_Error
921 921
 	 */
922
-	function set_qty( $qty ) {
922
+	function set_qty($qty) {
923 923
 		$datetimes = $this->datetimes();
924
-		foreach ( $datetimes as $datetime ) {
925
-			if ( $datetime instanceof EE_Datetime ) {
926
-				$qty = min( $qty, $datetime->reg_limit() );
924
+		foreach ($datetimes as $datetime) {
925
+			if ($datetime instanceof EE_Datetime) {
926
+				$qty = min($qty, $datetime->reg_limit());
927 927
 			}
928 928
 		}
929
-		$this->set( 'TKT_qty', $qty );
929
+		$this->set('TKT_qty', $qty);
930 930
 	}
931 931
 
932 932
 
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 	 * @return int
937 937
 	 */
938 938
 	function uses() {
939
-		return $this->get( 'TKT_uses' );
939
+		return $this->get('TKT_uses');
940 940
 	}
941 941
 
942 942
 
@@ -946,8 +946,8 @@  discard block
 block discarded – undo
946 946
 	 * @param int $uses
947 947
 	 * @return boolean
948 948
 	 */
949
-	function set_uses( $uses ) {
950
-		$this->set( 'TKT_uses', $uses );
949
+	function set_uses($uses) {
950
+		$this->set('TKT_uses', $uses);
951 951
 	}
952 952
 
953 953
 
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 	 * @return boolean
958 958
 	 */
959 959
 	public function required() {
960
-		return $this->get( 'TKT_required' );
960
+		return $this->get('TKT_required');
961 961
 	}
962 962
 
963 963
 
@@ -967,8 +967,8 @@  discard block
 block discarded – undo
967 967
 	 * @param boolean $required
968 968
 	 * @return boolean
969 969
 	 */
970
-	public function set_required( $required ) {
971
-		$this->set( 'TKT_required', $required );
970
+	public function set_required($required) {
971
+		$this->set('TKT_required', $required);
972 972
 	}
973 973
 
974 974
 
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 	 * @return boolean
979 979
 	 */
980 980
 	function taxable() {
981
-		return $this->get( 'TKT_taxable' );
981
+		return $this->get('TKT_taxable');
982 982
 	}
983 983
 
984 984
 
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
 	 * @param boolean $taxable
989 989
 	 * @return boolean
990 990
 	 */
991
-	function set_taxable( $taxable ) {
992
-		$this->set( 'TKT_taxable', $taxable );
991
+	function set_taxable($taxable) {
992
+		$this->set('TKT_taxable', $taxable);
993 993
 	}
994 994
 
995 995
 
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
 	 * @return boolean
1000 1000
 	 */
1001 1001
 	function is_default() {
1002
-		return $this->get( 'TKT_is_default' );
1002
+		return $this->get('TKT_is_default');
1003 1003
 	}
1004 1004
 
1005 1005
 
@@ -1009,8 +1009,8 @@  discard block
 block discarded – undo
1009 1009
 	 * @param boolean $is_default
1010 1010
 	 * @return boolean
1011 1011
 	 */
1012
-	function set_is_default( $is_default ) {
1013
-		$this->set( 'TKT_is_default', $is_default );
1012
+	function set_is_default($is_default) {
1013
+		$this->set('TKT_is_default', $is_default);
1014 1014
 	}
1015 1015
 
1016 1016
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 	 * @return int
1021 1021
 	 */
1022 1022
 	function order() {
1023
-		return $this->get( 'TKT_order' );
1023
+		return $this->get('TKT_order');
1024 1024
 	}
1025 1025
 
1026 1026
 
@@ -1030,8 +1030,8 @@  discard block
 block discarded – undo
1030 1030
 	 * @param int $order
1031 1031
 	 * @return boolean
1032 1032
 	 */
1033
-	function set_order( $order ) {
1034
-		$this->set( 'TKT_order', $order );
1033
+	function set_order($order) {
1034
+		$this->set('TKT_order', $order);
1035 1035
 	}
1036 1036
 
1037 1037
 
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 	 * @return int
1042 1042
 	 */
1043 1043
 	function row() {
1044
-		return $this->get( 'TKT_row' );
1044
+		return $this->get('TKT_row');
1045 1045
 	}
1046 1046
 
1047 1047
 
@@ -1051,8 +1051,8 @@  discard block
 block discarded – undo
1051 1051
 	 * @param int $row
1052 1052
 	 * @return boolean
1053 1053
 	 */
1054
-	function set_row( $row ) {
1055
-		$this->set( 'TKT_row', $row );
1054
+	function set_row($row) {
1055
+		$this->set('TKT_row', $row);
1056 1056
 	}
1057 1057
 
1058 1058
 
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
 	 * @return boolean
1063 1063
 	 */
1064 1064
 	function deleted() {
1065
-		return $this->get( 'TKT_deleted' );
1065
+		return $this->get('TKT_deleted');
1066 1066
 	}
1067 1067
 
1068 1068
 
@@ -1072,8 +1072,8 @@  discard block
 block discarded – undo
1072 1072
 	 * @param boolean $deleted
1073 1073
 	 * @return boolean
1074 1074
 	 */
1075
-	function set_deleted( $deleted ) {
1076
-		$this->set( 'TKT_deleted', $deleted );
1075
+	function set_deleted($deleted) {
1076
+		$this->set('TKT_deleted', $deleted);
1077 1077
 	}
1078 1078
 
1079 1079
 
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
 	 * @return int
1084 1084
 	 */
1085 1085
 	function parent_ID() {
1086
-		return $this->get( 'TKT_parent' );
1086
+		return $this->get('TKT_parent');
1087 1087
 	}
1088 1088
 
1089 1089
 
@@ -1093,8 +1093,8 @@  discard block
 block discarded – undo
1093 1093
 	 * @param int $parent
1094 1094
 	 * @return boolean
1095 1095
 	 */
1096
-	function set_parent_ID( $parent ) {
1097
-		$this->set( 'TKT_parent', $parent );
1096
+	function set_parent_ID($parent) {
1097
+		$this->set('TKT_parent', $parent);
1098 1098
 	}
1099 1099
 
1100 1100
 
@@ -1105,10 +1105,10 @@  discard block
 block discarded – undo
1105 1105
 	 */
1106 1106
 	function name_and_info() {
1107 1107
 		$times = array();
1108
-		foreach ( $this->datetimes() as $datetime ) {
1108
+		foreach ($this->datetimes() as $datetime) {
1109 1109
 			$times[] = $datetime->start_date_and_time();
1110 1110
 		}
1111
-		return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->price();
1111
+		return $this->name()." @ ".implode(", ", $times)." for ".$this->price();
1112 1112
 	}
1113 1113
 
1114 1114
 
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
 	 * @return string
1119 1119
 	 */
1120 1120
 	function name() {
1121
-		return $this->get( 'TKT_name' );
1121
+		return $this->get('TKT_name');
1122 1122
 	}
1123 1123
 
1124 1124
 
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 	 * @return float
1129 1129
 	 */
1130 1130
 	function price() {
1131
-		return $this->get( 'TKT_price' );
1131
+		return $this->get('TKT_price');
1132 1132
 	}
1133 1133
 
1134 1134
 
@@ -1138,8 +1138,8 @@  discard block
 block discarded – undo
1138 1138
 	 * @param array $query_params like EEM_Base::get_all's
1139 1139
 	 * @return EE_Registration[]
1140 1140
 	 */
1141
-	public function registrations( $query_params = array() ) {
1142
-		return $this->get_many_related( 'Registration', $query_params );
1141
+	public function registrations($query_params = array()) {
1142
+		return $this->get_many_related('Registration', $query_params);
1143 1143
 	}
1144 1144
 
1145 1145
 
@@ -1150,8 +1150,8 @@  discard block
 block discarded – undo
1150 1150
 	 * @return int
1151 1151
 	 */
1152 1152
 	public function update_tickets_sold() {
1153
-		$count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) );
1154
-		$this->set_sold( $count_regs_for_this_ticket );
1153
+		$count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0)));
1154
+		$this->set_sold($count_regs_for_this_ticket);
1155 1155
 		$this->save();
1156 1156
 		return $count_regs_for_this_ticket;
1157 1157
 	}
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
 	 * @param array $query_params like EEM_Base::get_all's
1164 1164
 	 * @return int
1165 1165
 	 */
1166
-	public function count_registrations( $query_params = array() ) {
1166
+	public function count_registrations($query_params = array()) {
1167 1167
 		return $this->count_related('Registration', $query_params);
1168 1168
 	}
1169 1169
 
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 	public function get_related_event() {
1189 1189
 		//get one datetime to use for getting the event
1190 1190
 		$datetime = $this->first_datetime();
1191
-		if ( $datetime instanceof EE_Datetime ) {
1191
+		if ($datetime instanceof EE_Datetime) {
1192 1192
 			return $datetime->event();
1193 1193
 		}
1194 1194
 		return null;
Please login to merge, or discard this patch.
core/db_classes/EE_Datetime.class.php 1 patch
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 *                             		    date_format and the second value is the time format
75 75
 	 * @return EE_Datetime
76 76
 	 */
77
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
78
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
79
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
77
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
78
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
79
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
80 80
 	}
81 81
 
82 82
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *                          		the website will be used.
88 88
 	 * @return EE_Datetime
89 89
 	 */
90
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
91
-		return new self( $props_n_values, TRUE, $timezone );
90
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
91
+		return new self($props_n_values, TRUE, $timezone);
92 92
 	}
93 93
 
94 94
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	/**
97 97
 	 * @param $name
98 98
 	 */
99
-	public function set_name( $name ) {
100
-		$this->set( 'DTT_name', $name );
99
+	public function set_name($name) {
100
+		$this->set('DTT_name', $name);
101 101
 	}
102 102
 
103 103
 
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 * @param $description
107 107
 	 */
108
-	public function set_description( $description ) {
109
-		$this->set( 'DTT_description', $description );
108
+	public function set_description($description) {
109
+		$this->set('DTT_description', $description);
110 110
 	}
111 111
 
112 112
 
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 * @access        public
120 120
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
121 121
 	 */
122
-	public function set_start_date( $date ) {
123
-		$this->_set_date_for( $date, 'DTT_EVT_start' );
122
+	public function set_start_date($date) {
123
+		$this->_set_date_for($date, 'DTT_EVT_start');
124 124
 	}
125 125
 
126 126
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @access        public
134 134
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
135 135
 	 */
136
-	public function set_start_time( $time ) {
137
-		$this->_set_time_for( $time, 'DTT_EVT_start' );
136
+	public function set_start_time($time) {
137
+		$this->_set_time_for($time, 'DTT_EVT_start');
138 138
 	}
139 139
 
140 140
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @access        public
148 148
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
149 149
 	 */
150
-	public function set_end_date( $date ) {
151
-		$this->_set_date_for( $date, 'DTT_EVT_end' );
150
+	public function set_end_date($date) {
151
+		$this->_set_date_for($date, 'DTT_EVT_end');
152 152
 	}
153 153
 
154 154
 
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 	 * @access        public
162 162
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
163 163
 	 */
164
-	public function set_end_time( $time ) {
165
-		$this->_set_time_for( $time, 'DTT_EVT_end' );
164
+	public function set_end_time($time) {
165
+		$this->_set_time_for($time, 'DTT_EVT_end');
166 166
 	}
167 167
 
168 168
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @access        public
176 176
 	 * @param        int $reg_limit
177 177
 	 */
178
-	public function set_reg_limit( $reg_limit ) {
179
-		$this->set( 'DTT_reg_limit', $reg_limit );
178
+	public function set_reg_limit($reg_limit) {
179
+		$this->set('DTT_reg_limit', $reg_limit);
180 180
 	}
181 181
 
182 182
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 * @return        mixed        int on success, FALSE on fail
189 189
 	 */
190 190
 	public function sold() {
191
-		return $this->get_raw( 'DTT_sold' );
191
+		return $this->get_raw('DTT_sold');
192 192
 	}
193 193
 
194 194
 
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 	 * @access        public
200 200
 	 * @param        int $sold
201 201
 	 */
202
-	public function set_sold( $sold ) {
202
+	public function set_sold($sold) {
203 203
 		// sold can not go below zero
204
-		$sold = max( 0, $sold );
205
-		$this->set( 'DTT_sold', $sold );
204
+		$sold = max(0, $sold);
205
+		$this->set('DTT_sold', $sold);
206 206
 	}
207 207
 
208 208
 
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 	 * increments sold by amount passed by $qty
212 212
 	 * @param int $qty
213 213
 	 */
214
-	function increase_sold( $qty = 1 ) {
214
+	function increase_sold($qty = 1) {
215 215
 		$sold = $this->sold() + $qty;
216 216
 		// remove ticket reservation
217
-		$this->decrease_reserved( $qty );
218
-		$this->set_sold( $sold );
217
+		$this->decrease_reserved($qty);
218
+		$this->set_sold($sold);
219 219
 	}
220 220
 
221 221
 
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 	 * decrements (subtracts) sold amount passed by $qty
225 225
 	 * @param int $qty
226 226
 	 */
227
-	function decrease_sold( $qty = 1 ) {
227
+	function decrease_sold($qty = 1) {
228 228
 		$sold = $this->sold() - $qty;
229
-		$this->set_sold( $sold );
229
+		$this->set_sold($sold);
230 230
 	}
231 231
 
232 232
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 * @return int
238 238
 	 */
239 239
 	function reserved() {
240
-		return $this->get_raw( 'DTT_reserved' );
240
+		return $this->get_raw('DTT_reserved');
241 241
 	}
242 242
 
243 243
 
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 	 * @param int $reserved
249 249
 	 * @return boolean
250 250
 	 */
251
-	function set_reserved( $reserved ) {
251
+	function set_reserved($reserved) {
252 252
 		// reserved can not go below zero
253
-		$reserved = max( 0, intval( $reserved ) );
254
-		$this->set( 'DTT_reserved', $reserved );
253
+		$reserved = max(0, intval($reserved));
254
+		$this->set('DTT_reserved', $reserved);
255 255
 	}
256 256
 
257 257
 
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	 * @param int $qty
263 263
 	 * @return boolean
264 264
 	 */
265
-	function increase_reserved( $qty = 1 ) {
266
-		$reserved = $this->reserved() + absint( $qty );
267
-		return $this->set_reserved( $reserved );
265
+	function increase_reserved($qty = 1) {
266
+		$reserved = $this->reserved() + absint($qty);
267
+		return $this->set_reserved($reserved);
268 268
 	}
269 269
 
270 270
 
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 	 * @param int $qty
276 276
 	 * @return boolean
277 277
 	 */
278
-	function decrease_reserved( $qty = 1 ) {
279
-		$reserved = $this->reserved() - absint( $qty );
280
-		return $this->set_reserved( $reserved );
278
+	function decrease_reserved($qty = 1) {
279
+		$reserved = $this->reserved() - absint($qty);
280
+		return $this->set_reserved($reserved);
281 281
 	}
282 282
 
283 283
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	 * @return string
299 299
 	 */
300 300
 	public function name() {
301
-		return $this->get( 'DTT_name' );
301
+		return $this->get('DTT_name');
302 302
 	}
303 303
 
304 304
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 * @return string
309 309
 	 */
310 310
 	public function description() {
311
-		return $this->get( 'DTT_description' );
311
+		return $this->get('DTT_description');
312 312
 	}
313 313
 
314 314
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * @return boolean          TRUE if is primary, FALSE if not.
319 319
 	 */
320 320
 	public function is_primary() {
321
-		return $this->get( 'DTT_is_primary' );
321
+		return $this->get('DTT_is_primary');
322 322
 	}
323 323
 
324 324
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 * @return int         The order of the datetime for this event.
329 329
 	 */
330 330
 	public function order() {
331
-		return $this->get( 'DTT_order' );
331
+		return $this->get('DTT_order');
332 332
 	}
333 333
 
334 334
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 	 * @return int
339 339
 	 */
340 340
 	public function parent() {
341
-		return $this->get( 'DTT_parent' );
341
+		return $this->get('DTT_parent');
342 342
 	}
343 343
 
344 344
 
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
 	 * @param    bool   $echo         - whether we echo or return (note echoing uses "pretty" formats, otherwise we use the standard formats)
355 355
 	 * @return    string|bool|void  string on success, FALSE on fail
356 356
 	 */
357
-	private function _show_datetime( $date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE ) {
357
+	private function _show_datetime($date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE) {
358 358
 		$field_name = "DTT_EVT_{$start_or_end}";
359
-		$dtt = $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo );
360
-		if ( ! $echo ) {
359
+		$dtt = $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo);
360
+		if ( ! $echo) {
361 361
 			return $dtt;
362 362
 		}
363 363
 		return '';
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
374 374
 	 * @return        mixed        string on success, FALSE on fail
375 375
 	 */
376
-	public function start_date( $dt_frmt = NULL ) {
377
-		return $this->_show_datetime( 'D', 'start', $dt_frmt );
376
+	public function start_date($dt_frmt = NULL) {
377
+		return $this->_show_datetime('D', 'start', $dt_frmt);
378 378
 	}
379 379
 
380 380
 
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
 	 * Echoes start_date()
384 384
 	 * @param string $dt_frmt
385 385
 	 */
386
-	public function e_start_date( $dt_frmt = NULL ) {
387
-		$this->_show_datetime( 'D', 'start', $dt_frmt, NULL, TRUE );
386
+	public function e_start_date($dt_frmt = NULL) {
387
+		$this->_show_datetime('D', 'start', $dt_frmt, NULL, TRUE);
388 388
 	}
389 389
 
390 390
 
@@ -397,8 +397,8 @@  discard block
 block discarded – undo
397 397
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
398 398
 	 * @return        mixed        string on success, FALSE on fail
399 399
 	 */
400
-	public function end_date( $dt_frmt = NULL ) {
401
-		return $this->_show_datetime( 'D', 'end', $dt_frmt );
400
+	public function end_date($dt_frmt = NULL) {
401
+		return $this->_show_datetime('D', 'end', $dt_frmt);
402 402
 	}
403 403
 
404 404
 
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 	 * Echoes the end date. See end_date()
408 408
 	 * @param string $dt_frmt
409 409
 	 */
410
-	public function e_end_date( $dt_frmt = NULL ) {
411
-		$this->_show_datetime( 'D', 'end', $dt_frmt, NULL, TRUE );
410
+	public function e_end_date($dt_frmt = NULL) {
411
+		$this->_show_datetime('D', 'end', $dt_frmt, NULL, TRUE);
412 412
 	}
413 413
 
414 414
 
@@ -421,11 +421,11 @@  discard block
 block discarded – undo
421 421
 	 * @param        string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
422 422
 	 * @return        mixed        string on success, FALSE on fail
423 423
 	 */
424
-	public function date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
425
-		$dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : $this->_dt_frmt;
426
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $dt_frmt ) );
427
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end', $dt_frmt ) );
428
-		return $start != $end ? $start . $conjunction . $end : $start;
424
+	public function date_range($dt_frmt = NULL, $conjunction = ' - ') {
425
+		$dt_frmt = ! empty($dt_frmt) ? $dt_frmt : $this->_dt_frmt;
426
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $dt_frmt));
427
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $dt_frmt));
428
+		return $start != $end ? $start.$conjunction.$end : $start;
429 429
 	}
430 430
 
431 431
 
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	 * @param null   $dt_frmt
435 435
 	 * @param string $conjunction
436 436
 	 */
437
-	public function e_date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
438
-		echo $this->date_range( $dt_frmt, $conjunction );
437
+	public function e_date_range($dt_frmt = NULL, $conjunction = ' - ') {
438
+		echo $this->date_range($dt_frmt, $conjunction);
439 439
 	}
440 440
 
441 441
 
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
448 448
 	 * @return        mixed        string on success, FALSE on fail
449 449
 	 */
450
-	public function start_time( $tm_format = NULL ) {
451
-		return $this->_show_datetime( 'T', 'start', NULL, $tm_format );
450
+	public function start_time($tm_format = NULL) {
451
+		return $this->_show_datetime('T', 'start', NULL, $tm_format);
452 452
 	}
453 453
 
454 454
 
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
 	/**
457 457
 	 * @param null $tm_format
458 458
 	 */
459
-	public function e_start_time( $tm_format = NULL ) {
460
-		$this->_show_datetime( 'T', 'start', NULL, $tm_format, TRUE );
459
+	public function e_start_time($tm_format = NULL) {
460
+		$this->_show_datetime('T', 'start', NULL, $tm_format, TRUE);
461 461
 	}
462 462
 
463 463
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
470 470
 	 * @return        mixed        string on success, FALSE on fail
471 471
 	 */
472
-	public function end_time( $tm_format = NULL ) {
473
-		return $this->_show_datetime( 'T', 'end', NULL, $tm_format );
472
+	public function end_time($tm_format = NULL) {
473
+		return $this->_show_datetime('T', 'end', NULL, $tm_format);
474 474
 	}
475 475
 
476 476
 
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 	/**
479 479
 	 * @param null $tm_format
480 480
 	 */
481
-	public function e_end_time( $tm_format = NULL ) {
482
-		$this->_show_datetime( 'T', 'end', NULL, $tm_format, TRUE );
481
+	public function e_end_time($tm_format = NULL) {
482
+		$this->_show_datetime('T', 'end', NULL, $tm_format, TRUE);
483 483
 	}
484 484
 
485 485
 
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 	 * @param        string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
493 493
 	 * @return        mixed        string on success, FALSE on fail
494 494
 	 */
495
-	public function time_range( $tm_format = NULL, $conjunction = ' - ' ) {
496
-		$tm_format = !empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
495
+	public function time_range($tm_format = NULL, $conjunction = ' - ') {
496
+		$tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt;
497 497
 
498
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $tm_format ) );
499
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end',  $tm_format ) );
500
-		return $start != $end ? $start . $conjunction . $end : $start;
498
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $tm_format));
499
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $tm_format));
500
+		return $start != $end ? $start.$conjunction.$end : $start;
501 501
 	}
502 502
 
503 503
 
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 	 * @param null   $tm_format
507 507
 	 * @param string $conjunction
508 508
 	 */
509
-	public function e_time_range( $tm_format = NULL, $conjunction = ' - ' ) {
510
-		echo $this->time_range( $tm_format, $conjunction );
509
+	public function e_time_range($tm_format = NULL, $conjunction = ' - ') {
510
+		echo $this->time_range($tm_format, $conjunction);
511 511
 	}
512 512
 
513 513
 
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
 	 * @param 	string 	$tm_format - string representation of time format defaults to 'g:i a'
521 521
 	 * @return 	mixed 	string on success, FALSE on fail
522 522
 	 */
523
-	public function start_date_and_time( $dt_format = NULL, $tm_format = NULL ) {
524
-		return $this->_show_datetime( '', 'start', $dt_format, $tm_format );
523
+	public function start_date_and_time($dt_format = NULL, $tm_format = NULL) {
524
+		return $this->_show_datetime('', 'start', $dt_format, $tm_format);
525 525
 	}
526 526
 
527 527
 
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
 	 * @param null $dt_frmt
531 531
 	 * @param null $tm_format
532 532
 	 */
533
-	public function e_start_date_and_time( $dt_frmt = NULL, $tm_format = NULL ) {
534
-		$this->_show_datetime( '', 'start', $dt_frmt, $tm_format, TRUE );
533
+	public function e_start_date_and_time($dt_frmt = NULL, $tm_format = NULL) {
534
+		$this->_show_datetime('', 'start', $dt_frmt, $tm_format, TRUE);
535 535
 	}
536 536
 
537 537
 
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
 	 * @param bool   $round_up
546 546
 	 * @return float|int|mixed
547 547
 	 */
548
-	public function length( $units = 'seconds', $round_up = FALSE ) {
549
-		$start = $this->get_raw( 'DTT_EVT_start' );
550
-		$end = $this->get_raw( 'DTT_EVT_end' );
548
+	public function length($units = 'seconds', $round_up = FALSE) {
549
+		$start = $this->get_raw('DTT_EVT_start');
550
+		$end = $this->get_raw('DTT_EVT_end');
551 551
 		$length_in_units = $end - $start;
552
-		switch ( $units ) {
552
+		switch ($units) {
553 553
 			//NOTE: We purposefully don't use "break;" in order to chain the divisions
554 554
 			/** @noinspection PhpMissingBreakStatementInspection */
555 555
 			case 'days':
@@ -562,10 +562,10 @@  discard block
 block discarded – undo
562 562
 				$length_in_units /= 60;
563 563
 			case 'seconds':
564 564
 			default:
565
-				$length_in_units = ceil( $length_in_units );
565
+				$length_in_units = ceil($length_in_units);
566 566
 		}
567
-		if ( $round_up ) {
568
-			$length_in_units = max( $length_in_units, 1 );
567
+		if ($round_up) {
568
+			$length_in_units = max($length_in_units, 1);
569 569
 		}
570 570
 		return $length_in_units;
571 571
 	}
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
 	 * @param bool | string 	$tm_format - string representation of time format defaults to 'g:i a'
581 581
 	 * @return 	mixed        		string on success, FALSE on fail
582 582
 	 */
583
-	public function end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
584
-		return $this->_show_datetime( '', 'end', $dt_frmt, $tm_format );
583
+	public function end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
584
+		return $this->_show_datetime('', 'end', $dt_frmt, $tm_format);
585 585
 	}
586 586
 
587 587
 
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
 	 * @param bool $dt_frmt
591 591
 	 * @param bool $tm_format
592 592
 	 */
593
-	public function e_end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
594
-		$this->_show_datetime( '', 'end', $dt_frmt, $tm_format, TRUE );
593
+	public function e_end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
594
+		$this->_show_datetime('', 'end', $dt_frmt, $tm_format, TRUE);
595 595
 	}
596 596
 
597 597
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 	 * @return        int
604 604
 	 */
605 605
 	public function start() {
606
-		return $this->get_raw( 'DTT_EVT_start' );
606
+		return $this->get_raw('DTT_EVT_start');
607 607
 	}
608 608
 
609 609
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @return        int
616 616
 	 */
617 617
 	public function end() {
618
-		return $this->get_raw( 'DTT_EVT_end' );
618
+		return $this->get_raw('DTT_EVT_end');
619 619
 	}
620 620
 
621 621
 
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 	 * @return        mixed        int on success, FALSE on fail
628 628
 	 */
629 629
 	public function reg_limit() {
630
-		return $this->get_raw( 'DTT_reg_limit' );
630
+		return $this->get_raw('DTT_reg_limit');
631 631
 	}
632 632
 
633 633
 
@@ -656,15 +656,15 @@  discard block
 block discarded – undo
656 656
 	 * 																	the spaces remaining for this particular datetime, hence the flag.
657 657
 	 * @return 	int
658 658
 	 */
659
-	public function spaces_remaining( $consider_tickets = FALSE ) {
659
+	public function spaces_remaining($consider_tickets = FALSE) {
660 660
 		// tickets remaining available for purchase
661 661
 		//no need for special checks for infinite, because if DTT_reg_limit == EE_INF, then EE_INF - x = EE_INF
662 662
 		$dtt_remaining = $this->reg_limit() - $this->sold();
663
-		if ( ! $consider_tickets ) {
663
+		if ( ! $consider_tickets) {
664 664
 			return $dtt_remaining;
665 665
 		}
666 666
 		$tickets_remaining = $this->tickets_remaining();
667
-		return min( $dtt_remaining, $tickets_remaining );
667
+		return min($dtt_remaining, $tickets_remaining);
668 668
 	}
669 669
 
670 670
 
@@ -675,19 +675,19 @@  discard block
 block discarded – undo
675 675
 	 * @param array $query_params like EEM_Base::get_all's
676 676
 	 * @return int
677 677
 	 */
678
-	public function tickets_remaining( $query_params = array() ) {
678
+	public function tickets_remaining($query_params = array()) {
679 679
 		$sum = 0;
680
-		$tickets = $this->tickets( $query_params );
681
-		if ( ! empty( $tickets ) ) {
682
-			foreach ( $tickets as $ticket ) {
683
-				if ( $ticket instanceof EE_Ticket ) {
680
+		$tickets = $this->tickets($query_params);
681
+		if ( ! empty($tickets)) {
682
+			foreach ($tickets as $ticket) {
683
+				if ($ticket instanceof EE_Ticket) {
684 684
 					// get the actual amount of tickets that can be sold
685
-					$qty = $ticket->qty( 'saleable' );
686
-					if ( $qty === EE_INF ) {
685
+					$qty = $ticket->qty('saleable');
686
+					if ($qty === EE_INF) {
687 687
 						return EE_INF;
688 688
 					}
689 689
 					// no negative ticket quantities plz
690
-					if ( $qty > 0 ) {
690
+					if ($qty > 0) {
691 691
 						$sum += $qty;
692 692
 					}
693 693
 				}
@@ -704,8 +704,8 @@  discard block
 block discarded – undo
704 704
 	 * @param array $query_params like EEM_Base::get_all's
705 705
 	 * @return int
706 706
 	 */
707
-	public function sum_tickets_initially_available( $query_params = array() ) {
708
-		return $this->sum_related( 'Ticket', $query_params, 'TKT_qty' );
707
+	public function sum_tickets_initially_available($query_params = array()) {
708
+		return $this->sum_related('Ticket', $query_params, 'TKT_qty');
709 709
 	}
710 710
 
711 711
 
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 	 * @return int
718 718
 	 */
719 719
 	public function total_tickets_available_at_this_datetime() {
720
-		return $this->spaces_remaining( true );
720
+		return $this->spaces_remaining(true);
721 721
 	}
722 722
 
723 723
 
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 	 * @return boolean
729 729
 	 */
730 730
 	public function is_upcoming() {
731
-		return ( $this->get_raw( 'DTT_EVT_start' ) > time() );
731
+		return ($this->get_raw('DTT_EVT_start') > time());
732 732
 	}
733 733
 
734 734
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 	 * @return boolean
739 739
 	 */
740 740
 	public function is_active() {
741
-		return ( $this->get_raw( 'DTT_EVT_start' ) < time() && $this->get_raw( 'DTT_EVT_end' ) > time() );
741
+		return ($this->get_raw('DTT_EVT_start') < time() && $this->get_raw('DTT_EVT_end') > time());
742 742
 	}
743 743
 
744 744
 
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 	 * @return boolean
749 749
 	 */
750 750
 	public function is_expired() {
751
-		return ( $this->get_raw( 'DTT_EVT_end' ) < time() );
751
+		return ($this->get_raw('DTT_EVT_end') < time());
752 752
 	}
753 753
 
754 754
 
@@ -759,16 +759,16 @@  discard block
 block discarded – undo
759 759
 	 */
760 760
 	public function get_active_status() {
761 761
 		$total_tickets_for_this_dtt = $this->total_tickets_available_at_this_datetime();
762
-		if ( $total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1 ) {
762
+		if ($total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1) {
763 763
 			return EE_Datetime::sold_out;
764 764
 		}
765
-		if ( $this->is_expired() ) {
765
+		if ($this->is_expired()) {
766 766
 			return EE_Datetime::expired;
767 767
 		}
768
-		if ( $this->is_upcoming() ) {
768
+		if ($this->is_upcoming()) {
769 769
 			return EE_Datetime::upcoming;
770 770
 		}
771
-		if ( $this->is_active() ) {
771
+		if ($this->is_active()) {
772 772
 			return EE_Datetime::active;
773 773
 		}
774 774
 		return NULL;
@@ -782,24 +782,24 @@  discard block
 block discarded – undo
782 782
 	 * @param  boolean $use_dtt_name if TRUE then we'll use DTT->name() if its not empty.
783 783
 	 * @return string
784 784
 	 */
785
-	public function get_dtt_display_name( $use_dtt_name = FALSE ) {
786
-		if ( $use_dtt_name ) {
785
+	public function get_dtt_display_name($use_dtt_name = FALSE) {
786
+		if ($use_dtt_name) {
787 787
 			$dtt_name = $this->name();
788
-			if ( !empty( $dtt_name ) ) {
788
+			if ( ! empty($dtt_name)) {
789 789
 				return $dtt_name;
790 790
 			}
791 791
 		}
792 792
 		//first condition is to see if the months are different
793
-		if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) ) {
794
-			$display_date = $this->start_date( 'M j\, Y g:i a' ) . ' - ' . $this->end_date( 'M j\, Y g:i a' );
793
+		if (date('m', $this->get_raw('DTT_EVT_start')) != date('m', $this->get_raw('DTT_EVT_end'))) {
794
+			$display_date = $this->start_date('M j\, Y g:i a').' - '.$this->end_date('M j\, Y g:i a');
795 795
 			//next condition is if its the same month but different day
796 796
 		}
797 797
 		else {
798
-			if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) == date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) && date( 'd', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'd', $this->get_raw( 'DTT_EVT_end' ) ) ) {
799
-				$display_date = $this->start_date( 'M j\, g:i a' ) . ' - ' . $this->end_date( 'M j\, g:i a Y' );
798
+			if (date('m', $this->get_raw('DTT_EVT_start')) == date('m', $this->get_raw('DTT_EVT_end')) && date('d', $this->get_raw('DTT_EVT_start')) != date('d', $this->get_raw('DTT_EVT_end'))) {
799
+				$display_date = $this->start_date('M j\, g:i a').' - '.$this->end_date('M j\, g:i a Y');
800 800
 			}
801 801
 			else {
802
-				$display_date = $this->start_date( 'F j\, Y' ) . ' @ ' . $this->start_date( 'g:i a' ) . ' - ' . $this->end_date( 'g:i a' );
802
+				$display_date = $this->start_date('F j\, Y').' @ '.$this->start_date('g:i a').' - '.$this->end_date('g:i a');
803 803
 			}
804 804
 		}
805 805
 		return $display_date;
@@ -813,8 +813,8 @@  discard block
 block discarded – undo
813 813
 *@param array $query_params see EEM_Base::get_all()
814 814
 	 * @return EE_Ticket[]
815 815
 	 */
816
-	public function tickets( $query_params = array() ) {
817
-		return $this->get_many_related( 'Ticket', $query_params );
816
+	public function tickets($query_params = array()) {
817
+		return $this->get_many_related('Ticket', $query_params);
818 818
 	}
819 819
 
820 820
 
@@ -824,21 +824,21 @@  discard block
 block discarded – undo
824 824
 	 * @param array $query_params like EEM_Base::get_all's
825 825
 	 * @return EE_Ticket[]
826 826
 	 */
827
-	public function ticket_types_available_for_purchase( $query_params = array() ) {
827
+	public function ticket_types_available_for_purchase($query_params = array()) {
828 828
 		// first check if datetime is valid
829
-		if ( ! ( $this->is_upcoming() || $this->is_active() ) || $this->sold_out() ) {
829
+		if ( ! ($this->is_upcoming() || $this->is_active()) || $this->sold_out()) {
830 830
 			return array();
831 831
 		}
832
-		if ( empty( $query_params ) ) {
832
+		if (empty($query_params)) {
833 833
 			$query_params = array(
834 834
 				array(
835
-					'TKT_start_date' => array( '<=', EEM_Ticket::instance()->current_time_for_query( 'TKT_start_date' ) ),
836
-					'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
835
+					'TKT_start_date' => array('<=', EEM_Ticket::instance()->current_time_for_query('TKT_start_date')),
836
+					'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
837 837
 					'TKT_deleted'    => false
838 838
 				)
839 839
 			);
840 840
 		}
841
-		return $this->tickets( $query_params );
841
+		return $this->tickets($query_params);
842 842
 	}
843 843
 
844 844
 
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 	 * @return EE_Event
849 849
 	 */
850 850
 	public function event() {
851
-		return $this->get_first_related( 'Event' );
851
+		return $this->get_first_related('Event');
852 852
 	}
853 853
 
854 854
 
@@ -860,13 +860,13 @@  discard block
 block discarded – undo
860 860
 	 */
861 861
 	public function update_sold() {
862 862
 		$count_regs_for_this_datetime = EEM_Registration::instance()->count(
863
-			array( array(
863
+			array(array(
864 864
 				'STS_ID' 					=> EEM_Registration::status_id_approved,
865 865
 				'REG_deleted' 				=> 0,
866 866
 				'Ticket.Datetime.DTT_ID' 	=> $this->ID(),
867
-			) )
867
+			))
868 868
 		);
869
-		$this->set( 'DTT_sold', $count_regs_for_this_datetime );
869
+		$this->set('DTT_sold', $count_regs_for_this_datetime);
870 870
 		$this->save();
871 871
 		return $count_regs_for_this_datetime;
872 872
 	}
Please login to merge, or discard this patch.