Completed
Branch ENH-9844-update-decaf-rating-l... (cc0077)
by
unknown
109:12 queued 98:43
created
line_item_display/EE_Admin_Table_Line_Item_Display_Strategy.strategy.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * This is used to output a single
48 48
 	 * @param EE_Line_Item $line_item
49 49
 	 * @param array        $options
50
-	 * @return mixed
50
+	 * @return string
51 51
 	 */
52 52
 	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
53 53
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @param EE_Line_Item $line_item
165 165
 	 * @param array        $options
166
-	 * @return mixed
166
+	 * @return string
167 167
 	 */
168 168
 	protected function _item_row( EE_Line_Item $line_item, $options = array() ) {
169 169
 		$line_item_related_object = $line_item->get_object();
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 *
230 230
 	 * @param EE_Line_Item $line_item
231 231
 	 * @param array        $options
232
-	 * @return mixed
232
+	 * @return string
233 233
 	 */
234 234
 	protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
235 235
 		//for now we're not showing sub-items
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @param EE_Line_Item $line_item
245 245
 	 * @param array        $options
246
-	 * @return mixed
246
+	 * @return string
247 247
 	 */
248 248
 	protected function _tax_row( EE_Line_Item $line_item, $options = array() ) {
249 249
 		// start of row
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 * @param EE_Line_Item $line_item
267 267
 	 * @param string       $text
268 268
 	 * @param array        $options
269
-	 * @return mixed
269
+	 * @return string
270 270
 	 */
271 271
 	protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
272 272
 		//currently not showing subtotal row
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @param EE_Line_Item $line_item
282 282
 	 * @param array        $options
283
-	 * @return mixed
283
+	 * @return string
284 284
 	 */
285 285
 	protected function _total_row( EE_Line_Item $line_item, $options = array() ) {
286 286
 		// start of row
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param array        $options
50 50
 	 * @return mixed
51 51
 	 */
52
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
52
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
53 53
 
54 54
 		$html = '';
55 55
 		// set some default options and merge with incoming
@@ -60,43 +60,43 @@  discard block
 block discarded – undo
60 60
 			'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr',
61 61
 			'total_tr_css_class' => 'admin-primary-mbox-total-tr'
62 62
 		);
63
-		$options = array_merge( $default_options, (array)$options );
63
+		$options = array_merge($default_options, (array) $options);
64 64
 
65
-		switch( $line_item->type() ) {
65
+		switch ($line_item->type()) {
66 66
 
67 67
 			case EEM_Line_Item::type_line_item:
68 68
 				// item row
69
-				$html .= $this->_item_row( $line_item, $options );
69
+				$html .= $this->_item_row($line_item, $options);
70 70
 				break;
71 71
 
72 72
 			case EEM_Line_Item::type_sub_line_item:
73
-				$html .= $this->_sub_item_row( $line_item, $options );
73
+				$html .= $this->_sub_item_row($line_item, $options);
74 74
 				break;
75 75
 
76 76
 			case EEM_Line_Item::type_sub_total:
77
-				if ( $line_item->quantity() === 0 ) {
77
+				if ($line_item->quantity() === 0) {
78 78
 					return $html;
79 79
 				}
80 80
 				//loop through children
81 81
 				$child_line_items = $line_item->children();
82 82
 				//loop through children
83
-				foreach ( $child_line_items as $child_line_item ) {
83
+				foreach ($child_line_items as $child_line_item) {
84 84
 					//recursively feed children back into this method
85
-					$html .= $this->display_line_item( $child_line_item, $options );
85
+					$html .= $this->display_line_item($child_line_item, $options);
86 86
 				}
87
-				$html .= $this->_sub_total_row( $line_item, $options );
87
+				$html .= $this->_sub_total_row($line_item, $options);
88 88
 				break;
89 89
 
90 90
 			case EEM_Line_Item::type_tax:
91
-				if ( $this->_show_taxes ) {
92
-					$this->_taxes_html .= $this->_tax_row( $line_item, $options );
91
+				if ($this->_show_taxes) {
92
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
93 93
 				}
94 94
 				break;
95 95
 
96 96
 			case EEM_Line_Item::type_tax_sub_total:
97
-				foreach( $line_item->children() as $child_line_item ) {
98
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax ) {
99
-						$this->display_line_item( $child_line_item, $options );
97
+				foreach ($line_item->children() as $child_line_item) {
98
+					if ($child_line_item->type() == EEM_Line_Item::type_tax) {
99
+						$this->display_line_item($child_line_item, $options);
100 100
 					}
101 101
 				}
102 102
 				break;
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 				$children = $line_item->children();
109 109
 
110 110
 				// loop thru all non-tax child line items
111
-				foreach( $children as $child_line_item ) {
112
-						$html .= $this->display_line_item( $child_line_item, $options );
111
+				foreach ($children as $child_line_item) {
112
+						$html .= $this->display_line_item($child_line_item, $options);
113 113
 				}
114 114
 
115 115
 				$html .= $this->_taxes_html;
116
-				$html .= $this->_total_row( $line_item, $options );
117
-				if ( $options['use_table_wrapper'] ) {
118
-					$html = $this->_table_header( $options ) . $html . $this->_table_footer( $options );
116
+				$html .= $this->_total_row($line_item, $options);
117
+				if ($options['use_table_wrapper']) {
118
+					$html = $this->_table_header($options).$html.$this->_table_footer($options);
119 119
 				}
120 120
 				break;
121 121
 
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 	 * @param array $options
133 133
 	 * @return string
134 134
 	 */
135
-	protected function _table_header( $options ) {
136
-		$html = EEH_HTML::table( '','', $options['table_css_class'] );
135
+	protected function _table_header($options) {
136
+		$html = EEH_HTML::table('', '', $options['table_css_class']);
137 137
 		$html .= EEH_HTML::thead();
138 138
 		$html .= EEH_HTML::tr();
139
-		$html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' );
140
-		$html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' );
141
-		$html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' );
142
-		$html .= EEH_HTML::th( __( 'Qty', 'event_espresso' ), '', 'jst-cntr' );
143
-		$html .= EEH_HTML::th( __( 'Line Total', 'event_espresso'), '', 'jst-cntr' );
139
+		$html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left');
140
+		$html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left');
141
+		$html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr');
142
+		$html .= EEH_HTML::th(__('Qty', 'event_espresso'), '', 'jst-cntr');
143
+		$html .= EEH_HTML::th(__('Line Total', 'event_espresso'), '', 'jst-cntr');
144 144
 		$html .= EEH_HTML::tbody();
145 145
 		return $html;
146 146
 	}
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @param array $options array of options for the table.
153 153
 	 * @return string
154 154
 	 */
155
-	protected function _table_footer( $options ) {
156
-		return EEH_HTML::tbodyx() .  EEH_HTML::tablex();
155
+	protected function _table_footer($options) {
156
+		return EEH_HTML::tbodyx().EEH_HTML::tablex();
157 157
 	}
158 158
 
159 159
 
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
 	 * @param array        $options
166 166
 	 * @return mixed
167 167
 	 */
168
-	protected function _item_row( EE_Line_Item $line_item, $options = array() ) {
168
+	protected function _item_row(EE_Line_Item $line_item, $options = array()) {
169 169
 		$line_item_related_object = $line_item->get_object();
170 170
 		$parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null;
171 171
 		// start of row
172 172
 		$row_class = $options['odd'] ? 'item odd' : 'item';
173
-		$html = EEH_HTML::tr( '', '', $row_class );
173
+		$html = EEH_HTML::tr('', '', $row_class);
174 174
 
175 175
 
176 176
 		//Name Column
@@ -178,45 +178,45 @@  discard block
 block discarded – undo
178 178
 
179 179
 		//related object scope.
180 180
 		$parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : '';
181
-		$parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
181
+		$parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
182 182
 		$parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : '';
183 183
 
184 184
 
185 185
 		$name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name();
186
-		$name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;
186
+		$name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html;
187 187
 		$name_html .= $line_item->is_taxable() ? ' *' : '';
188 188
 		//maybe preface with icon?
189
-		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html;
190
-		$name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
191
-		$name_html .=  sprintf(
192
-			_x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
189
+		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html;
190
+		$name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>';
191
+		$name_html .= sprintf(
192
+			_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
193 193
 			'<span class="ee-line-item-related-parent-object">',
194
-			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __( 'Item:', 'event_espresso' ),
195
-			$parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name,
194
+			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'),
195
+			$parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name,
196 196
 			'</span>'
197 197
 		);
198
-		$html .= EEH_HTML::td( $name_html, '', 'jst-left' );
198
+		$html .= EEH_HTML::td($name_html, '', 'jst-left');
199 199
 		//Type Column
200 200
 		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : '';
201
-		$type_html .= $this->_get_cancellations( $line_item );
201
+		$type_html .= $this->_get_cancellations($line_item);
202 202
 		$type_html .= $line_item->OBJ_type() ? '<br />' : '';
203 203
 		$code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
204
-		$type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : '';
205
-		$html .= EEH_HTML::td( $type_html, '', 'jst-left' );
204
+		$type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : '';
205
+		$html .= EEH_HTML::td($type_html, '', 'jst-left');
206 206
 
207 207
 
208 208
 		//Amount Column
209
-		if ( $line_item->is_percent() ) {
210
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' );
209
+		if ($line_item->is_percent()) {
210
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght');
211 211
 		} else {
212
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' );
212
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
213 213
 		}
214 214
 
215 215
 		//QTY column
216
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'jst-rght' );
216
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght');
217 217
 
218 218
 		//total column
219
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
219
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
220 220
 
221 221
 		//finish things off and return
222 222
 		$html .= EEH_HTML::trx();
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 	 * @param EE_Line_Item $line_item
232 232
 	 * @return string
233 233
 	 */
234
-	protected function _get_cancellations( EE_Line_Item $line_item ) {
234
+	protected function _get_cancellations(EE_Line_Item $line_item) {
235 235
 		$html = '';
236 236
 		$cancellations = $line_item->get_cancellations();
237
-		$cancellation = reset( $cancellations );
237
+		$cancellation = reset($cancellations);
238 238
 		// \EEH_Debug_Tools::printr( $cancellation, '$cancellation', __FILE__, __LINE__ );
239
-		if ( $cancellation instanceof EE_Line_Item ) {
239
+		if ($cancellation instanceof EE_Line_Item) {
240 240
 			$html .= ' <span class="ee-line-item-id">';
241 241
 			$html .= sprintf(
242 242
 				_n(
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 * @param array        $options
262 262
 	 * @return mixed
263 263
 	 */
264
-	protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
264
+	protected function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
265 265
 		//for now we're not showing sub-items
266 266
 		return '';
267 267
 	}
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
 	 * @param array        $options
276 276
 	 * @return mixed
277 277
 	 */
278
-	protected function _tax_row( EE_Line_Item $line_item, $options = array() ) {
278
+	protected function _tax_row(EE_Line_Item $line_item, $options = array()) {
279 279
 		// start of row
280
-		$html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' );
280
+		$html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
281 281
 		// name th
282
-		$html .= EEH_HTML::th(  $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '',  'jst-rght', '', ' colspan="4"' );
282
+		$html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="4"');
283 283
 		// total th
284
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
284
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
285 285
 		// end of row
286 286
 		$html .= EEH_HTML::trx();
287 287
 		return $html;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	 * @param array        $options
299 299
 	 * @return mixed
300 300
 	 */
301
-	protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
301
+	protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
302 302
 		//currently not showing subtotal row
303 303
 		return '';
304 304
 	}
@@ -312,15 +312,15 @@  discard block
 block discarded – undo
312 312
 	 * @param array        $options
313 313
 	 * @return mixed
314 314
 	 */
315
-	protected function _total_row( EE_Line_Item $line_item, $options = array() ) {
315
+	protected function _total_row(EE_Line_Item $line_item, $options = array()) {
316 316
 		// start of row
317
-		$html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' );
317
+		$html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
318 318
 		// Total th label
319
-		$total_label = sprintf( __( 'Transaction Total %s', 'event_espresso' ),  '(' . EE_Registry::instance()->CFG->currency->code . ')' );
320
-		$html .= EEH_HTML::th( $total_label, '',  'jst-rght',  '',  ' colspan="4"' );
319
+		$total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
320
+		$html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');
321 321
 		// total th
322 322
 
323
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'jst-rght' );
323
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
324 324
 		// end of row
325 325
 		$html .= EEH_HTML::trx();
326 326
 		return $html;
Please login to merge, or discard this patch.
core/db_models/EEM_Attendee.model.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 require_once ( EE_MODELS . 'EEM_Base.model.php' );
3 5
 
4 6
 /**
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
 	*
198 198
 	* 		@access		public
199 199
 	* 		@param		$ATT_ID
200
-	*		@return 		mixed		array on success, FALSE on fail
200
+	*		@return 		EE_Base_Class|null		array on success, FALSE on fail
201 201
 	 * 		@deprecated
202 202
 	*/
203 203
 	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 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
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
2
+require_once (EE_MODELS.'EEM_Base.model.php');
3 3
 
4 4
 /**
5 5
  *
@@ -21,60 +21,60 @@  discard block
 block discarded – undo
21 21
 	 * Please instead use the EEM_Attendee::system_question_* constants
22 22
 	 * @deprecated
23 23
 	 */
24
-	const fname_question_id=1;
24
+	const fname_question_id = 1;
25 25
 
26 26
 	/**
27 27
 	 * @deprecated
28 28
 	 */
29
-	const lname_question_id=2;
29
+	const lname_question_id = 2;
30 30
 
31 31
 
32 32
 	/**
33 33
 	 * @deprecated
34 34
 	 */
35
-	const email_question_id=3;
35
+	const email_question_id = 3;
36 36
 
37 37
 
38 38
 	/**
39 39
 	 * @deprecated
40 40
 	 */
41
-	const address_question_id=4;
41
+	const address_question_id = 4;
42 42
 
43 43
 
44 44
 	/**
45 45
 	 * @deprecated
46 46
 	 */
47
-	const address2_question_id=5;
47
+	const address2_question_id = 5;
48 48
 
49 49
 
50 50
 	/**
51 51
 	 * @deprecated
52 52
 	 */
53
-	const city_question_id=6;
53
+	const city_question_id = 6;
54 54
 
55 55
 
56 56
 	/**
57 57
 	 * @deprecated
58 58
 	 */
59
-	const state_question_id=7;
59
+	const state_question_id = 7;
60 60
 
61 61
 
62 62
 	/**
63 63
 	 * @deprecated
64 64
 	 */
65
-	const country_question_id=8;
65
+	const country_question_id = 8;
66 66
 
67 67
 
68 68
 	/**
69 69
 	 * @deprecated
70 70
 	 */
71
-	const zip_question_id=9;
71
+	const zip_question_id = 9;
72 72
 
73 73
 
74 74
 	/**
75 75
 	 * @deprecated
76 76
 	 */
77
-	const phone_question_id=10;
77
+	const phone_question_id = 10;
78 78
 
79 79
 	/**
80 80
 	 * When looking for questions that correspond to attendee fields,
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 	 * @access protected
120 120
 	 * @param null $timezone
121 121
 	 */
122
-	protected function __construct( $timezone = NULL ) {
123
-		$this->singular_item = __('Attendee','event_espresso');
124
-		$this->plural_item = __('Attendees','event_espresso');
122
+	protected function __construct($timezone = NULL) {
123
+		$this->singular_item = __('Attendee', 'event_espresso');
124
+		$this->plural_item = __('Attendees', 'event_espresso');
125 125
 		$this->_tables = array(
126 126
 			'Attendee_CPT'=> new EE_Primary_Table('posts', 'ID'),
127 127
 			'Attendee_Meta'=>new EE_Secondary_Table('esp_attendee_meta', 'ATTM_ID', 'ATT_ID')
@@ -132,40 +132,40 @@  discard block
 block discarded – undo
132 132
 				'ATT_full_name'=>new EE_Plain_Text_Field('post_title', __("Attendee Full Name", "event_espresso"), false, __("Unknown", "event_espresso")),
133 133
 				'ATT_bio'=>new EE_Post_Content_Field('post_content', __("Attendee Biography", "event_espresso"), false, __("No Biography Provided", "event_espresso")),
134 134
 				'ATT_slug'=>new EE_Slug_Field('post_name', __("Attendee URL Slug", "event_espresso"), false),
135
-				'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, EE_Datetime_Field::now ),
135
+				'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, EE_Datetime_Field::now),
136 136
 				'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")),
137
-				'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, EE_Datetime_Field::now ),
138
-				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ),
137
+				'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, EE_Datetime_Field::now),
138
+				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false),
139 139
 				'ATT_parent'=>new EE_DB_Only_Int_Field('post_parent', __("Parent Attendee (unused)", "event_espresso"), false, 0),
140
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'),// EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'),
140
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'), // EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'),
141 141
 				'status' => new EE_WP_Post_Status_Field('post_status', __('Attendee Status', 'event_espresso'), false, 'publish')
142 142
 			),
143 143
 			'Attendee_Meta'=>array(
144
-				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID','event_espresso'), false),
144
+				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID', 'event_espresso'), false),
145 145
 				'ATT_ID_fk'=>new EE_DB_Only_Int_Field('ATT_ID', __("Foreign Key to Attendee in Post Table", "event_espresso"), false),
146
-				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name','event_espresso'), true, ''),
147
-				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name','event_espresso'), true, ''),
148
-				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1','event_espresso'), true, ''),
149
-				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2','event_espresso'), true, ''),
150
-				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City','event_espresso'), true, ''),
151
-				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State','event_espresso'), true,0,'State'),
152
-				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country','event_espresso'), true,'','Country'),
153
-				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code','event_espresso'), true, ''),
154
-				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address','event_espresso'), true, ''),
155
-				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone','event_espresso'), true, '')
146
+				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name', 'event_espresso'), true, ''),
147
+				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name', 'event_espresso'), true, ''),
148
+				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1', 'event_espresso'), true, ''),
149
+				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2', 'event_espresso'), true, ''),
150
+				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City', 'event_espresso'), true, ''),
151
+				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State', 'event_espresso'), true, 0, 'State'),
152
+				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country', 'event_espresso'), true, '', 'Country'),
153
+				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code', 'event_espresso'), true, ''),
154
+				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address', 'event_espresso'), true, ''),
155
+				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone', 'event_espresso'), true, '')
156 156
 			));
157 157
 		$this->_model_relations = array(
158 158
 			'Registration'=>new EE_Has_Many_Relation(),
159 159
 			'State'=>new EE_Belongs_To_Relation(),
160 160
 			'Country'=>new EE_Belongs_To_Relation(),
161
-			'Event'=>new EE_HABTM_Relation('Registration', FALSE ),
161
+			'Event'=>new EE_HABTM_Relation('Registration', FALSE),
162 162
 			'WP_User' => new EE_Belongs_To_Relation(),
163
-			'Message' => new EE_Has_Many_Any_Relation( false ), //allow deletion of attendees even if they have messages in the queue for them.
163
+			'Message' => new EE_Has_Many_Any_Relation(false), //allow deletion of attendees even if they have messages in the queue for them.
164 164
 			'Term_Relationship' => new EE_Has_Many_Relation(),
165 165
 			'Term_Taxonomy'=>new EE_HABTM_Relation('Term_Relationship'),
166 166
 		);
167 167
 		$this->_caps_slug = 'contacts';
168
-		parent::__construct( $timezone );
168
+		parent::__construct($timezone);
169 169
 
170 170
 	}
171 171
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @param string $system_question_string
176 176
 	 * @return string|null if not found
177 177
 	 */
178
-	public function get_attendee_field_for_system_question( $system_question_string ) {
179
-		return isset( $this->_system_question_to_attendee_field_name[ $system_question_string ] ) ? $this->_system_question_to_attendee_field_name[ $system_question_string ] : null;
178
+	public function get_attendee_field_for_system_question($system_question_string) {
179
+		return isset($this->_system_question_to_attendee_field_name[$system_question_string]) ? $this->_system_question_to_attendee_field_name[$system_question_string] : null;
180 180
 	}
181 181
 
182 182
 
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID
188 188
 	 * @return EE_Attendee[]
189 189
 	 */
190
-	public function get_attendees_for_transaction( $transaction_id_or_obj ){
191
-		return $this->get_all( array( array(
190
+	public function get_attendees_for_transaction($transaction_id_or_obj) {
191
+		return $this->get_all(array(array(
192 192
 			  'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj
193 193
 		  )));
194 194
 	}
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
 	*		@return 		mixed		array on success, FALSE on fail
204 204
 	 * 		@deprecated
205 205
 	*/
206
-	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
206
+	public function get_attendee_by_ID($ATT_ID = FALSE) {
207 207
 		// retrieve a particular EE_Attendee
208
-		return $this->get_one_by_ID( $ATT_ID );
208
+		return $this->get_one_by_ID($ATT_ID);
209 209
 	}
210 210
 
211 211
 
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 	* 		@param		array $where_cols_n_values
219 219
 	*		@return 		mixed		array on success, FALSE on fail
220 220
 	*/
221
-	public function get_attendee( $where_cols_n_values = array() ) {
221
+	public function get_attendee($where_cols_n_values = array()) {
222 222
 
223
-		if ( empty( $where_cols_n_values )) {
223
+		if (empty($where_cols_n_values)) {
224 224
 			return FALSE;
225 225
 		}
226
-		$attendee = $this->get_all( array($where_cols_n_values ));
227
-		if ( ! empty( $attendee )) {
228
-			return array_shift( $attendee );
226
+		$attendee = $this->get_all(array($where_cols_n_values));
227
+		if ( ! empty($attendee)) {
228
+			return array_shift($attendee);
229 229
 		} else {
230 230
 			return FALSE;
231 231
 		}
@@ -241,20 +241,20 @@  discard block
 block discarded – undo
241 241
 	 * @param array $where_cols_n_values
242 242
 	 * @return bool|mixed
243 243
 	 */
244
-	public function find_existing_attendee( $where_cols_n_values = NULL ) {
244
+	public function find_existing_attendee($where_cols_n_values = NULL) {
245 245
 		// search by combo of first and last names plus the email address
246
-		$attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email );
246
+		$attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email);
247 247
 		// no search params means attendee object already exists.
248
-		$where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys;
248
+		$where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys;
249 249
 		$valid_data = TRUE;
250 250
 		// check for required values
251
-		$valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE;
252
-		$valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE;
253
-		$valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE;
251
+		$valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE;
252
+		$valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE;
253
+		$valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE;
254 254
 
255
-		if ( $valid_data ) {
256
-			$attendee = $this->get_attendee( $where_cols_n_values );
257
-			if ( $attendee instanceof EE_Attendee ) {
255
+		if ($valid_data) {
256
+			$attendee = $this->get_attendee($where_cols_n_values);
257
+			if ($attendee instanceof EE_Attendee) {
258 258
 				return $attendee;
259 259
 			}
260 260
 		}
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
              * @param  array $ids array of EE_Registration ids
273 273
              * @return  EE_Attendee[]
274 274
              */
275
-            public function get_array_of_contacts_from_reg_ids( $ids ) {
275
+            public function get_array_of_contacts_from_reg_ids($ids) {
276 276
                 $ids = (array) $ids;
277 277
                 $_where = array(
278
-                    'Registration.REG_ID' => array( 'in', $ids )
278
+                    'Registration.REG_ID' => array('in', $ids)
279 279
                     );
280
-                return $this->get_all( array( $_where ) );
280
+                return $this->get_all(array($_where));
281 281
             }
282 282
 
283 283
 
Please login to merge, or discard this patch.
core/helpers/EEH_Line_Item.helper.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@
 block discarded – undo
280 280
 		$pre_tax_subtotal = self::get_pre_tax_subtotal( $total_line_item );
281 281
 		if ( $pre_tax_subtotal instanceof EE_Line_Item ){
282 282
 			$success = $pre_tax_subtotal->add_child_line_item($item);
283
-		}else{
283
+		} else{
284 284
 			return FALSE;
285 285
 		}
286 286
 		$total_line_item->recalculate_total_including_taxes();
Please login to merge, or discard this patch.
Spacing   +346 added lines, -346 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3 3
  *
4 4
  * EEH_Line_Item
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @return boolean success
46 46
 	 * @throws \EE_Error
47 47
 	 */
48
-	public static function add_unrelated_item( EE_Line_Item $parent_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL  ){
49
-		$items_subtotal = self::get_pre_tax_subtotal( $parent_line_item );
48
+	public static function add_unrelated_item(EE_Line_Item $parent_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL) {
49
+		$items_subtotal = self::get_pre_tax_subtotal($parent_line_item);
50 50
 		$line_item = EE_Line_Item::new_instance(array(
51 51
 			'LIN_name' => $name,
52 52
 			'LIN_desc' => $description,
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			'LIN_quantity' => $quantity,
55 55
 			'LIN_percent' => null,
56 56
 			'LIN_is_taxable' => $taxable,
57
-			'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count( $items_subtotal->children() ) : 0,
57
+			'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count($items_subtotal->children()) : 0,
58 58
 			'LIN_total' => (float) $unit_price * (int) $quantity,
59 59
 			'LIN_type'=>  EEM_Line_Item::type_line_item,
60 60
 			'LIN_code' => $code,
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 			$line_item,
65 65
 			$parent_line_item
66 66
 		);
67
-		return self::add_item( $parent_line_item, $line_item );
67
+		return self::add_item($parent_line_item, $line_item);
68 68
 	}
69 69
 
70 70
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @return boolean success
87 87
 	 * @throws \EE_Error
88 88
 	 */
89
-	public static function add_percentage_based_item( EE_Line_Item $parent_line_item, $name, $percentage_amount, $description = '', $taxable = FALSE ){
89
+	public static function add_percentage_based_item(EE_Line_Item $parent_line_item, $name, $percentage_amount, $description = '', $taxable = FALSE) {
90 90
 		$line_item = EE_Line_Item::new_instance(array(
91 91
 			'LIN_name' => $name,
92 92
 			'LIN_desc' => $description,
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 			'LIN_percent' => $percentage_amount,
95 95
 			'LIN_quantity' => NULL,
96 96
 			'LIN_is_taxable' => $taxable,
97
-			'LIN_total' => (float) ( $percentage_amount * ( $parent_line_item->total() / 100 ) ),
97
+			'LIN_total' => (float) ($percentage_amount * ($parent_line_item->total() / 100)),
98 98
 			'LIN_type'=>  EEM_Line_Item::type_line_item,
99 99
 			'LIN_parent' => $parent_line_item->ID()
100 100
 		));
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 			'FHEE__EEH_Line_Item__add_percentage_based_item__line_item',
103 103
 			$line_item
104 104
 		);
105
-		return self::add_item( $parent_line_item, $line_item );
105
+		return self::add_item($parent_line_item, $line_item);
106 106
 	}
107 107
 
108 108
 
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
 	 * @return \EE_Line_Item
124 124
 	 * @throws \EE_Error
125 125
 	 */
126
-	public static function add_ticket_purchase( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ){
127
-		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total() ) {
128
-			throw new EE_Error( sprintf( __( 'A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso' ), $ticket->ID(), $total_line_item->ID() ) );
126
+	public static function add_ticket_purchase(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
127
+		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total()) {
128
+			throw new EE_Error(sprintf(__('A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso'), $ticket->ID(), $total_line_item->ID()));
129 129
 		}
130 130
 		// either increment the qty for an existing ticket
131
-		$line_item = self::increment_ticket_qty_if_already_in_cart( $total_line_item, $ticket, $qty );
131
+		$line_item = self::increment_ticket_qty_if_already_in_cart($total_line_item, $ticket, $qty);
132 132
 		// or add a new one
133
-		if ( ! $line_item instanceof EE_Line_Item ) {
134
-			$line_item = self::create_ticket_line_item( $total_line_item, $ticket, $qty );
133
+		if ( ! $line_item instanceof EE_Line_Item) {
134
+			$line_item = self::create_ticket_line_item($total_line_item, $ticket, $qty);
135 135
 		}
136 136
 		$total_line_item->recalculate_total_including_taxes();
137 137
 		return $line_item;
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 	 * @return \EE_Line_Item
148 148
 	 * @throws \EE_Error
149 149
 	 */
150
-	public static function increment_ticket_qty_if_already_in_cart( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
150
+	public static function increment_ticket_qty_if_already_in_cart(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
151 151
 		$line_item = null;
152
-		if ( $total_line_item instanceof EE_Line_Item && $total_line_item->is_total() ) {
153
-			$ticket_line_items = EEH_Line_Item::get_ticket_line_items( $total_line_item );
154
-			foreach ( (array)$ticket_line_items as $ticket_line_item ) {
152
+		if ($total_line_item instanceof EE_Line_Item && $total_line_item->is_total()) {
153
+			$ticket_line_items = EEH_Line_Item::get_ticket_line_items($total_line_item);
154
+			foreach ((array) $ticket_line_items as $ticket_line_item) {
155 155
 				if (
156 156
 					$ticket_line_item instanceof EE_Line_Item
157 157
 					&& (int) $ticket_line_item->OBJ_ID() === (int) $ticket->ID()
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 				}
162 162
 			}
163 163
 		}
164
-		if ( $line_item instanceof EE_Line_Item ) {
165
-			EEH_Line_Item::increment_quantity( $line_item, $qty );
164
+		if ($line_item instanceof EE_Line_Item) {
165
+			EEH_Line_Item::increment_quantity($line_item, $qty);
166 166
 			return $line_item;
167 167
 		}
168 168
 		return null;
@@ -179,16 +179,16 @@  discard block
 block discarded – undo
179 179
 	 * @return void
180 180
 	 * @throws \EE_Error
181 181
 	 */
182
-	public static function increment_quantity( EE_Line_Item $line_item, $qty = 1 ) {
183
-		if( ! $line_item->is_percent() ) {
182
+	public static function increment_quantity(EE_Line_Item $line_item, $qty = 1) {
183
+		if ( ! $line_item->is_percent()) {
184 184
 			$qty += $line_item->quantity();
185
-			$line_item->set_quantity( $qty );
186
-			$line_item->set_total( $line_item->unit_price() * $qty );
185
+			$line_item->set_quantity($qty);
186
+			$line_item->set_total($line_item->unit_price() * $qty);
187 187
 			$line_item->save();
188 188
 		}
189
-		foreach( $line_item->children() as $child ) {
190
-			if( $child->is_sub_line_item() ) {
191
-				EEH_Line_Item::update_quantity( $child, $qty );
189
+		foreach ($line_item->children() as $child) {
190
+			if ($child->is_sub_line_item()) {
191
+				EEH_Line_Item::update_quantity($child, $qty);
192 192
 			}
193 193
 		}
194 194
 	}
@@ -204,17 +204,17 @@  discard block
 block discarded – undo
204 204
 	 * @return void
205 205
 	 * @throws \EE_Error
206 206
 	 */
207
-	public static function decrement_quantity( EE_Line_Item $line_item, $qty = 1 ) {
208
-		if( ! $line_item->is_percent() ) {
207
+	public static function decrement_quantity(EE_Line_Item $line_item, $qty = 1) {
208
+		if ( ! $line_item->is_percent()) {
209 209
 			$qty = $line_item->quantity() - $qty;
210
-			$qty = max( $qty, 0 );
211
-			$line_item->set_quantity( $qty );
212
-			$line_item->set_total( $line_item->unit_price() * $qty );
210
+			$qty = max($qty, 0);
211
+			$line_item->set_quantity($qty);
212
+			$line_item->set_total($line_item->unit_price() * $qty);
213 213
 			$line_item->save();
214 214
 		}
215
-		foreach( $line_item->children() as $child ) {
216
-			if( $child->is_sub_line_item() ) {
217
-				EEH_Line_Item::update_quantity( $child, $qty );
215
+		foreach ($line_item->children() as $child) {
216
+			if ($child->is_sub_line_item()) {
217
+				EEH_Line_Item::update_quantity($child, $qty);
218 218
 			}
219 219
 		}
220 220
 	}
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
 	 * @param int          $new_quantity
230 230
 	 * @throws \EE_Error
231 231
 	 */
232
-	public static function update_quantity( EE_Line_Item $line_item, $new_quantity ) {
233
-		if( ! $line_item->is_percent() ) {
234
-			$line_item->set_quantity( $new_quantity );
235
-			$line_item->set_total( $line_item->unit_price() * $new_quantity );
232
+	public static function update_quantity(EE_Line_Item $line_item, $new_quantity) {
233
+		if ( ! $line_item->is_percent()) {
234
+			$line_item->set_quantity($new_quantity);
235
+			$line_item->set_total($line_item->unit_price() * $new_quantity);
236 236
 			$line_item->save();
237 237
 		}
238
-		foreach( $line_item->children() as $child ) {
239
-			if( $child->is_sub_line_item() ) {
240
-				EEH_Line_Item::update_quantity( $child, $new_quantity );
238
+		foreach ($line_item->children() as $child) {
239
+			if ($child->is_sub_line_item()) {
240
+				EEH_Line_Item::update_quantity($child, $new_quantity);
241 241
 			}
242 242
 		}
243 243
 	}
@@ -252,43 +252,43 @@  discard block
 block discarded – undo
252 252
 	 * @return \EE_Line_Item
253 253
 	 * @throws \EE_Error
254 254
 	 */
255
-	public static function create_ticket_line_item( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
255
+	public static function create_ticket_line_item(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
256 256
 		$datetimes = $ticket->datetimes();
257
-		$first_datetime = reset( $datetimes );
258
-		if( $first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event ) {
257
+		$first_datetime = reset($datetimes);
258
+		if ($first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event) {
259 259
 			$first_datetime_name = $first_datetime->event()->name();
260 260
 		} else {
261
-			$first_datetime_name = __( 'Event', 'event_espresso' );
261
+			$first_datetime_name = __('Event', 'event_espresso');
262 262
 		}
263
-		$event = sprintf( _x( '(For %1$s)', '(For Event Name)', 'event_espresso' ), $first_datetime_name );
263
+		$event = sprintf(_x('(For %1$s)', '(For Event Name)', 'event_espresso'), $first_datetime_name);
264 264
 		// get event subtotal line
265
-		$events_sub_total = self::get_event_line_item_for_ticket( $total_line_item, $ticket );
265
+		$events_sub_total = self::get_event_line_item_for_ticket($total_line_item, $ticket);
266 266
 		// add $ticket to cart
267
-		$line_item = EE_Line_Item::new_instance( array(
267
+		$line_item = EE_Line_Item::new_instance(array(
268 268
 			'LIN_name'       	=> $ticket->name(),
269
-			'LIN_desc'       		=> $ticket->description() !== '' ? $ticket->description() . ' ' . $event : $event,
269
+			'LIN_desc'       		=> $ticket->description() !== '' ? $ticket->description().' '.$event : $event,
270 270
 			'LIN_unit_price' 	=> $ticket->price(),
271 271
 			'LIN_quantity'   	=> $qty,
272 272
 			'LIN_is_taxable' 	=> $ticket->taxable(),
273
-			'LIN_order'      	=> count( $events_sub_total->children() ),
273
+			'LIN_order'      	=> count($events_sub_total->children()),
274 274
 			'LIN_total'      		=> $ticket->price() * $qty,
275 275
 			'LIN_type'       		=> EEM_Line_Item::type_line_item,
276 276
 			'OBJ_ID'         		=> $ticket->ID(),
277 277
 			'OBJ_type'       	=> 'Ticket'
278
-		) );
278
+		));
279 279
 		$line_item = apply_filters(
280 280
 			'FHEE__EEH_Line_Item__create_ticket_line_item__line_item',
281 281
 			$line_item
282 282
 		);
283
-		$events_sub_total->add_child_line_item( $line_item );
283
+		$events_sub_total->add_child_line_item($line_item);
284 284
 		//now add the sub-line items
285 285
 		$running_total_for_ticket = 0;
286
-		foreach ( $ticket->prices( array( 'order_by' => array( 'PRC_order' => 'ASC' ) ) ) as $price ) {
286
+		foreach ($ticket->prices(array('order_by' => array('PRC_order' => 'ASC'))) as $price) {
287 287
 			$sign = $price->is_discount() ? -1 : 1;
288 288
 			$price_total = $price->is_percent()
289 289
 				? $running_total_for_ticket * $price->amount() / 100
290 290
 				: $price->amount() * $qty;
291
-			$sub_line_item = EE_Line_Item::new_instance( array(
291
+			$sub_line_item = EE_Line_Item::new_instance(array(
292 292
 				'LIN_name'       	=> $price->name(),
293 293
 				'LIN_desc'       		=> $price->desc(),
294 294
 				'LIN_quantity'   	=> $price->is_percent() ? null : $qty,
@@ -298,18 +298,18 @@  discard block
 block discarded – undo
298 298
 				'LIN_type'       		=> EEM_Line_Item::type_sub_line_item,
299 299
 				'OBJ_ID'         		=> $price->ID(),
300 300
 				'OBJ_type'       	=> 'Price'
301
-			) );
301
+			));
302 302
 			$sub_line_item = apply_filters(
303 303
 				'FHEE__EEH_Line_Item__create_ticket_line_item__sub_line_item',
304 304
 				$sub_line_item
305 305
 			);
306
-			if ( $price->is_percent() ) {
307
-				$sub_line_item->set_percent( $sign * $price->amount() );
306
+			if ($price->is_percent()) {
307
+				$sub_line_item->set_percent($sign * $price->amount());
308 308
 			} else {
309
-				$sub_line_item->set_unit_price( $sign * $price->amount() );
309
+				$sub_line_item->set_unit_price($sign * $price->amount());
310 310
 			}
311 311
 			$running_total_for_ticket += $price_total;
312
-			$line_item->add_child_line_item( $sub_line_item );
312
+			$line_item->add_child_line_item($sub_line_item);
313 313
 		}
314 314
 		return $line_item;
315 315
 	}
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 	 * @return boolean
330 330
 	 * @throws \EE_Error
331 331
 	 */
332
-	public static function add_item( EE_Line_Item $total_line_item, EE_Line_Item $item ){
333
-		$pre_tax_subtotal = self::get_pre_tax_subtotal( $total_line_item );
334
-		if ( $pre_tax_subtotal instanceof EE_Line_Item ){
332
+	public static function add_item(EE_Line_Item $total_line_item, EE_Line_Item $item) {
333
+		$pre_tax_subtotal = self::get_pre_tax_subtotal($total_line_item);
334
+		if ($pre_tax_subtotal instanceof EE_Line_Item) {
335 335
 			$success = $pre_tax_subtotal->add_child_line_item($item);
336
-		}else{
336
+		} else {
337 337
 			return FALSE;
338 338
 		}
339 339
 		$total_line_item->recalculate_total_including_taxes();
@@ -352,34 +352,34 @@  discard block
 block discarded – undo
352 352
 	 * @return bool success
353 353
 	 * @throws \EE_Error
354 354
 	 */
355
-	public static function cancel_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) {
355
+	public static function cancel_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1) {
356 356
 		// validate incoming line_item
357
-		if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) {
357
+		if ($ticket_line_item->OBJ_type() !== 'Ticket') {
358 358
 			throw new EE_Error(
359 359
 				sprintf(
360
-					__( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ),
360
+					__('The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso'),
361 361
 					$ticket_line_item->type()
362 362
 				)
363 363
 			);
364 364
 		}
365
-		if ( $ticket_line_item->quantity() < $qty ) {
365
+		if ($ticket_line_item->quantity() < $qty) {
366 366
 			throw new EE_Error(
367 367
 				sprintf(
368
-					__( 'Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.', 'event_espresso' ),
368
+					__('Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.', 'event_espresso'),
369 369
 					$qty,
370 370
 					$ticket_line_item->quantity()
371 371
 				)
372 372
 			);
373 373
 		}
374 374
 		// decrement ticket quantity; don't rely on auto-fixing when recalculating totals to do this
375
-		$ticket_line_item->set_quantity( $ticket_line_item->quantity() - $qty );
376
-		foreach( $ticket_line_item->children() as $child_line_item ) {
377
-			if(
375
+		$ticket_line_item->set_quantity($ticket_line_item->quantity() - $qty);
376
+		foreach ($ticket_line_item->children() as $child_line_item) {
377
+			if (
378 378
 				$child_line_item->is_sub_line_item()
379 379
 				&& ! $child_line_item->is_percent()
380 380
 				&& ! $child_line_item->is_cancellation()
381 381
 			) {
382
-				$child_line_item->set_quantity( $child_line_item->quantity() - $qty );
382
+				$child_line_item->set_quantity($child_line_item->quantity() - $qty);
383 383
 			}
384 384
 		}
385 385
 		// get cancellation sub line item
@@ -387,37 +387,37 @@  discard block
 block discarded – undo
387 387
 			$ticket_line_item,
388 388
 			EEM_Line_Item::type_cancellation
389 389
 		);
390
-		$cancellation_line_item = reset( $cancellation_line_item );
390
+		$cancellation_line_item = reset($cancellation_line_item);
391 391
 		// verify that this ticket was indeed previously cancelled
392
-		if ( $cancellation_line_item instanceof EE_Line_Item ) {
392
+		if ($cancellation_line_item instanceof EE_Line_Item) {
393 393
 			// increment cancelled quantity
394
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() + $qty );
394
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() + $qty);
395 395
 		} else {
396 396
 			// create cancellation sub line item
397
-			$cancellation_line_item = EE_Line_Item::new_instance( array(
398
-				'LIN_name'       => __( 'Cancellation', 'event_espresso' ),
397
+			$cancellation_line_item = EE_Line_Item::new_instance(array(
398
+				'LIN_name'       => __('Cancellation', 'event_espresso'),
399 399
 				'LIN_desc'       => sprintf(
400
-					_x( 'Cancelled %1$s : %2$s', 'Cancelled Ticket Name : 2015-01-01 11:11', 'event_espresso' ),
400
+					_x('Cancelled %1$s : %2$s', 'Cancelled Ticket Name : 2015-01-01 11:11', 'event_espresso'),
401 401
 					$ticket_line_item->name(),
402
-					current_time( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) )
402
+					current_time(get_option('date_format').' '.get_option('time_format'))
403 403
 				),
404 404
 				'LIN_unit_price' => 0, // $ticket_line_item->unit_price()
405 405
 				'LIN_quantity'   => $qty,
406 406
 				'LIN_is_taxable' => $ticket_line_item->is_taxable(),
407
-				'LIN_order'      => count( $ticket_line_item->children() ),
407
+				'LIN_order'      => count($ticket_line_item->children()),
408 408
 				'LIN_total'      => 0, // $ticket_line_item->unit_price()
409 409
 				'LIN_type'       => EEM_Line_Item::type_cancellation,
410
-			) );
411
-			$ticket_line_item->add_child_line_item( $cancellation_line_item );
410
+			));
411
+			$ticket_line_item->add_child_line_item($cancellation_line_item);
412 412
 		}
413
-		if ( $ticket_line_item->save_this_and_descendants() > 0 ) {
413
+		if ($ticket_line_item->save_this_and_descendants() > 0) {
414 414
 			// decrement parent line item quantity
415 415
 			$event_line_item = $ticket_line_item->parent();
416
-			if ( $event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event' ) {
417
-				$event_line_item->set_quantity( $event_line_item->quantity() - $qty );
416
+			if ($event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event') {
417
+				$event_line_item->set_quantity($event_line_item->quantity() - $qty);
418 418
 				$event_line_item->save();
419 419
 			}
420
-			EEH_Line_Item::get_grand_total_and_recalculate_everything( $ticket_line_item );
420
+			EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
421 421
 			return true;
422 422
 		}
423 423
 		return false;
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
 	 * @return bool success
436 436
 	 * @throws \EE_Error
437 437
 	 */
438
-	public static function reinstate_canceled_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) {
438
+	public static function reinstate_canceled_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1) {
439 439
 		// validate incoming line_item
440
-		if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) {
440
+		if ($ticket_line_item->OBJ_type() !== 'Ticket') {
441 441
 			throw new EE_Error(
442 442
 				sprintf(
443
-					__( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ),
443
+					__('The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso'),
444 444
 					$ticket_line_item->type()
445 445
 				)
446 446
 			);
@@ -450,42 +450,42 @@  discard block
 block discarded – undo
450 450
 			$ticket_line_item,
451 451
 			EEM_Line_Item::type_cancellation
452 452
 		);
453
-		$cancellation_line_item = reset( $cancellation_line_item );
453
+		$cancellation_line_item = reset($cancellation_line_item);
454 454
 		// verify that this ticket was indeed previously cancelled
455
-		if ( ! $cancellation_line_item instanceof EE_Line_Item ) {
455
+		if ( ! $cancellation_line_item instanceof EE_Line_Item) {
456 456
 			return false;
457 457
 		}
458
-		if ( $cancellation_line_item->quantity() > $qty ) {
458
+		if ($cancellation_line_item->quantity() > $qty) {
459 459
 			// decrement cancelled quantity
460
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() - $qty );
461
-		} else if ( $cancellation_line_item->quantity() == $qty ) {
460
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
461
+		} else if ($cancellation_line_item->quantity() == $qty) {
462 462
 			// decrement cancelled quantity in case anyone still has the object kicking around
463
-			$cancellation_line_item->set_quantity( $cancellation_line_item->quantity() - $qty );
463
+			$cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty);
464 464
 			// delete because quantity will end up as 0
465 465
 			$cancellation_line_item->delete();
466 466
 			// and attempt to destroy the object,
467 467
 			// even though PHP won't actually destroy it until it needs the memory
468
-			unset( $cancellation_line_item );
468
+			unset($cancellation_line_item);
469 469
 		} else {
470 470
 			// what ?!?! negative quantity ?!?!
471 471
 			throw new EE_Error(
472 472
 				sprintf(
473
-					__( 'Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.',
474
-						'event_espresso' ),
473
+					__('Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.',
474
+						'event_espresso'),
475 475
 					$qty,
476 476
 					$cancellation_line_item->quantity()
477 477
 				)
478 478
 			);
479 479
 		}
480 480
 		// increment ticket quantity
481
-		$ticket_line_item->set_quantity( $ticket_line_item->quantity() + $qty );
482
-		if ( $ticket_line_item->save_this_and_descendants() > 0 ) {
481
+		$ticket_line_item->set_quantity($ticket_line_item->quantity() + $qty);
482
+		if ($ticket_line_item->save_this_and_descendants() > 0) {
483 483
 			// increment parent line item quantity
484 484
 			$event_line_item = $ticket_line_item->parent();
485
-			if ( $event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event' ) {
486
-				$event_line_item->set_quantity( $event_line_item->quantity() + $qty );
485
+			if ($event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event') {
486
+				$event_line_item->set_quantity($event_line_item->quantity() + $qty);
487 487
 			}
488
-			EEH_Line_Item::get_grand_total_and_recalculate_everything( $ticket_line_item );
488
+			EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item);
489 489
 			return true;
490 490
 		}
491 491
 		return false;
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 	 * @param EE_Line_Item $line_item
501 501
 	 * @return \EE_Line_Item
502 502
 	 */
503
-	public static function get_grand_total_and_recalculate_everything( EE_Line_Item $line_item ){
504
-		$grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item( $line_item );
503
+	public static function get_grand_total_and_recalculate_everything(EE_Line_Item $line_item) {
504
+		$grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item);
505 505
 		return $grand_total_line_item->recalculate_total_including_taxes();
506 506
 	}
507 507
 
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 	 * @return \EE_Line_Item
515 515
 	 * @throws \EE_Error
516 516
 	 */
517
-	public static function get_pre_tax_subtotal( EE_Line_Item $total_line_item ){
518
-		$pre_tax_subtotal = $total_line_item->get_child_line_item( 'pre-tax-subtotal' );
517
+	public static function get_pre_tax_subtotal(EE_Line_Item $total_line_item) {
518
+		$pre_tax_subtotal = $total_line_item->get_child_line_item('pre-tax-subtotal');
519 519
 		return $pre_tax_subtotal instanceof EE_Line_Item
520 520
 			? $pre_tax_subtotal
521
-			: self::create_pre_tax_subtotal( $total_line_item );
521
+			: self::create_pre_tax_subtotal($total_line_item);
522 522
 	}
523 523
 
524 524
 
@@ -530,9 +530,9 @@  discard block
 block discarded – undo
530 530
 	 * @return \EE_Line_Item
531 531
 	 * @throws \EE_Error
532 532
 	 */
533
-	public static function get_taxes_subtotal( EE_Line_Item $total_line_item ){
534
-		$taxes = $total_line_item->get_child_line_item( 'taxes' );
535
-		return $taxes ? $taxes : self::create_taxes_subtotal( $total_line_item );
533
+	public static function get_taxes_subtotal(EE_Line_Item $total_line_item) {
534
+		$taxes = $total_line_item->get_child_line_item('taxes');
535
+		return $taxes ? $taxes : self::create_taxes_subtotal($total_line_item);
536 536
 	}
537 537
 
538 538
 
@@ -545,12 +545,12 @@  discard block
 block discarded – undo
545 545
 	 * @return void
546 546
 	 * @throws \EE_Error
547 547
 	 */
548
-	public static function set_TXN_ID( EE_Line_Item $line_item, $transaction = NULL ){
549
-		if( $transaction ){
548
+	public static function set_TXN_ID(EE_Line_Item $line_item, $transaction = NULL) {
549
+		if ($transaction) {
550 550
 			/** @type EEM_Transaction $EEM_Transaction */
551
-			$EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' );
552
-			$TXN_ID = $EEM_Transaction->ensure_is_ID( $transaction );
553
-			$line_item->set_TXN_ID( $TXN_ID );
551
+			$EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
552
+			$TXN_ID = $EEM_Transaction->ensure_is_ID($transaction);
553
+			$line_item->set_TXN_ID($TXN_ID);
554 554
 		}
555 555
 	}
556 556
 
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 	 * @return \EE_Line_Item of type total
566 566
 	 * @throws \EE_Error
567 567
 	 */
568
-	public static function create_total_line_item( $transaction = NULL ){
569
-		$total_line_item = EE_Line_Item::new_instance( array(
568
+	public static function create_total_line_item($transaction = NULL) {
569
+		$total_line_item = EE_Line_Item::new_instance(array(
570 570
 			'LIN_code'	=> 'total',
571 571
 			'LIN_name'	=> __('Grand Total', 'event_espresso'),
572 572
 			'LIN_type'	=> EEM_Line_Item::type_total,
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 			'FHEE__EEH_Line_Item__create_total_line_item__total_line_item',
577 577
 			$total_line_item
578 578
 		);
579
-		self::set_TXN_ID( $total_line_item, $transaction );
580
-		self::create_pre_tax_subtotal( $total_line_item, $transaction );
581
-		self::create_taxes_subtotal( $total_line_item, $transaction );
579
+		self::set_TXN_ID($total_line_item, $transaction);
580
+		self::create_pre_tax_subtotal($total_line_item, $transaction);
581
+		self::create_taxes_subtotal($total_line_item, $transaction);
582 582
 		return $total_line_item;
583 583
 	}
584 584
 
@@ -592,19 +592,19 @@  discard block
 block discarded – undo
592 592
 	 * @return EE_Line_Item
593 593
 	 * @throws \EE_Error
594 594
 	 */
595
-	protected static function create_pre_tax_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
596
-		$pre_tax_line_item = EE_Line_Item::new_instance( array(
595
+	protected static function create_pre_tax_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
596
+		$pre_tax_line_item = EE_Line_Item::new_instance(array(
597 597
 			'LIN_code' 	=> 'pre-tax-subtotal',
598
-			'LIN_name' 	=> __( 'Pre-Tax Subtotal', 'event_espresso' ),
598
+			'LIN_name' 	=> __('Pre-Tax Subtotal', 'event_espresso'),
599 599
 			'LIN_type' 	=> EEM_Line_Item::type_sub_total
600
-		) );
600
+		));
601 601
 		$pre_tax_line_item = apply_filters(
602 602
 			'FHEE__EEH_Line_Item__create_pre_tax_subtotal__pre_tax_line_item',
603 603
 			$pre_tax_line_item
604 604
 		);
605
-		self::set_TXN_ID( $pre_tax_line_item, $transaction );
606
-		$total_line_item->add_child_line_item( $pre_tax_line_item );
607
-		self::create_event_subtotal( $pre_tax_line_item, $transaction );
605
+		self::set_TXN_ID($pre_tax_line_item, $transaction);
606
+		$total_line_item->add_child_line_item($pre_tax_line_item);
607
+		self::create_event_subtotal($pre_tax_line_item, $transaction);
608 608
 		return $pre_tax_line_item;
609 609
 	}
610 610
 
@@ -619,21 +619,21 @@  discard block
 block discarded – undo
619 619
 	 * @return EE_Line_Item
620 620
 	 * @throws \EE_Error
621 621
 	 */
622
-	protected static function create_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
622
+	protected static function create_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
623 623
 		$tax_line_item = EE_Line_Item::new_instance(array(
624 624
 			'LIN_code'	=> 'taxes',
625 625
 			'LIN_name' 	=> __('Taxes', 'event_espresso'),
626 626
 			'LIN_type'	=> EEM_Line_Item::type_tax_sub_total,
627
-			'LIN_order' => 1000,//this should always come last
627
+			'LIN_order' => 1000, //this should always come last
628 628
 		));
629 629
 		$tax_line_item = apply_filters(
630 630
 			'FHEE__EEH_Line_Item__create_taxes_subtotal__tax_line_item',
631 631
 			$tax_line_item
632 632
 		);
633
-		self::set_TXN_ID( $tax_line_item, $transaction );
634
-		$total_line_item->add_child_line_item( $tax_line_item );
633
+		self::set_TXN_ID($tax_line_item, $transaction);
634
+		$total_line_item->add_child_line_item($tax_line_item);
635 635
 		//and lastly, add the actual taxes
636
-		self::apply_taxes( $total_line_item );
636
+		self::apply_taxes($total_line_item);
637 637
 		return $tax_line_item;
638 638
 	}
639 639
 
@@ -648,11 +648,11 @@  discard block
 block discarded – undo
648 648
 	 * @return EE_Line_Item
649 649
 	 * @throws \EE_Error
650 650
 	 */
651
-	public static function create_event_subtotal( EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL ){
651
+	public static function create_event_subtotal(EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL) {
652 652
 		$event_line_item = EE_Line_Item::new_instance(array(
653
-			'LIN_code'	=> self::get_event_code( $event ),
654
-			'LIN_name' 	=> self::get_event_name( $event ),
655
-			'LIN_desc' 	=> self::get_event_desc( $event ),
653
+			'LIN_code'	=> self::get_event_code($event),
654
+			'LIN_name' 	=> self::get_event_name($event),
655
+			'LIN_desc' 	=> self::get_event_desc($event),
656 656
 			'LIN_type'	=> EEM_Line_Item::type_sub_total,
657 657
 			'OBJ_type' 	=> 'Event',
658 658
 			'OBJ_ID' 		=>  $event instanceof EE_Event ? $event->ID() : 0
@@ -661,8 +661,8 @@  discard block
 block discarded – undo
661 661
 			'FHEE__EEH_Line_Item__create_event_subtotal__event_line_item',
662 662
 			$event_line_item
663 663
 		);
664
-		self::set_TXN_ID( $event_line_item, $transaction );
665
-		$pre_tax_line_item->add_child_line_item( $event_line_item );
664
+		self::set_TXN_ID($event_line_item, $transaction);
665
+		$pre_tax_line_item->add_child_line_item($event_line_item);
666 666
 		return $event_line_item;
667 667
 	}
668 668
 
@@ -675,8 +675,8 @@  discard block
 block discarded – undo
675 675
 	 * @return string
676 676
 	 * @throws \EE_Error
677 677
 	 */
678
-	public static function get_event_code( $event ) {
679
-		return 'event-' . ( $event instanceof EE_Event ? $event->ID() : '0' );
678
+	public static function get_event_code($event) {
679
+		return 'event-'.($event instanceof EE_Event ? $event->ID() : '0');
680 680
 	}
681 681
 
682 682
 	/**
@@ -684,8 +684,8 @@  discard block
 block discarded – undo
684 684
 	 * @param EE_Event $event
685 685
 	 * @return string
686 686
 	 */
687
-	public static function get_event_name( $event ) {
688
-		return $event instanceof EE_Event ? $event->name() : __( 'Event', 'event_espresso' );
687
+	public static function get_event_name($event) {
688
+		return $event instanceof EE_Event ? $event->name() : __('Event', 'event_espresso');
689 689
 	}
690 690
 
691 691
 	/**
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 * @param EE_Event $event
694 694
 	 * @return string
695 695
 	 */
696
-	public static function get_event_desc( $event ) {
696
+	public static function get_event_desc($event) {
697 697
 		return $event instanceof EE_Event ? $event->short_description() : '';
698 698
 	}
699 699
 
@@ -707,27 +707,27 @@  discard block
 block discarded – undo
707 707
 	  * @throws \EE_Error
708 708
 	  * @return EE_Line_Item
709 709
 	  */
710
-	public static function get_event_line_item_for_ticket( EE_Line_Item $grand_total, EE_Ticket $ticket ) {
710
+	public static function get_event_line_item_for_ticket(EE_Line_Item $grand_total, EE_Ticket $ticket) {
711 711
 		$first_datetime = $ticket->first_datetime();
712
-		if ( ! $first_datetime instanceof EE_Datetime ) {
712
+		if ( ! $first_datetime instanceof EE_Datetime) {
713 713
 			throw new EE_Error(
714
-				sprintf( __( 'The supplied ticket (ID %d) has no datetimes', 'event_espresso' ), $ticket->ID() )
714
+				sprintf(__('The supplied ticket (ID %d) has no datetimes', 'event_espresso'), $ticket->ID())
715 715
 			);
716 716
 		}
717 717
 		$event = $first_datetime->event();
718
-		if ( ! $event instanceof EE_Event ) {
718
+		if ( ! $event instanceof EE_Event) {
719 719
 			throw new EE_Error(
720 720
 				sprintf(
721
-					__( 'The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso' ),
721
+					__('The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso'),
722 722
 					$ticket->ID()
723 723
 				)
724 724
 			);
725 725
 		}
726
-		$events_sub_total = EEH_Line_Item::get_event_line_item( $grand_total, $event );
727
-		if ( ! $events_sub_total instanceof EE_Line_Item ) {
726
+		$events_sub_total = EEH_Line_Item::get_event_line_item($grand_total, $event);
727
+		if ( ! $events_sub_total instanceof EE_Line_Item) {
728 728
 			throw new EE_Error(
729 729
 				sprintf(
730
-					__( 'There is no events sub-total for ticket %s on total line item %d', 'event_espresso' ),
730
+					__('There is no events sub-total for ticket %s on total line item %d', 'event_espresso'),
731 731
 					$ticket->ID(),
732 732
 					$grand_total->ID()
733 733
 				)
@@ -746,31 +746,31 @@  discard block
 block discarded – undo
746 746
 	 * @return EE_Line_Item for the event subtotal which is a child of $grand_total
747 747
 	 * @throws \EE_Error
748 748
 	 */
749
-	public static function get_event_line_item( EE_Line_Item $grand_total, $event ) {
749
+	public static function get_event_line_item(EE_Line_Item $grand_total, $event) {
750 750
 		/** @type EE_Event $event */
751
-		$event = EEM_Event::instance()->ensure_is_obj( $event, true );
751
+		$event = EEM_Event::instance()->ensure_is_obj($event, true);
752 752
 		$event_line_item = NULL;
753 753
 		$found = false;
754
-		foreach ( EEH_Line_Item::get_event_subtotals( $grand_total ) as $event_line_item ) {
754
+		foreach (EEH_Line_Item::get_event_subtotals($grand_total) as $event_line_item) {
755 755
 			// default event subtotal, we should only ever find this the first time this method is called
756
-			if ( ! $event_line_item->OBJ_ID() ) {
756
+			if ( ! $event_line_item->OBJ_ID()) {
757 757
 				// let's use this! but first... set the event details
758
-				EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
758
+				EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
759 759
 				$found = true;
760 760
 				break;
761
-			} else if ( $event_line_item->OBJ_ID() === $event->ID() ) {
761
+			} else if ($event_line_item->OBJ_ID() === $event->ID()) {
762 762
 				// found existing line item for this event in the cart, so break out of loop and use this one
763 763
 				$found = true;
764 764
 				break;
765 765
 			}
766 766
 		}
767
-		if ( ! $found ) {
767
+		if ( ! $found) {
768 768
 			//there is no event sub-total yet, so add it
769
-			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal( $grand_total );
769
+			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal($grand_total);
770 770
 			// create a new "event" subtotal below that
771
-			$event_line_item = EEH_Line_Item::create_event_subtotal( $pre_tax_subtotal, null, $event );
771
+			$event_line_item = EEH_Line_Item::create_event_subtotal($pre_tax_subtotal, null, $event);
772 772
 			// and set the event details
773
-			EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
773
+			EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
774 774
 		}
775 775
 		return $event_line_item;
776 776
 	}
@@ -791,13 +791,13 @@  discard block
 block discarded – undo
791 791
 		EE_Event $event,
792 792
 		$transaction = null
793 793
 	) {
794
-		if ( $event instanceof EE_Event ) {
795
-			$event_line_item->set_code( self::get_event_code( $event ) );
796
-			$event_line_item->set_name( self::get_event_name( $event ) );
797
-			$event_line_item->set_desc( self::get_event_desc( $event ) );
798
-			$event_line_item->set_OBJ_ID( $event->ID() );
794
+		if ($event instanceof EE_Event) {
795
+			$event_line_item->set_code(self::get_event_code($event));
796
+			$event_line_item->set_name(self::get_event_name($event));
797
+			$event_line_item->set_desc(self::get_event_desc($event));
798
+			$event_line_item->set_OBJ_ID($event->ID());
799 799
 		}
800
-		self::set_TXN_ID( $event_line_item, $transaction );
800
+		self::set_TXN_ID($event_line_item, $transaction);
801 801
 	}
802 802
 
803 803
 
@@ -810,19 +810,19 @@  discard block
 block discarded – undo
810 810
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
811 811
 	 * @throws \EE_Error
812 812
 	 */
813
-	public static function apply_taxes( EE_Line_Item $total_line_item ){
813
+	public static function apply_taxes(EE_Line_Item $total_line_item) {
814 814
 		/** @type EEM_Price $EEM_Price */
815
-		$EEM_Price = EE_Registry::instance()->load_model( 'Price' );
815
+		$EEM_Price = EE_Registry::instance()->load_model('Price');
816 816
 		// get array of taxes via Price Model
817 817
 		$ordered_taxes = $EEM_Price->get_all_prices_that_are_taxes();
818
-		ksort( $ordered_taxes );
819
-		$taxes_line_item = self::get_taxes_subtotal( $total_line_item );
818
+		ksort($ordered_taxes);
819
+		$taxes_line_item = self::get_taxes_subtotal($total_line_item);
820 820
 		//just to be safe, remove its old tax line items
821 821
 		$taxes_line_item->delete_children_line_items();
822 822
 		//loop thru taxes
823
-		foreach ( $ordered_taxes as $order => $taxes ) {
824
-			foreach ( $taxes as $tax ) {
825
-				if ( $tax instanceof EE_Price ) {
823
+		foreach ($ordered_taxes as $order => $taxes) {
824
+			foreach ($taxes as $tax) {
825
+				if ($tax instanceof EE_Price) {
826 826
 					$tax_line_item = EE_Line_Item::new_instance(
827 827
 						array(
828 828
 							'LIN_name'       => $tax->name(),
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 						'FHEE__EEH_Line_Item__apply_taxes__tax_line_item',
841 841
 						$tax_line_item
842 842
 					);
843
-					$taxes_line_item->add_child_line_item( $tax_line_item );
843
+					$taxes_line_item->add_child_line_item($tax_line_item);
844 844
 				}
845 845
 			}
846 846
 		}
@@ -857,10 +857,10 @@  discard block
 block discarded – undo
857 857
 	 * @return float
858 858
 	 * @throws \EE_Error
859 859
 	 */
860
-	public static function ensure_taxes_applied( $total_line_item ){
861
-		$taxes_subtotal = self::get_taxes_subtotal( $total_line_item );
862
-		if( ! $taxes_subtotal->children()){
863
-			self::apply_taxes( $total_line_item );
860
+	public static function ensure_taxes_applied($total_line_item) {
861
+		$taxes_subtotal = self::get_taxes_subtotal($total_line_item);
862
+		if ( ! $taxes_subtotal->children()) {
863
+			self::apply_taxes($total_line_item);
864 864
 		}
865 865
 		return $taxes_subtotal->total();
866 866
 	}
@@ -874,16 +874,16 @@  discard block
 block discarded – undo
874 874
 	 * @return bool
875 875
 	 * @throws \EE_Error
876 876
 	 */
877
-	public static function delete_all_child_items( EE_Line_Item $parent_line_item ) {
877
+	public static function delete_all_child_items(EE_Line_Item $parent_line_item) {
878 878
 		$deleted = 0;
879
-		foreach ( $parent_line_item->children() as $child_line_item ) {
880
-			if ( $child_line_item instanceof EE_Line_Item ) {
881
-				$deleted += EEH_Line_Item::delete_all_child_items( $child_line_item );
882
-				if ( $child_line_item->ID() ) {
879
+		foreach ($parent_line_item->children() as $child_line_item) {
880
+			if ($child_line_item instanceof EE_Line_Item) {
881
+				$deleted += EEH_Line_Item::delete_all_child_items($child_line_item);
882
+				if ($child_line_item->ID()) {
883 883
 					$child_line_item->delete();
884
-					unset( $child_line_item );
884
+					unset($child_line_item);
885 885
 				} else {
886
-					$parent_line_item->delete_child_line_item( $child_line_item->code() );
886
+					$parent_line_item->delete_child_line_item($child_line_item->code());
887 887
 				}
888 888
 				$deleted++;
889 889
 			}
@@ -905,9 +905,9 @@  discard block
 block discarded – undo
905 905
 	 * @param array|bool|string $line_item_codes
906 906
 	 * @return int number of items successfully removed
907 907
 	 */
908
-	public static function delete_items( EE_Line_Item $total_line_item, $line_item_codes = FALSE ) {
908
+	public static function delete_items(EE_Line_Item $total_line_item, $line_item_codes = FALSE) {
909 909
 
910
-		if( $total_line_item->type() !== EEM_Line_Item::type_total ){
910
+		if ($total_line_item->type() !== EEM_Line_Item::type_total) {
911 911
 			EE_Error::doing_it_wrong(
912 912
 				'EEH_Line_Item::delete_items',
913 913
 				__(
@@ -917,20 +917,20 @@  discard block
 block discarded – undo
917 917
 				'4.6.18'
918 918
 			);
919 919
 		}
920
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
920
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
921 921
 
922 922
 		// check if only a single line_item_id was passed
923
-		if ( ! empty( $line_item_codes ) && ! is_array( $line_item_codes )) {
923
+		if ( ! empty($line_item_codes) && ! is_array($line_item_codes)) {
924 924
 			// place single line_item_id in an array to appear as multiple line_item_ids
925
-			$line_item_codes = array ( $line_item_codes );
925
+			$line_item_codes = array($line_item_codes);
926 926
 		}
927 927
 		$removals = 0;
928 928
 		// cycle thru line_item_ids
929
-		foreach ( $line_item_codes as $line_item_id ) {
929
+		foreach ($line_item_codes as $line_item_id) {
930 930
 			$removals += $total_line_item->delete_child_line_item($line_item_id);
931 931
 		}
932 932
 
933
-		if ( $removals > 0 ) {
933
+		if ($removals > 0) {
934 934
 			$total_line_item->recalculate_taxes_and_tax_total();
935 935
 			return $removals;
936 936
 		} else {
@@ -963,33 +963,33 @@  discard block
 block discarded – undo
963 963
 		$code = null,
964 964
 		$add_to_existing_line_item = false
965 965
 	) {
966
-		$tax_subtotal = self::get_taxes_subtotal( $total_line_item );
966
+		$tax_subtotal = self::get_taxes_subtotal($total_line_item);
967 967
             $taxable_total = $total_line_item->taxable_total();
968 968
 
969
-            if( $add_to_existing_line_item ) {
970
-                $new_tax = $tax_subtotal->get_child_line_item( $code );
969
+            if ($add_to_existing_line_item) {
970
+                $new_tax = $tax_subtotal->get_child_line_item($code);
971 971
 	            EEM_Line_Item::instance()->delete(
972
-		            array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) )
972
+		            array(array('LIN_code' => array('!=', $code), 'LIN_parent' => $tax_subtotal->ID()))
973 973
 	            );
974 974
             } else {
975 975
                 $new_tax = null;
976 976
                 $tax_subtotal->delete_children_line_items();
977 977
             }
978
-            if( $new_tax ) {
979
-                $new_tax->set_total( $new_tax->total() + $amount );
980
-                $new_tax->set_percent( $taxable_total ? $new_tax->total() / $taxable_total * 100 : 0 );
978
+            if ($new_tax) {
979
+                $new_tax->set_total($new_tax->total() + $amount);
980
+                $new_tax->set_percent($taxable_total ? $new_tax->total() / $taxable_total * 100 : 0);
981 981
             } else {
982 982
                 //no existing tax item. Create it
983
-				$new_tax = EE_Line_Item::new_instance( array(
983
+				$new_tax = EE_Line_Item::new_instance(array(
984 984
 					'TXN_ID'      => $total_line_item->TXN_ID(),
985
-					'LIN_name'    => $name ? $name : __( 'Tax', 'event_espresso' ),
985
+					'LIN_name'    => $name ? $name : __('Tax', 'event_espresso'),
986 986
 					'LIN_desc'    => $description ? $description : '',
987
-					'LIN_percent' => $taxable_total ? ( $amount / $taxable_total * 100 ) : 0,
987
+					'LIN_percent' => $taxable_total ? ($amount / $taxable_total * 100) : 0,
988 988
 					'LIN_total'   => $amount,
989 989
 					'LIN_parent'  => $tax_subtotal->ID(),
990 990
 					'LIN_type'    => EEM_Line_Item::type_tax,
991 991
 					'LIN_code'    => $code
992
-				) );
992
+				));
993 993
 			}
994 994
 
995 995
             $new_tax = apply_filters(
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 				$total_line_item
999 999
             );
1000 1000
             $new_tax->save();
1001
-            $tax_subtotal->set_total( $new_tax->total() );
1001
+            $tax_subtotal->set_total($new_tax->total());
1002 1002
             $tax_subtotal->save();
1003 1003
             $total_line_item->recalculate_total_including_taxes();
1004 1004
             return $new_tax;
@@ -1020,14 +1020,14 @@  discard block
 block discarded – undo
1020 1020
 		$code_substring_for_whitelist = null
1021 1021
 	) {
1022 1022
 		$whitelisted = false;
1023
-		if( $code_substring_for_whitelist !== null ) {
1024
-			$whitelisted = strpos( $line_item->code(), $code_substring_for_whitelist ) !== false ? true : false;
1023
+		if ($code_substring_for_whitelist !== null) {
1024
+			$whitelisted = strpos($line_item->code(), $code_substring_for_whitelist) !== false ? true : false;
1025 1025
 		}
1026
-		if( ! $whitelisted && $line_item->is_line_item() ) {
1027
-			$line_item->set_is_taxable( $taxable );
1026
+		if ( ! $whitelisted && $line_item->is_line_item()) {
1027
+			$line_item->set_is_taxable($taxable);
1028 1028
 		}
1029
-		foreach( $line_item->children() as $child_line_item ) {
1030
-			EEH_Line_Item::set_line_items_taxable( $child_line_item, $taxable, $code_substring_for_whitelist );
1029
+		foreach ($line_item->children() as $child_line_item) {
1030
+			EEH_Line_Item::set_line_items_taxable($child_line_item, $taxable, $code_substring_for_whitelist);
1031 1031
 		}
1032 1032
 	}
1033 1033
 
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1041 1041
 	 * @return EE_Line_Item[]
1042 1042
 	 */
1043
-	public static function get_event_subtotals( EE_Line_Item $parent_line_item ) {
1044
-		return self::get_subtotals_of_object_type( $parent_line_item, 'Event' );
1043
+	public static function get_event_subtotals(EE_Line_Item $parent_line_item) {
1044
+		return self::get_subtotals_of_object_type($parent_line_item, 'Event');
1045 1045
 	}
1046 1046
 
1047 1047
 
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 	 * @param string $obj_type
1055 1055
 	 * @return EE_Line_Item[]
1056 1056
 	 */
1057
-	public static function get_subtotals_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
1057
+	public static function get_subtotals_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
1058 1058
 		return self::_get_descendants_by_type_and_object_type(
1059 1059
 			$parent_line_item,
1060 1060
 			EEM_Line_Item::type_sub_total,
@@ -1071,8 +1071,8 @@  discard block
 block discarded – undo
1071 1071
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1072 1072
 	 * @return EE_Line_Item[]
1073 1073
 	 */
1074
-	public static function get_ticket_line_items( EE_Line_Item $parent_line_item ) {
1075
-		return self::get_line_items_of_object_type( $parent_line_item, 'Ticket' );
1074
+	public static function get_ticket_line_items(EE_Line_Item $parent_line_item) {
1075
+		return self::get_line_items_of_object_type($parent_line_item, 'Ticket');
1076 1076
 	}
1077 1077
 
1078 1078
 
@@ -1085,8 +1085,8 @@  discard block
 block discarded – undo
1085 1085
 	 * @param string $obj_type
1086 1086
 	 * @return EE_Line_Item[]
1087 1087
 	 */
1088
-	public static function get_line_items_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
1089
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, EEM_Line_Item::type_line_item, $obj_type );
1088
+	public static function get_line_items_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
1089
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, EEM_Line_Item::type_line_item, $obj_type);
1090 1090
 	}
1091 1091
 
1092 1092
 
@@ -1097,8 +1097,8 @@  discard block
 block discarded – undo
1097 1097
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1098 1098
 	 * @return EE_Line_Item[]
1099 1099
 	 */
1100
-	public static function get_tax_descendants( EE_Line_Item $parent_line_item ) {
1101
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_tax );
1100
+	public static function get_tax_descendants(EE_Line_Item $parent_line_item) {
1101
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_tax);
1102 1102
 	}
1103 1103
 
1104 1104
 
@@ -1109,8 +1109,8 @@  discard block
 block discarded – undo
1109 1109
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1110 1110
 	 * @return EE_Line_Item[]
1111 1111
 	 */
1112
-	public static function get_line_item_descendants( EE_Line_Item $parent_line_item ) {
1113
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_line_item );
1112
+	public static function get_line_item_descendants(EE_Line_Item $parent_line_item) {
1113
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_line_item);
1114 1114
 	}
1115 1115
 
1116 1116
 
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
 	 * @param string $line_item_type one of the EEM_Line_Item constants
1124 1124
 	 * @return EE_Line_Item[]
1125 1125
 	 */
1126
-	public static function get_descendants_of_type( EE_Line_Item $parent_line_item, $line_item_type ) {
1127
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, $line_item_type, NULL );
1126
+	public static function get_descendants_of_type(EE_Line_Item $parent_line_item, $line_item_type) {
1127
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, $line_item_type, NULL);
1128 1128
 	}
1129 1129
 
1130 1130
 
@@ -1143,8 +1143,8 @@  discard block
 block discarded – undo
1143 1143
 		$obj_type = null
1144 1144
 	) {
1145 1145
 		$objects = array();
1146
-		foreach ( $parent_line_item->children() as $child_line_item ) {
1147
-			if ( $child_line_item instanceof EE_Line_Item ) {
1146
+		foreach ($parent_line_item->children() as $child_line_item) {
1147
+			if ($child_line_item instanceof EE_Line_Item) {
1148 1148
 				if (
1149 1149
 					$child_line_item->type() === $line_item_type
1150 1150
 				    && (
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 		$OBJ_type = '',
1185 1185
 		$OBJ_IDs = array()
1186 1186
 	) {
1187
-		return self::_get_descendants_by_object_type_and_object_ID( $parent_line_item, $OBJ_type, $OBJ_IDs );
1187
+		return self::_get_descendants_by_object_type_and_object_ID($parent_line_item, $OBJ_type, $OBJ_IDs);
1188 1188
 	}
1189 1189
 
1190 1190
 
@@ -1203,12 +1203,12 @@  discard block
 block discarded – undo
1203 1203
 		$OBJ_IDs
1204 1204
 	) {
1205 1205
 		$objects = array();
1206
-		foreach ( $parent_line_item->children() as $child_line_item ) {
1207
-			if ( $child_line_item instanceof EE_Line_Item ) {
1206
+		foreach ($parent_line_item->children() as $child_line_item) {
1207
+			if ($child_line_item instanceof EE_Line_Item) {
1208 1208
 				if (
1209
-					is_array( $OBJ_IDs )
1209
+					is_array($OBJ_IDs)
1210 1210
 					&& $child_line_item->OBJ_type() === $OBJ_type
1211
-					&& in_array( $child_line_item->OBJ_ID(), $OBJ_IDs )
1211
+					&& in_array($child_line_item->OBJ_ID(), $OBJ_IDs)
1212 1212
 				) {
1213 1213
 					$objects[] = $child_line_item;
1214 1214
 				} else {
@@ -1238,8 +1238,8 @@  discard block
 block discarded – undo
1238 1238
 	 * @param string $type like one of the EEM_Line_Item::type_*
1239 1239
 	 * @return EE_Line_Item
1240 1240
 	 */
1241
-	public static function get_nearest_descendant_of_type( EE_Line_Item $parent_line_item, $type ) {
1242
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_type' , $type );
1241
+	public static function get_nearest_descendant_of_type(EE_Line_Item $parent_line_item, $type) {
1242
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_type', $type);
1243 1243
 	}
1244 1244
 
1245 1245
 
@@ -1253,8 +1253,8 @@  discard block
 block discarded – undo
1253 1253
 	 * @param string $code any value used for LIN_code
1254 1254
 	 * @return EE_Line_Item
1255 1255
 	 */
1256
-	public static function get_nearest_descendant_having_code( EE_Line_Item $parent_line_item, $code ) {
1257
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_code' , $code );
1256
+	public static function get_nearest_descendant_having_code(EE_Line_Item $parent_line_item, $code) {
1257
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_code', $code);
1258 1258
 	}
1259 1259
 
1260 1260
 
@@ -1268,15 +1268,15 @@  discard block
 block discarded – undo
1268 1268
 	 * @param string $value any value stored in $search_field
1269 1269
 	 * @return EE_Line_Item
1270 1270
 	 */
1271
-	protected static function _get_nearest_descendant( EE_Line_Item $parent_line_item, $search_field, $value ) {
1272
-		foreach( $parent_line_item->children() as $child ){
1273
-			if ( $child->get( $search_field ) == $value ){
1271
+	protected static function _get_nearest_descendant(EE_Line_Item $parent_line_item, $search_field, $value) {
1272
+		foreach ($parent_line_item->children() as $child) {
1273
+			if ($child->get($search_field) == $value) {
1274 1274
 				return $child;
1275 1275
 			}
1276 1276
 		}
1277
-		foreach( $parent_line_item->children() as $child ){
1278
-			$descendant_found = self::_get_nearest_descendant( $child, $search_field, $value );
1279
-			if ( $descendant_found ){
1277
+		foreach ($parent_line_item->children() as $child) {
1278
+			$descendant_found = self::_get_nearest_descendant($child, $search_field, $value);
1279
+			if ($descendant_found) {
1280 1280
 				return $descendant_found;
1281 1281
 			}
1282 1282
 		}
@@ -1293,24 +1293,24 @@  discard block
 block discarded – undo
1293 1293
 	 * @return \EE_Line_Item
1294 1294
 	 * @throws \EE_Error
1295 1295
 	 */
1296
-	public static function find_transaction_grand_total_for_line_item( EE_Line_Item $line_item ){
1297
-		if ( $line_item->TXN_ID() ) {
1298
-			$total_line_item = $line_item->transaction()->total_line_item( false );
1299
-			if ( $total_line_item instanceof EE_Line_Item ) {
1296
+	public static function find_transaction_grand_total_for_line_item(EE_Line_Item $line_item) {
1297
+		if ($line_item->TXN_ID()) {
1298
+			$total_line_item = $line_item->transaction()->total_line_item(false);
1299
+			if ($total_line_item instanceof EE_Line_Item) {
1300 1300
 				return $total_line_item;
1301 1301
 			}
1302 1302
 		} else {
1303 1303
 			$line_item_parent = $line_item->parent();
1304
-			if ( $line_item_parent instanceof EE_Line_Item ) {
1305
-				if ( $line_item_parent->is_total() ) {
1304
+			if ($line_item_parent instanceof EE_Line_Item) {
1305
+				if ($line_item_parent->is_total()) {
1306 1306
 					return $line_item_parent;
1307 1307
 				}
1308
-				return EEH_Line_Item::find_transaction_grand_total_for_line_item( $line_item_parent );
1308
+				return EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item_parent);
1309 1309
 			}
1310 1310
 		}
1311 1311
 		throw new EE_Error(
1312 1312
 			sprintf(
1313
-				__( 'A valid grand total for line item %1$d was not found.', 'event_espresso' ),
1313
+				__('A valid grand total for line item %1$d was not found.', 'event_espresso'),
1314 1314
 				$line_item->ID()
1315 1315
 			)
1316 1316
 		);
@@ -1327,31 +1327,31 @@  discard block
 block discarded – undo
1327 1327
 	 * @return void
1328 1328
 	 * @throws \EE_Error
1329 1329
 	 */
1330
-	public static function visualize( EE_Line_Item $line_item, $indentation = 0 ){
1330
+	public static function visualize(EE_Line_Item $line_item, $indentation = 0) {
1331 1331
 		echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1332
-		if ( ! $indentation ) {
1333
-			echo defined( 'EE_TESTS_DIR' ) ? "\n" : '<br />';
1332
+		if ( ! $indentation) {
1333
+			echo defined('EE_TESTS_DIR') ? "\n" : '<br />';
1334 1334
 		}
1335
-		for( $i = 0; $i < $indentation; $i++ ){
1335
+		for ($i = 0; $i < $indentation; $i++) {
1336 1336
 			echo ". ";
1337 1337
 		}
1338 1338
 		$breakdown = '';
1339
-		if ( $line_item->is_line_item()){
1340
-			if ( $line_item->is_percent() ) {
1339
+		if ($line_item->is_line_item()) {
1340
+			if ($line_item->is_percent()) {
1341 1341
 				$breakdown = "{$line_item->percent()}%";
1342 1342
 			} else {
1343
-				$breakdown = '$' . "{$line_item->unit_price()} x {$line_item->quantity()}";
1343
+				$breakdown = '$'."{$line_item->unit_price()} x {$line_item->quantity()}";
1344 1344
 			}
1345 1345
 		}
1346
-		echo $line_item->name() . " [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : " . '$' . "{$line_item->total()}";
1347
-		if ( $breakdown ) {
1346
+		echo $line_item->name()." [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : ".'$'."{$line_item->total()}";
1347
+		if ($breakdown) {
1348 1348
 			echo " ( {$breakdown} )";
1349 1349
 		}
1350
-		if( $line_item->is_taxable() ){
1350
+		if ($line_item->is_taxable()) {
1351 1351
 			echo "  * taxable";
1352 1352
 		}
1353
-		if( $line_item->children() ){
1354
-			foreach($line_item->children() as $child){
1353
+		if ($line_item->children()) {
1354
+			foreach ($line_item->children() as $child) {
1355 1355
 				self::visualize($child, $indentation + 1);
1356 1356
 			}
1357 1357
 		}
@@ -1392,97 +1392,97 @@  discard block
 block discarded – undo
1392 1392
 	 *                                          is theirs, which can be done with
1393 1393
 	 *                                          `EEM_Line_Item::instance()->get_line_item_for_registration( $registration );`
1394 1394
 	 */
1395
-	public static function calculate_reg_final_prices_per_line_item( EE_Line_Item $line_item, $billable_ticket_quantities = array() ) {
1395
+	public static function calculate_reg_final_prices_per_line_item(EE_Line_Item $line_item, $billable_ticket_quantities = array()) {
1396 1396
 		//init running grand total if not already
1397
-		if ( ! isset( $running_totals[ 'total' ] ) ) {
1398
-			$running_totals[ 'total' ] = 0;
1397
+		if ( ! isset($running_totals['total'])) {
1398
+			$running_totals['total'] = 0;
1399 1399
 		}
1400
-		if( ! isset( $running_totals[ 'taxable' ] ) ) {
1401
-			$running_totals[ 'taxable' ] = array( 'total' => 0 );
1400
+		if ( ! isset($running_totals['taxable'])) {
1401
+			$running_totals['taxable'] = array('total' => 0);
1402 1402
 		}
1403
-		foreach ( $line_item->children() as $child_line_item ) {
1404
-			switch ( $child_line_item->type() ) {
1403
+		foreach ($line_item->children() as $child_line_item) {
1404
+			switch ($child_line_item->type()) {
1405 1405
 
1406 1406
 				case EEM_Line_Item::type_sub_total :
1407
-					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $child_line_item, $billable_ticket_quantities );
1407
+					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item($child_line_item, $billable_ticket_quantities);
1408 1408
 					//combine arrays but preserve numeric keys
1409
-					$running_totals = array_replace_recursive( $running_totals_from_subtotal, $running_totals );
1410
-					$running_totals[ 'total' ] += $running_totals_from_subtotal[ 'total' ];
1411
-					$running_totals[ 'taxable'][ 'total' ] += $running_totals_from_subtotal[ 'taxable' ][ 'total' ];
1409
+					$running_totals = array_replace_recursive($running_totals_from_subtotal, $running_totals);
1410
+					$running_totals['total'] += $running_totals_from_subtotal['total'];
1411
+					$running_totals['taxable']['total'] += $running_totals_from_subtotal['taxable']['total'];
1412 1412
 					break;
1413 1413
 
1414 1414
 				case EEM_Line_Item::type_tax_sub_total :
1415 1415
 
1416 1416
 					//find how much the taxes percentage is
1417
-					if ( $child_line_item->percent() !== 0 ) {
1417
+					if ($child_line_item->percent() !== 0) {
1418 1418
 						$tax_percent_decimal = $child_line_item->percent() / 100;
1419 1419
 					} else {
1420 1420
 						$tax_percent_decimal = EE_Taxes::get_total_taxes_percentage() / 100;
1421 1421
 					}
1422 1422
 					//and apply to all the taxable totals, and add to the pretax totals
1423
-					foreach ( $running_totals as $line_item_id => $this_running_total ) {
1423
+					foreach ($running_totals as $line_item_id => $this_running_total) {
1424 1424
 						//"total" and "taxable" array key is an exception
1425
-						if ( $line_item_id === 'taxable' ) {
1425
+						if ($line_item_id === 'taxable') {
1426 1426
 							continue;
1427 1427
 						}
1428
-						$taxable_total = $running_totals[ 'taxable' ][ $line_item_id ];
1429
-						$running_totals[ $line_item_id ] += ( $taxable_total * $tax_percent_decimal );
1428
+						$taxable_total = $running_totals['taxable'][$line_item_id];
1429
+						$running_totals[$line_item_id] += ($taxable_total * $tax_percent_decimal);
1430 1430
 					}
1431 1431
 					break;
1432 1432
 
1433 1433
 				case EEM_Line_Item::type_line_item :
1434 1434
 
1435 1435
 					// ticket line items or ????
1436
-					if ( $child_line_item->OBJ_type() === 'Ticket' ) {
1436
+					if ($child_line_item->OBJ_type() === 'Ticket') {
1437 1437
 						// kk it's a ticket
1438
-						if ( isset( $running_totals[ $child_line_item->ID() ] ) ) {
1438
+						if (isset($running_totals[$child_line_item->ID()])) {
1439 1439
 							//huh? that shouldn't happen.
1440
-							$running_totals[ 'total' ] += $child_line_item->total();
1440
+							$running_totals['total'] += $child_line_item->total();
1441 1441
 						} else {
1442 1442
 							//its not in our running totals yet. great.
1443
-							if ( $child_line_item->is_taxable() ) {
1443
+							if ($child_line_item->is_taxable()) {
1444 1444
 								$taxable_amount = $child_line_item->unit_price();
1445 1445
 							} else {
1446 1446
 								$taxable_amount = 0;
1447 1447
 							}
1448 1448
 							// are we only calculating totals for some tickets?
1449
-							if ( isset( $billable_ticket_quantities[ $child_line_item->OBJ_ID() ] ) ) {
1450
-								$quantity = $billable_ticket_quantities[ $child_line_item->OBJ_ID() ];
1451
-								$running_totals[ $child_line_item->ID() ] = $quantity
1449
+							if (isset($billable_ticket_quantities[$child_line_item->OBJ_ID()])) {
1450
+								$quantity = $billable_ticket_quantities[$child_line_item->OBJ_ID()];
1451
+								$running_totals[$child_line_item->ID()] = $quantity
1452 1452
 									? $child_line_item->unit_price()
1453 1453
 									: 0;
1454
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $quantity
1454
+								$running_totals['taxable'][$child_line_item->ID()] = $quantity
1455 1455
 									? $taxable_amount
1456 1456
 									: 0;
1457 1457
 							} else {
1458 1458
 								$quantity = $child_line_item->quantity();
1459
-								$running_totals[ $child_line_item->ID() ] = $child_line_item->unit_price();
1460
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $taxable_amount;
1459
+								$running_totals[$child_line_item->ID()] = $child_line_item->unit_price();
1460
+								$running_totals['taxable'][$child_line_item->ID()] = $taxable_amount;
1461 1461
 							}
1462
-							$running_totals[ 'taxable' ][ 'total' ] += $taxable_amount * $quantity;
1463
-							$running_totals[ 'total' ] += $child_line_item->unit_price() * $quantity;
1462
+							$running_totals['taxable']['total'] += $taxable_amount * $quantity;
1463
+							$running_totals['total'] += $child_line_item->unit_price() * $quantity;
1464 1464
 						}
1465 1465
 					} else {
1466 1466
 						// it's some other type of item added to the cart
1467 1467
 						// it should affect the running totals
1468 1468
 						// basically we want to convert it into a PERCENT modifier. Because
1469 1469
 						// more clearly affect all registration's final price equally
1470
-						$line_items_percent_of_running_total = $running_totals[ 'total' ] > 0
1471
-							? ( $child_line_item->total() / $running_totals[ 'total' ] ) + 1
1470
+						$line_items_percent_of_running_total = $running_totals['total'] > 0
1471
+							? ($child_line_item->total() / $running_totals['total']) + 1
1472 1472
 							: 1;
1473
-						foreach ( $running_totals as $line_item_id => $this_running_total ) {
1473
+						foreach ($running_totals as $line_item_id => $this_running_total) {
1474 1474
 							//the "taxable" array key is an exception
1475
-							if ( $line_item_id === 'taxable' ) {
1475
+							if ($line_item_id === 'taxable') {
1476 1476
 								continue;
1477 1477
 							}
1478 1478
 							// update the running totals
1479 1479
 							// yes this actually even works for the running grand total!
1480
-							$running_totals[ $line_item_id ] =
1480
+							$running_totals[$line_item_id] =
1481 1481
 								$line_items_percent_of_running_total * $this_running_total;
1482 1482
 
1483
-							if ( $child_line_item->is_taxable() ) {
1484
-								$running_totals[ 'taxable' ][ $line_item_id ] =
1485
-									$line_items_percent_of_running_total * $running_totals[ 'taxable' ][ $line_item_id ];
1483
+							if ($child_line_item->is_taxable()) {
1484
+								$running_totals['taxable'][$line_item_id] =
1485
+									$line_items_percent_of_running_total * $running_totals['taxable'][$line_item_id];
1486 1486
 							}
1487 1487
 						}
1488 1488
 					}
@@ -1500,16 +1500,16 @@  discard block
 block discarded – undo
1500 1500
 	 * @return float | null
1501 1501
 	 * @throws \OutOfRangeException
1502 1502
 	 */
1503
-	public static function calculate_final_price_for_ticket_line_item( \EE_Line_Item $total_line_item, \EE_Line_Item $ticket_line_item ) {
1503
+	public static function calculate_final_price_for_ticket_line_item(\EE_Line_Item $total_line_item, \EE_Line_Item $ticket_line_item) {
1504 1504
 		static $final_prices_per_ticket_line_item = array();
1505
-		if ( empty( $final_prices_per_ticket_line_item ) ) {
1505
+		if (empty($final_prices_per_ticket_line_item)) {
1506 1506
 			$final_prices_per_ticket_line_item = \EEH_Line_Item::calculate_reg_final_prices_per_line_item(
1507 1507
 				$total_line_item
1508 1508
 			);
1509 1509
 		}
1510 1510
 		//ok now find this new registration's final price
1511
-		if ( isset( $final_prices_per_ticket_line_item[ $ticket_line_item->ID() ] ) ) {
1512
-			return $final_prices_per_ticket_line_item[ $ticket_line_item->ID() ];
1511
+		if (isset($final_prices_per_ticket_line_item[$ticket_line_item->ID()])) {
1512
+			return $final_prices_per_ticket_line_item[$ticket_line_item->ID()];
1513 1513
 		}
1514 1514
 		$message = sprintf(
1515 1515
 			__(
@@ -1518,10 +1518,10 @@  discard block
 block discarded – undo
1518 1518
 			),
1519 1519
 			$ticket_line_item->ID()
1520 1520
 		);
1521
-		if ( WP_DEBUG ) {
1522
-			throw new \OutOfRangeException( $message );
1521
+		if (WP_DEBUG) {
1522
+			throw new \OutOfRangeException($message);
1523 1523
 		} else {
1524
-			EE_Log::instance()->log( __CLASS__, __FUNCTION__, $message );
1524
+			EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message);
1525 1525
 		}
1526 1526
 		return null;
1527 1527
 	}
@@ -1537,15 +1537,15 @@  discard block
 block discarded – undo
1537 1537
 	 * @return \EE_Line_Item
1538 1538
 	 * @throws \EE_Error
1539 1539
 	 */
1540
-	public static function billable_line_item_tree( EE_Line_Item $line_item, $registrations ) {
1541
-		$copy_li = EEH_Line_Item::billable_line_item( $line_item, $registrations );
1542
-		foreach ( $line_item->children() as $child_li ) {
1543
-			$copy_li->add_child_line_item( EEH_Line_Item::billable_line_item_tree( $child_li, $registrations ) );
1540
+	public static function billable_line_item_tree(EE_Line_Item $line_item, $registrations) {
1541
+		$copy_li = EEH_Line_Item::billable_line_item($line_item, $registrations);
1542
+		foreach ($line_item->children() as $child_li) {
1543
+			$copy_li->add_child_line_item(EEH_Line_Item::billable_line_item_tree($child_li, $registrations));
1544 1544
 		}
1545 1545
 		//if this is the grand total line item, make sure the totals all add up
1546 1546
 		//(we could have duplicated this logic AS we copied the line items, but
1547 1547
 		//it seems DRYer this way)
1548
-		if ( $copy_li->type() === EEM_Line_Item::type_total ) {
1548
+		if ($copy_li->type() === EEM_Line_Item::type_total) {
1549 1549
 			$copy_li->recalculate_total_including_taxes();
1550 1550
 		}
1551 1551
 		return $copy_li;
@@ -1562,24 +1562,24 @@  discard block
 block discarded – undo
1562 1562
 	 * @throws \EE_Error
1563 1563
 	 * @param EE_Registration[] $registrations
1564 1564
 	 */
1565
-	public static function billable_line_item( EE_Line_Item $line_item, $registrations ) {
1565
+	public static function billable_line_item(EE_Line_Item $line_item, $registrations) {
1566 1566
 		$new_li_fields = $line_item->model_field_array();
1567
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1567
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1568 1568
 			$line_item->OBJ_type() === 'Ticket'
1569 1569
 		) {
1570 1570
 			$count = 0;
1571
-			foreach ( $registrations as $registration ) {
1572
-				if ( $line_item->OBJ_ID() === $registration->ticket_ID() &&
1573
-					in_array( $registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment() )
1571
+			foreach ($registrations as $registration) {
1572
+				if ($line_item->OBJ_ID() === $registration->ticket_ID() &&
1573
+					in_array($registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment())
1574 1574
 				) {
1575 1575
 					$count++;
1576 1576
 				}
1577 1577
 			}
1578
-			$new_li_fields[ 'LIN_quantity' ] = $count;
1578
+			$new_li_fields['LIN_quantity'] = $count;
1579 1579
 		}
1580 1580
 		//don't set the total. We'll leave that up to the code that calculates it
1581
-		unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ], $new_li_fields[ 'LIN_total' ] );
1582
-		return EE_Line_Item::new_instance( $new_li_fields );
1581
+		unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent'], $new_li_fields['LIN_total']);
1582
+		return EE_Line_Item::new_instance($new_li_fields);
1583 1583
 	}
1584 1584
 
1585 1585
 
@@ -1592,19 +1592,19 @@  discard block
 block discarded – undo
1592 1592
 	 * @return \EE_Line_Item|null
1593 1593
 	 * @throws \EE_Error
1594 1594
 	 */
1595
-	public static function non_empty_line_items( EE_Line_Item $line_item ) {
1596
-		$copied_li = EEH_Line_Item::non_empty_line_item( $line_item );
1597
-		if ( $copied_li === null ) {
1595
+	public static function non_empty_line_items(EE_Line_Item $line_item) {
1596
+		$copied_li = EEH_Line_Item::non_empty_line_item($line_item);
1597
+		if ($copied_li === null) {
1598 1598
 			return null;
1599 1599
 		}
1600 1600
 		//if this is an event subtotal, we want to only include it if it
1601 1601
 		//has a non-zero total and at least one ticket line item child
1602 1602
 		$ticket_children = 0;
1603
-		foreach ( $line_item->children() as $child_li ) {
1604
-			$child_li_copy = EEH_Line_Item::non_empty_line_items( $child_li );
1605
-			if ( $child_li_copy !== null ) {
1606
-				$copied_li->add_child_line_item( $child_li_copy );
1607
-				if ( $child_li_copy->type() === EEM_Line_Item::type_line_item &&
1603
+		foreach ($line_item->children() as $child_li) {
1604
+			$child_li_copy = EEH_Line_Item::non_empty_line_items($child_li);
1605
+			if ($child_li_copy !== null) {
1606
+				$copied_li->add_child_line_item($child_li_copy);
1607
+				if ($child_li_copy->type() === EEM_Line_Item::type_line_item &&
1608 1608
 					$child_li_copy->OBJ_type() === 'Ticket'
1609 1609
 				) {
1610 1610
 					$ticket_children++;
@@ -1634,8 +1634,8 @@  discard block
 block discarded – undo
1634 1634
 	 * @return EE_Line_Item
1635 1635
 	 * @throws \EE_Error
1636 1636
 	 */
1637
-	public static function non_empty_line_item( EE_Line_Item $line_item ) {
1638
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1637
+	public static function non_empty_line_item(EE_Line_Item $line_item) {
1638
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1639 1639
 			$line_item->OBJ_type() === 'Ticket' &&
1640 1640
 			$line_item->quantity() === 0
1641 1641
 		) {
@@ -1643,8 +1643,8 @@  discard block
 block discarded – undo
1643 1643
 		}
1644 1644
 		$new_li_fields = $line_item->model_field_array();
1645 1645
 		//don't set the total. We'll leave that up to the code that calculates it
1646
-		unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ] );
1647
-		return EE_Line_Item::new_instance( $new_li_fields );
1646
+		unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent']);
1647
+		return EE_Line_Item::new_instance($new_li_fields);
1648 1648
 	}
1649 1649
 
1650 1650
 
@@ -1656,9 +1656,9 @@  discard block
 block discarded – undo
1656 1656
 	 * @return \EE_Line_Item
1657 1657
 	 * @throws \EE_Error
1658 1658
 	 */
1659
-	public static function get_items_subtotal( EE_Line_Item $total_line_item ){
1660
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0' );
1661
-		return self::get_pre_tax_subtotal( $total_line_item );
1659
+	public static function get_items_subtotal(EE_Line_Item $total_line_item) {
1660
+		EE_Error::doing_it_wrong('EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0');
1661
+		return self::get_pre_tax_subtotal($total_line_item);
1662 1662
 	}
1663 1663
 
1664 1664
 
@@ -1669,9 +1669,9 @@  discard block
 block discarded – undo
1669 1669
 	 * @return \EE_Line_Item
1670 1670
 	 * @throws \EE_Error
1671 1671
 	 */
1672
-	public static function create_default_total_line_item( $transaction = NULL) {
1673
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0' );
1674
-		return self::create_total_line_item( $transaction );
1672
+	public static function create_default_total_line_item($transaction = NULL) {
1673
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0');
1674
+		return self::create_total_line_item($transaction);
1675 1675
 	}
1676 1676
 
1677 1677
 
@@ -1683,9 +1683,9 @@  discard block
 block discarded – undo
1683 1683
 	 * @return \EE_Line_Item
1684 1684
 	 * @throws \EE_Error
1685 1685
 	 */
1686
-	public static function create_default_tickets_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1687
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0' );
1688
-		return self::create_pre_tax_subtotal( $total_line_item, $transaction );
1686
+	public static function create_default_tickets_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1687
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0');
1688
+		return self::create_pre_tax_subtotal($total_line_item, $transaction);
1689 1689
 	}
1690 1690
 
1691 1691
 
@@ -1697,9 +1697,9 @@  discard block
 block discarded – undo
1697 1697
 	 * @return \EE_Line_Item
1698 1698
 	 * @throws \EE_Error
1699 1699
 	 */
1700
-	public static function create_default_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1701
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0' );
1702
-		return self::create_taxes_subtotal( $total_line_item, $transaction );
1700
+	public static function create_default_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1701
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0');
1702
+		return self::create_taxes_subtotal($total_line_item, $transaction);
1703 1703
 	}
1704 1704
 
1705 1705
 
@@ -1711,9 +1711,9 @@  discard block
 block discarded – undo
1711 1711
 	 * @return \EE_Line_Item
1712 1712
 	 * @throws \EE_Error
1713 1713
 	 */
1714
-	public static function create_default_event_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1715
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0' );
1716
-		return self::create_event_subtotal( $total_line_item, $transaction );
1714
+	public static function create_default_event_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1715
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0');
1716
+		return self::create_event_subtotal($total_line_item, $transaction);
1717 1717
 	}
1718 1718
 
1719 1719
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 	 * Deletes ALL children of the passed line item
872 872
 	 *
873 873
 	 * @param EE_Line_Item $parent_line_item
874
-	 * @return bool
874
+	 * @return integer
875 875
 	 * @throws \EE_Error
876 876
 	 */
877 877
 	public static function delete_all_child_items( EE_Line_Item $parent_line_item ) {
@@ -1135,6 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1136 1136
 	 * @param string $line_item_type one of the EEM_Line_Item constants
1137 1137
 	 * @param string | NULL $obj_type object model class name (minus prefix) or NULL to ignore object type when searching
1138
+	 * @param string $obj_type
1138 1139
 	 * @return EE_Line_Item[]
1139 1140
 	 */
1140 1141
 	protected static function _get_descendants_by_type_and_object_type(
@@ -1176,7 +1177,7 @@  discard block
 block discarded – undo
1176 1177
 	 * @uses  EEH_Line_Item::_get_descendants_by_type_and_object_type()
1177 1178
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
1178 1179
 	 * @param string $OBJ_type object type (like Event)
1179
-	 * @param array $OBJ_IDs array of OBJ_IDs
1180
+	 * @param string[] $OBJ_IDs array of OBJ_IDs
1180 1181
 	 * @return EE_Line_Item[]
1181 1182
 	 */
1182 1183
 	public static function get_line_items_by_object_type_and_IDs(
Please login to merge, or discard this patch.
core/business/EE_Transaction_Payments.class.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@
 block discarded – undo
161 161
 	 * @param EE_Transaction $transaction
162 162
 	 * @param string         $payment_status One of EEM_Payment's statuses, like 'PAP' (Approved).
163 163
 	 *                                       By default, searches for approved payments
164
-	 * @return float|false   float on success, false on fail
164
+	 * @return double   float on success, false on fail
165 165
 	 * @throws \EE_Error
166 166
 	 */
167 167
 	public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) {
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 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
  * Class EE_Transaction_Payments
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public static function instance() {
44 44
 		// check if class object is instantiated
45
-		if ( ! self::$_instance instanceof EE_Transaction_Payments ) {
45
+		if ( ! self::$_instance instanceof EE_Transaction_Payments) {
46 46
 			self::$_instance = new self();
47 47
 		}
48 48
 		return self::$_instance;
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
 	 * @return bool true if TXN total was updated, false if not
60 60
 	 * @throws \EE_Error
61 61
 	 */
62
-	public function recalculate_transaction_total( EE_Transaction $transaction, $update_txn = true ) {
62
+	public function recalculate_transaction_total(EE_Transaction $transaction, $update_txn = true) {
63 63
 		$total_line_item = $transaction->total_line_item();
64
-		if ( ! $total_line_item instanceof EE_Line_Item ) {
64
+		if ( ! $total_line_item instanceof EE_Line_Item) {
65 65
 			EE_Error::add_error(
66
-				sprintf( __( 'The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso' ), $transaction->ID() ),
66
+				sprintf(__('The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso'), $transaction->ID()),
67 67
 				__FILE__, __FUNCTION__, __LINE__
68 68
 			);
69 69
 			return false;
70 70
 		}
71 71
 		$new_total = $total_line_item->recalculate_total_including_taxes();
72
-		$transaction->set_total( $new_total );
73
-		if ( $update_txn ) {
72
+		$transaction->set_total($new_total);
73
+		if ($update_txn) {
74 74
 			return $transaction->save() ? true : false;
75 75
 		}
76 76
 		return false;
@@ -93,20 +93,20 @@  discard block
 block discarded – undo
93 93
 	 * @return    boolean        whether the TXN was saved
94 94
 	 * @throws \EE_Error
95 95
 	 */
96
-	public function calculate_total_payments_and_update_status( EE_Transaction $transaction, $update_txn = true ){
96
+	public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) {
97 97
 		// verify transaction
98
-		if ( ! $transaction instanceof EE_Transaction ) {
99
-			EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
98
+		if ( ! $transaction instanceof EE_Transaction) {
99
+			EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
100 100
 			return false;
101 101
 		}
102 102
 		// calculate total paid
103
-		$total_paid = $this->recalculate_total_payments_for_transaction( $transaction );
103
+		$total_paid = $this->recalculate_total_payments_for_transaction($transaction);
104 104
 		// if total paid has changed
105
-		if ( $total_paid !== false && (float)$total_paid !== $transaction->paid() ) {
106
-			$transaction->set_paid( $total_paid );
105
+		if ($total_paid !== false && (float) $total_paid !== $transaction->paid()) {
106
+			$transaction->set_paid($total_paid);
107 107
 			// maybe update status, and make sure to save transaction if not done already
108
-			if ( ! $transaction->update_status_based_on_total_paid( $update_txn ) ) {
109
-				if ( $update_txn ) {
108
+			if ( ! $transaction->update_status_based_on_total_paid($update_txn)) {
109
+				if ($update_txn) {
110 110
 					return $transaction->save() ? true : false;
111 111
 				}
112 112
 			} else {
@@ -130,18 +130,18 @@  discard block
 block discarded – undo
130 130
 	 * @return float|false   float on success, false on fail
131 131
 	 * @throws \EE_Error
132 132
 	 */
133
-	public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) {
133
+	public function recalculate_total_payments_for_transaction(EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved) {
134 134
 		// verify transaction
135
-		if ( ! $transaction instanceof EE_Transaction ) {
136
-			EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
135
+		if ( ! $transaction instanceof EE_Transaction) {
136
+			EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
137 137
 			return false;
138 138
 		}
139 139
 		// ensure Payment model is loaded
140
-		EE_Registry::instance()->load_model( 'Payment' );
140
+		EE_Registry::instance()->load_model('Payment');
141 141
 		// calls EEM_Base::sum()
142 142
 		return EEM_Payment::instance()->sum(
143 143
 			// query params
144
-			array( array( 'TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status )),
144
+			array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)),
145 145
 			// field to sum
146 146
 			'PAY_amount'
147 147
 		);
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
 	 * @return boolean
160 160
 	 * @throws \EE_Error
161 161
 	 */
162
-	public function delete_payment_and_update_transaction( EE_Payment $payment ) {
162
+	public function delete_payment_and_update_transaction(EE_Payment $payment) {
163 163
 		// verify payment
164
-		if ( ! $payment instanceof EE_Payment ) {
165
-			EE_Error::add_error( __( 'A valid Payment object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
164
+		if ( ! $payment instanceof EE_Payment) {
165
+			EE_Error::add_error(__('A valid Payment object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
166 166
 			return false;
167 167
 		}
168
-		if ( ! $this->delete_registration_payments_and_update_registrations( $payment ) ) {
168
+		if ( ! $this->delete_registration_payments_and_update_registrations($payment)) {
169 169
 			return false;
170 170
 		}
171
-		if ( ! $payment->delete() ) {
172
-			EE_Error::add_error( __( 'The payment could not be deleted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
171
+		if ( ! $payment->delete()) {
172
+			EE_Error::add_error(__('The payment could not be deleted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
173 173
 			return false;
174 174
 		}
175 175
 
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
 			|| $TXN_status === EEM_Transaction::failed_status_code
181 181
 			|| $payment->amount() === 0
182 182
 		) {
183
-			EE_Error::add_success( __( 'The Payment was successfully deleted.', 'event_espresso' ) );
183
+			EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso'));
184 184
 			return true;
185 185
 		}
186 186
 
187 187
 
188 188
 		//if this fails, that just means that the transaction didn't get its status changed and/or updated.
189 189
 		//however the payment was still deleted.
190
-		if ( ! $this->calculate_total_payments_and_update_status( $transaction ) ) {
190
+		if ( ! $this->calculate_total_payments_and_update_status($transaction)) {
191 191
 
192 192
 			EE_Error::add_attention(
193 193
 				__(
@@ -221,28 +221,28 @@  discard block
 block discarded – undo
221 221
 	 * @return bool
222 222
 	 * @throws \EE_Error
223 223
 	 */
224
-	public function delete_registration_payments_and_update_registrations( EE_Payment $payment, $reg_payment_query_params = array() ) {
224
+	public function delete_registration_payments_and_update_registrations(EE_Payment $payment, $reg_payment_query_params = array()) {
225 225
 		$save_payment = false;
226
-		$reg_payment_query_params = ! empty( $reg_payment_query_params ) ? $reg_payment_query_params : array( array( 'PAY_ID' => $payment->ID() ) );
227
-		$registration_payments = EEM_Registration_Payment::instance()->get_all( $reg_payment_query_params );
228
-		if ( ! empty( $registration_payments )) {
229
-			foreach ( $registration_payments as $registration_payment ) {
230
-				if ( $registration_payment instanceof EE_Registration_Payment ) {
226
+		$reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params : array(array('PAY_ID' => $payment->ID()));
227
+		$registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params);
228
+		if ( ! empty($registration_payments)) {
229
+			foreach ($registration_payments as $registration_payment) {
230
+				if ($registration_payment instanceof EE_Registration_Payment) {
231 231
 					$amount_paid = $registration_payment->amount();
232 232
 					$registration = $registration_payment->registration();
233
-					if ( $registration instanceof EE_Registration ) {
234
-						$registration->set_paid( $registration->paid() - $amount_paid );
235
-						if ( $registration->save() ) {
236
-							if ( $registration_payment->delete() ) {
237
-								$registration->_remove_relation_to( $payment, 'Payment' );
238
-								$payment->_remove_relation_to( $registration, 'Registration' );
233
+					if ($registration instanceof EE_Registration) {
234
+						$registration->set_paid($registration->paid() - $amount_paid);
235
+						if ($registration->save()) {
236
+							if ($registration_payment->delete()) {
237
+								$registration->_remove_relation_to($payment, 'Payment');
238
+								$payment->_remove_relation_to($registration, 'Registration');
239 239
 							}
240 240
 							$save_payment = true;
241 241
 						}
242 242
 					} else {
243 243
 						EE_Error::add_error(
244 244
 							sprintf(
245
-								__( 'An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso' ),
245
+								__('An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso'),
246 246
 								$registration_payment->ID()
247 247
 							),
248 248
 							__FILE__, __FUNCTION__, __LINE__
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 				} else {
253 253
 					EE_Error::add_error(
254 254
 						sprintf(
255
-							__( 'An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso' ),
255
+							__('An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso'),
256 256
 							$payment->ID()
257 257
 						),
258 258
 						__FILE__, __FUNCTION__, __LINE__
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 				}
262 262
 			}
263 263
 		}
264
-		if ( $save_payment ) {
264
+		if ($save_payment) {
265 265
 			$payment->save();
266 266
 		}
267 267
 		return true;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = true)
286 286
 	{
287 287
 		EE_Error::doing_it_wrong(
288
-			__CLASS__ . '::' . __FUNCTION__,
288
+			__CLASS__.'::'.__FUNCTION__,
289 289
 			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
290 290
 				'EE_Transaction::update_status_based_on_total_paid()'),
291 291
 			'4.9.1',
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * @deprecated 4.9.12
328 328
 	 * @param string $old_txn_status
329 329
 	 */
330
-	public function set_old_txn_status( $old_txn_status ) {
330
+	public function set_old_txn_status($old_txn_status) {
331 331
 		EE_Error::doing_it_wrong(
332 332
 			__METHOD__,
333 333
 			esc_html__(
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			'4.9.12'
338 338
 		);
339 339
 		// only set the first time
340
-		if ( $this->_old_txn_status === null ) {
340
+		if ($this->_old_txn_status === null) {
341 341
 			$this->_old_txn_status = $old_txn_status;
342 342
 		}
343 343
 	}
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 * @deprecated 4.9.12
367 367
 	 * @param string $new_txn_status
368 368
 	 */
369
-	public function set_new_txn_status( $new_txn_status ) {
369
+	public function set_new_txn_status($new_txn_status) {
370 370
 		EE_Error::doing_it_wrong(
371 371
 			__METHOD__,
372 372
 			esc_html__(
Please login to merge, or discard this patch.
core/EE_Cron_Tasks.core.php 2 patches
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @param int $PAY_ID
171 171
 	 */
172 172
 	public static function setup_update_for_transaction_with_payment( $TXN_ID = 0, $PAY_ID = 0 ) {
173
-            do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
173
+			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
174 174
 		if ( absint( $TXN_ID )) {
175 175
 			self::$_update_transactions_with_payment[ $TXN_ID ] = $PAY_ID;
176 176
 			add_action(
@@ -303,7 +303,6 @@  discard block
 block discarded – undo
303 303
 
304 304
 	/**
305 305
 	 * finalize_abandoned_transactions
306
-
307 306
 	 * loops through the self::$_abandoned_transactions array
308 307
 	 * and attempts to finalize any TXNs that have not been completed
309 308
 	 * but have had their sessions expired, most likely due to a user not
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @return EE_Cron_Tasks
29 29
 	 */
30 30
 	public static function instance() {
31
-		if ( ! self::$_instance instanceof EE_Cron_Tasks ) {
31
+		if ( ! self::$_instance instanceof EE_Cron_Tasks) {
32 32
 			self::$_instance = new self();
33 33
 		}
34 34
 		return self::$_instance;
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	 * @return EE_Cron_Tasks
42 42
 	 */
43 43
 	private function __construct() {
44
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
44
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
45 45
 		// verify that WP Cron is enabled
46
-		if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON && is_admin() ) {
46
+		if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON && is_admin()) {
47 47
 			EE_Error::add_persistent_admin_notice(
48 48
 				'wp_cron_disabled',
49 49
 				sprintf(
@@ -58,26 +58,26 @@  discard block
 block discarded – undo
58 58
 		// UPDATE TRANSACTION WITH PAYMENT
59 59
 		add_action(
60 60
 			'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
61
-			array( 'EE_Cron_Tasks', 'setup_update_for_transaction_with_payment' ),
61
+			array('EE_Cron_Tasks', 'setup_update_for_transaction_with_payment'),
62 62
 			10, 2
63 63
 		);
64 64
 		// FINALIZE ABANDONED TRANSACTIONS
65 65
 		add_action(
66 66
 			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
67
-			array( 'EE_Cron_Tasks', 'check_for_abandoned_transactions' ),
67
+			array('EE_Cron_Tasks', 'check_for_abandoned_transactions'),
68 68
 			10, 1
69 69
 		);
70 70
 		// CLEAN OUT JUNK TRANSACTIONS AND RELATED DATA
71 71
 		add_action(
72 72
 				'AHEE__EE_Cron_Tasks__clean_up_junk_transactions',
73
-				array( 'EE_Cron_Tasks', 'clean_out_junk_transactions' )
73
+				array('EE_Cron_Tasks', 'clean_out_junk_transactions')
74 74
 		);
75 75
 		// logging
76 76
 		add_action(
77 77
 			'AHEE__EE_System__load_core_configuration__complete',
78
-			array( 'EE_Cron_Tasks', 'log_scheduled_ee_crons' )
78
+			array('EE_Cron_Tasks', 'log_scheduled_ee_crons')
79 79
 		);
80
-		EE_Registry::instance()->load_lib( 'Messages_Scheduler' );
80
+		EE_Registry::instance()->load_lib('Messages_Scheduler');
81 81
 	}
82 82
 
83 83
 
@@ -92,17 +92,17 @@  discard block
 block discarded – undo
92 92
 			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
93 93
 			'AHEE__EE_Cron_Tasks__clean_up_junk_transactions',
94 94
 		);
95
-		$crons = get_option( 'cron' );
96
-		if ( ! is_array( $crons ) ) {
95
+		$crons = get_option('cron');
96
+		if ( ! is_array($crons)) {
97 97
 			return;
98 98
 		}
99
-		foreach ( $crons as $timestamp => $cron ) {
100
-			foreach ( $ee_crons as $ee_cron ) {
101
-				if ( isset( $cron[ $ee_cron ] ) ) {
102
-					do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $ee_cron, 'scheduled EE cron' );
103
-					foreach ( $cron[ $ee_cron ] as $ee_cron_details ) {
104
-						if ( ! empty( $ee_cron_details[ 'args' ] )) {
105
-							do_action( 'AHEE_log', __CLASS__, __FUNCTION__, print_r( $ee_cron_details[ 'args' ], true ), "$ee_cron args" );
99
+		foreach ($crons as $timestamp => $cron) {
100
+			foreach ($ee_crons as $ee_cron) {
101
+				if (isset($cron[$ee_cron])) {
102
+					do_action('AHEE_log', __CLASS__, __FUNCTION__, $ee_cron, 'scheduled EE cron');
103
+					foreach ($cron[$ee_cron] as $ee_cron_details) {
104
+						if ( ! empty($ee_cron_details['args'])) {
105
+							do_action('AHEE_log', __CLASS__, __FUNCTION__, print_r($ee_cron_details['args'], true), "$ee_cron args");
106 106
 						}
107 107
 					}
108 108
 				}
@@ -139,15 +139,15 @@  discard block
 block discarded – undo
139 139
 		$TXN_ID,
140 140
 		$PAY_ID
141 141
 	) {
142
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
142
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
143 143
 		// validate $TXN_ID and $timestamp
144
-		$TXN_ID = absint( $TXN_ID );
145
-		$timestamp = absint( $timestamp );
146
-		if ( $TXN_ID && $timestamp ) {
144
+		$TXN_ID = absint($TXN_ID);
145
+		$timestamp = absint($timestamp);
146
+		if ($TXN_ID && $timestamp) {
147 147
 			wp_schedule_single_event(
148 148
 				$timestamp,
149 149
 				'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
150
-				array( $TXN_ID, $PAY_ID )
150
+				array($TXN_ID, $PAY_ID)
151 151
 			);
152 152
 		}
153 153
 	}
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
 	 * @param int  $TXN_ID
170 170
 	 * @param int $PAY_ID
171 171
 	 */
172
-	public static function setup_update_for_transaction_with_payment( $TXN_ID = 0, $PAY_ID = 0 ) {
173
-            do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
174
-		if ( absint( $TXN_ID )) {
175
-			self::$_update_transactions_with_payment[ $TXN_ID ] = $PAY_ID;
172
+	public static function setup_update_for_transaction_with_payment($TXN_ID = 0, $PAY_ID = 0) {
173
+            do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
174
+		if (absint($TXN_ID)) {
175
+			self::$_update_transactions_with_payment[$TXN_ID] = $PAY_ID;
176 176
 			add_action(
177 177
 				'shutdown',
178
-				array( 'EE_Cron_Tasks', 'update_transaction_with_payment' ),
178
+				array('EE_Cron_Tasks', 'update_transaction_with_payment'),
179 179
 				5
180 180
 			);
181 181
 		}
@@ -194,18 +194,18 @@  discard block
 block discarded – undo
194 194
 	 * @throws \EE_Error
195 195
 	 */
196 196
 	public static function update_transaction_with_payment() {
197
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
197
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
198 198
 		// are there any TXNs that need cleaning up ?
199
-		if ( ! empty( self::$_update_transactions_with_payment ) ) {
199
+		if ( ! empty(self::$_update_transactions_with_payment)) {
200 200
 			/** @type EE_Payment_Processor $payment_processor */
201
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
201
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
202 202
 			// set revisit flag for payment processor
203
-			$payment_processor->set_revisit( false );
203
+			$payment_processor->set_revisit(false);
204 204
 			// load EEM_Transaction
205
-			EE_Registry::instance()->load_model( 'Transaction' );
206
-			foreach ( self::$_update_transactions_with_payment as $TXN_ID => $PAY_ID ) {
205
+			EE_Registry::instance()->load_model('Transaction');
206
+			foreach (self::$_update_transactions_with_payment as $TXN_ID => $PAY_ID) {
207 207
 				// reschedule the cron if we can't hit the db right now
208
-				if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) {
208
+				if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
209 209
 					// reset cron job for updating the TXN
210 210
 					EE_Cron_Tasks::schedule_update_transaction_with_payment(
211 211
 						time() + EE_Cron_Tasks::reschedule_timeout,
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 					);
215 215
 					continue;
216 216
 				}
217
-				$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
218
-				$payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID );
217
+				$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
218
+				$payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
219 219
 				// verify transaction
220
-				if ( $transaction instanceof EE_Transaction && $payment instanceof EE_Payment ) {
220
+				if ($transaction instanceof EE_Transaction && $payment instanceof EE_Payment) {
221 221
 					// now try to update the TXN with any payments
222
-					$payment_processor->update_txn_based_on_payment( $transaction, $payment, true, true );
222
+					$payment_processor->update_txn_based_on_payment($transaction, $payment, true, true);
223 223
 				}
224
-				unset( self::$_update_transactions_with_payment[ $TXN_ID ] );
224
+				unset(self::$_update_transactions_with_payment[$TXN_ID]);
225 225
 			}
226 226
 		}
227 227
 	}
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
 		$TXN_ID
259 259
 	) {
260 260
 		// validate $TXN_ID and $timestamp
261
-		$TXN_ID = absint( $TXN_ID );
262
-		$timestamp = absint( $timestamp );
263
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
264
-		if ( $TXN_ID && $timestamp ) {
261
+		$TXN_ID = absint($TXN_ID);
262
+		$timestamp = absint($timestamp);
263
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
264
+		if ($TXN_ID && $timestamp) {
265 265
 			wp_schedule_single_event(
266 266
 				$timestamp,
267 267
 				'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
268
-				array( $TXN_ID )
268
+				array($TXN_ID)
269 269
 			);
270 270
 		}
271 271
 	}
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
 	 *
288 288
 	 * @param int $TXN_ID
289 289
 	 */
290
-	public static function check_for_abandoned_transactions(	$TXN_ID = 0 ) {
291
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
292
-		if ( absint( $TXN_ID )) {
293
-			self::$_abandoned_transactions[]  = $TXN_ID;
290
+	public static function check_for_abandoned_transactions($TXN_ID = 0) {
291
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
292
+		if (absint($TXN_ID)) {
293
+			self::$_abandoned_transactions[] = $TXN_ID;
294 294
 			add_action(
295 295
 				'shutdown',
296
-				array( 'EE_Cron_Tasks', 'finalize_abandoned_transactions' ),
296
+				array('EE_Cron_Tasks', 'finalize_abandoned_transactions'),
297 297
 				5
298 298
 			);
299 299
 		}
@@ -312,21 +312,21 @@  discard block
 block discarded – undo
312 312
 	 * @throws \EE_Error
313 313
 	 */
314 314
 	public static function finalize_abandoned_transactions() {
315
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
315
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
316 316
 		// are there any TXNs that need cleaning up ?
317
-		if ( ! empty( self::$_abandoned_transactions ) ) {
317
+		if ( ! empty(self::$_abandoned_transactions)) {
318 318
 			/** @type EE_Transaction_Processor $transaction_processor */
319
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
319
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
320 320
 			// set revisit flag for txn processor
321
-			$transaction_processor->set_revisit( false );
321
+			$transaction_processor->set_revisit(false);
322 322
 			/** @type EE_Payment_Processor $payment_processor */
323
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
323
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
324 324
 			// load EEM_Transaction
325
-			EE_Registry::instance()->load_model( 'Transaction' );
326
-			foreach ( self::$_abandoned_transactions as $TXN_ID ) {
327
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
325
+			EE_Registry::instance()->load_model('Transaction');
326
+			foreach (self::$_abandoned_transactions as $TXN_ID) {
327
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
328 328
 				// reschedule the cron if we can't hit the db right now
329
-				if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) {
329
+				if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
330 330
 					// reset cron job for finalizing the TXN
331 331
 					EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
332 332
 						time() + EE_Cron_Tasks::reschedule_timeout,
@@ -334,17 +334,17 @@  discard block
 block discarded – undo
334 334
 					);
335 335
 					continue;
336 336
 				}
337
-				$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
337
+				$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
338 338
 				// verify transaction
339
-				if ( $transaction instanceof EE_Transaction ) {
339
+				if ($transaction instanceof EE_Transaction) {
340 340
 					// don't finalize the TXN if it has already been completed
341
-					if ( $transaction->all_reg_steps_completed() === true ) {
341
+					if ($transaction->all_reg_steps_completed() === true) {
342 342
 						continue;
343 343
 					}
344 344
 					// let's simulate an IPN here which will trigger any notifications that need to go out
345
-					$payment_processor->update_txn_based_on_payment( $transaction, $transaction->last_payment(), true, true );
345
+					$payment_processor->update_txn_based_on_payment($transaction, $transaction->last_payment(), true, true);
346 346
 				}
347
-				unset( self::$_abandoned_transactions[ $TXN_ID ] );
347
+				unset(self::$_abandoned_transactions[$TXN_ID]);
348 348
 			}
349 349
 		}
350 350
 	}
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	//when a transaction is initially made, schedule this check.
361 361
 	//if it has NO REG data by the time it has expired, forget about it
362 362
 	public static function clean_out_junk_transactions() {
363
-		if( EE_Maintenance_Mode::instance()->models_can_query() ) {
363
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
364 364
 			EEM_Transaction::instance('')->delete_junk_transactions();
365 365
 			EEM_Registration::instance('')->delete_registrations_with_no_transaction();
366 366
 			EEM_Line_Item::instance('')->delete_line_items_with_no_transaction();
Please login to merge, or discard this patch.
strategies/normalization/EE_Many_Valued_Normalization.strategy.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base{
9
+class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base {
10 10
 	protected $_individual_item_normalization_strategy = array();
11 11
 	/**
12 12
 	 *
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
 	 * @return array
24 24
 	 */
25 25
 	public function normalize($value_to_normalize) {
26
-		if ( is_array( $value_to_normalize )){
26
+		if (is_array($value_to_normalize)) {
27 27
 			$items_to_normalize = $value_to_normalize;
28
-		} else if( $value_to_normalize !== NULL ){
29
-			$items_to_normalize = array( $value_to_normalize );
28
+		} else if ($value_to_normalize !== NULL) {
29
+			$items_to_normalize = array($value_to_normalize);
30 30
 		} else {
31 31
 			$items_to_normalize = array();
32 32
 		}
33 33
 		$normalized_array_value = array();
34
-		foreach( $items_to_normalize as $key => $individual_item ){
35
-			$normalized_array_value[ $key ] = $this->normalize_one( $individual_item );
34
+		foreach ($items_to_normalize as $key => $individual_item) {
35
+			$normalized_array_value[$key] = $this->normalize_one($individual_item);
36 36
 		}
37 37
 		return $normalized_array_value;
38 38
 	}
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param string $individual_value_to_normalize but definitely NOT an array
43 43
 	 * @return mixed
44 44
 	 */
45
-	public function normalize_one( $individual_value_to_normalize ) {
46
-		return $this->_individual_item_normalization_strategy->normalize( $individual_value_to_normalize );
45
+	public function normalize_one($individual_value_to_normalize) {
46
+		return $this->_individual_item_normalization_strategy->normalize($individual_value_to_normalize);
47 47
 	}
48 48
 
49 49
 	/**
@@ -51,16 +51,16 @@  discard block
 block discarded – undo
51 51
 	 * @param array $normalized_values
52 52
 	 * @return string[]
53 53
 	 */
54
-	public function unnormalize( $normalized_values ) {
55
-		if( $normalized_values === null ) {
54
+	public function unnormalize($normalized_values) {
55
+		if ($normalized_values === null) {
56 56
 			$normalized_values = array();
57 57
 		}
58
-		if( ! is_array( $normalized_values ) ){
59
-			$normalized_values = array( $normalized_values );
58
+		if ( ! is_array($normalized_values)) {
59
+			$normalized_values = array($normalized_values);
60 60
 		}
61 61
 		$non_normal_values = array();
62
-		foreach( $normalized_values as $key => $value ) {
63
-			$non_normal_values[ $key ] = $this->unnormalize_one( $value );
62
+		foreach ($normalized_values as $key => $value) {
63
+			$non_normal_values[$key] = $this->unnormalize_one($value);
64 64
 		}
65 65
 		return $non_normal_values;
66 66
 	}
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 * @param mixed $individual_value_to_unnormalize but certainly NOT an array
71 71
 	 * @return string
72 72
 	 */
73
-	public function unnormalize_one( $individual_value_to_unnormalize ) {
74
-		return $this->_individual_item_normalization_strategy->unnormalize( $individual_value_to_unnormalize );
73
+	public function unnormalize_one($individual_value_to_unnormalize) {
74
+		return $this->_individual_item_normalization_strategy->unnormalize($individual_value_to_unnormalize);
75 75
 	}
76 76
 }
77 77
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Recipient_Details_Shortcodes.lib.php 2 patches
Spacing   +65 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 
38 38
 
39 39
 	protected function _init_props() {
40
-		$this->label = esc_html__( 'Recipient Details Shortcodes', 'event_espresso' );
41
-		$this->description = esc_html__( 'All shortcodes specific to recipient registration data', 'event_espresso' );
40
+		$this->label = esc_html__('Recipient Details Shortcodes', 'event_espresso');
41
+		$this->description = esc_html__('All shortcodes specific to recipient registration data', 'event_espresso');
42 42
 		$this->_shortcodes = array(
43
-			'[RECIPIENT_FNAME]' => esc_html__( 'Parses to the first name of the recipient for the message.', 'event_espresso' ),
44
-			'[RECIPIENT_LNAME]' => esc_html__( 'Parses to the last name of the recipient for the message.', 'event_espresso' ),
45
-			'[RECIPIENT_EMAIL]' => esc_html__( 'Parses to the email address of the recipient for the message.', 'event_espresso' ),
46
-			'[RECIPIENT_REGISTRATION_ID]' => esc_html__( 'Parses to the registration ID of the recipient for the message.', 'event_espresso' ),
47
-			'[RECIPIENT_REGISTRATION_CODE]' => esc_html__( 'Parses to the registration code of the recipient for the message.', 'event_espresso' ),
48
-			'[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__( 'Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso' ),
49
-			'[RECIPIENT_PHONE_NUMBER]' => esc_html__( 'The Phone Number for the recipient of the message.', 'event_espresso' ),
50
-			'[RECIPIENT_ADDRESS]' => esc_html__( 'The Address for the recipient of the message.', 'event_espresso' ),
51
-			'[RECIPIENT_ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the recipient of the message.', 'event_espresso' ),
52
-			'[RECIPIENT_CITY]' => esc_html__( 'The city for the recipient of the message.', 'event_espresso' ),
53
-			'[RECIPIENT_ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso' ),
54
-			'[RECIPIENT_ADDRESS_STATE]' => esc_html__( 'The state/province for the recipient of the message.', 'event_espresso' ),
55
-			'[RECIPIENT_COUNTRY]' => esc_html__( 'The country for the recipient of the message.', 'event_espresso' ),
56
-			'[RECIPIENT_ANSWER_*]' => esc_html__( 'This is a special dynamic shortcode.  After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso' ),
57
-			'[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__( 'If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient.  Otherwise the value of 0 is printed.', 'event_espresso' )
43
+			'[RECIPIENT_FNAME]' => esc_html__('Parses to the first name of the recipient for the message.', 'event_espresso'),
44
+			'[RECIPIENT_LNAME]' => esc_html__('Parses to the last name of the recipient for the message.', 'event_espresso'),
45
+			'[RECIPIENT_EMAIL]' => esc_html__('Parses to the email address of the recipient for the message.', 'event_espresso'),
46
+			'[RECIPIENT_REGISTRATION_ID]' => esc_html__('Parses to the registration ID of the recipient for the message.', 'event_espresso'),
47
+			'[RECIPIENT_REGISTRATION_CODE]' => esc_html__('Parses to the registration code of the recipient for the message.', 'event_espresso'),
48
+			'[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__('Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso'),
49
+			'[RECIPIENT_PHONE_NUMBER]' => esc_html__('The Phone Number for the recipient of the message.', 'event_espresso'),
50
+			'[RECIPIENT_ADDRESS]' => esc_html__('The Address for the recipient of the message.', 'event_espresso'),
51
+			'[RECIPIENT_ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the recipient of the message.', 'event_espresso'),
52
+			'[RECIPIENT_CITY]' => esc_html__('The city for the recipient of the message.', 'event_espresso'),
53
+			'[RECIPIENT_ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso'),
54
+			'[RECIPIENT_ADDRESS_STATE]' => esc_html__('The state/province for the recipient of the message.', 'event_espresso'),
55
+			'[RECIPIENT_COUNTRY]' => esc_html__('The country for the recipient of the message.', 'event_espresso'),
56
+			'[RECIPIENT_ANSWER_*]' => esc_html__('This is a special dynamic shortcode.  After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso'),
57
+			'[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__('If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient.  Otherwise the value of 0 is printed.', 'event_espresso')
58 58
 			);
59 59
 	}
60 60
 
@@ -65,36 +65,35 @@  discard block
 block discarded – undo
65 65
 	 * @param  string $shortcode the shortcode to be parsed.
66 66
 	 * @return string parsed shortcode
67 67
 	 */
68
-	protected function _parser( $shortcode ) {
68
+	protected function _parser($shortcode) {
69 69
 
70 70
 		//make sure we end up with a copy of the EE_Messages_Addressee object
71 71
 		$this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
72 72
 		$this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee
73
-		                    && is_array( $this->_data )
74
-		                    && isset( $this->_data['data'] )
73
+		                    && is_array($this->_data)
74
+		                    && isset($this->_data['data'])
75 75
 		                    && $this->_data['data'] instanceof EE_Messages_Addressee
76
-			? $this->_data['data'] :
77
-			$this->_recipient;
76
+			? $this->_data['data'] : $this->_recipient;
78 77
 		$this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee
79
-		                    && ! empty( $this->_extra_data['data'] )
78
+		                    && ! empty($this->_extra_data['data'])
80 79
 		                    && $this->_extra_data['data'] instanceof EE_Messages_Addressee
81 80
 			? $this->_extra_data['data']
82 81
 			: $this->_recipient;
83 82
 
84
-		if ( ! $this->_recipient instanceof EE_Messages_Addressee ) {
83
+		if ( ! $this->_recipient instanceof EE_Messages_Addressee) {
85 84
 			return '';
86 85
 		}
87 86
 
88 87
 		$attendee = $this->_recipient->att_obj;
89
-		if ( ! $attendee instanceof EE_Attendee ) {
88
+		if ( ! $attendee instanceof EE_Attendee) {
90 89
 			return '';
91 90
 		}
92 91
 
93
-		$this->_registrations_for_recipient = isset( $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] )
94
-			? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs']
92
+		$this->_registrations_for_recipient = isset($this->_recipient->attendees[$attendee->ID()]['reg_objs'])
93
+			? $this->_recipient->attendees[$attendee->ID()]['reg_objs']
95 94
 			: array();
96 95
 
97
-		switch ( $shortcode ) {
96
+		switch ($shortcode) {
98 97
 			case '[RECIPIENT_FNAME]' :
99 98
 				return $attendee->fname();
100 99
 				break;
@@ -108,21 +107,21 @@  discard block
 block discarded – undo
108 107
 				break;
109 108
 
110 109
 			case '[RECIPIENT_REGISTRATION_ID]' :
111
-				if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) {
110
+				if ( ! $this->_recipient->reg_obj instanceof EE_Registration) {
112 111
 					return '';
113 112
 				}
114 113
 				return $this->_get_reg_id();
115 114
 				break;
116 115
 
117 116
 			case '[RECIPIENT_REGISTRATION_CODE]' :
118
-				if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) {
117
+				if ( ! $this->_recipient->reg_obj instanceof EE_Registration) {
119 118
 					return '';
120 119
 				}
121 120
 				return $this->_get_reg_code();
122 121
 				break;
123 122
 
124 123
 			case '[RECIPIENT_EDIT_REGISTRATION_LINK]' :
125
-				if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) {
124
+				if ( ! $this->_recipient->reg_obj instanceof EE_Registration) {
126 125
 					return '';
127 126
 				}
128 127
 				return $this->_recipient->reg_obj->edit_attendee_information_url();
@@ -164,23 +163,23 @@  discard block
 block discarded – undo
164 163
 				break;
165 164
 		}
166 165
 
167
-		if ( strpos( $shortcode, '[RECIPIENT_ANSWER_*' ) !== false ) {
168
-			$shortcode = str_replace( '[RECIPIENT_ANSWER_*', '', $shortcode );
169
-			$shortcode = trim( str_replace( ']', '', $shortcode ) );
166
+		if (strpos($shortcode, '[RECIPIENT_ANSWER_*') !== false) {
167
+			$shortcode = str_replace('[RECIPIENT_ANSWER_*', '', $shortcode);
168
+			$shortcode = trim(str_replace(']', '', $shortcode));
170 169
 
171 170
 
172 171
 			//now let's figure out what question has this text
173
-			if ( empty( $this->_recipient->questions ) || ! $this->_recipient->reg_obj instanceof EE_Registration ) {
172
+			if (empty($this->_recipient->questions) || ! $this->_recipient->reg_obj instanceof EE_Registration) {
174 173
 				return '';
175 174
 			}
176 175
 
177
-			foreach ( $this->_recipient->questions as $ansid => $question ) {
176
+			foreach ($this->_recipient->questions as $ansid => $question) {
178 177
 				if (
179 178
 					$question instanceof EE_Question
180 179
 					&& $question->display_text() == $shortcode
181
-					&& isset( $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ] )
180
+					&& isset($this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid])
182 181
 				) {
183
-					return $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]->get_pretty( 'ANS_value', 'no_wpautop' );
182
+					return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop');
184 183
 				}
185 184
 			}
186 185
 		}
@@ -211,53 +210,53 @@  discard block
 block discarded – undo
211 210
 	protected function _get_reg_code() {
212 211
 
213 212
 		//if only one related registration for the recipient then just return that reg code.
214
-		if ( count( $this->_registrations_for_recipient ) <= 1 )  {
213
+		if (count($this->_registrations_for_recipient) <= 1) {
215 214
 			return $this->_recipient->reg_obj->reg_code();
216 215
 		}
217 216
 
218 217
 		//k more than one registration so let's see if we can get specific to context
219 218
 		//are we parsing event_list?
220
-		if ( $this->_data instanceof EE_Event ) {
219
+		if ($this->_data instanceof EE_Event) {
221 220
 			$reg_code = array();
222 221
 			//loop through registrations for recipient and see if there is a match for this event
223
-			foreach ( $this->_registrations_for_recipient as $reg ) {
224
-				if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) {
222
+			foreach ($this->_registrations_for_recipient as $reg) {
223
+				if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) {
225 224
 					$reg_code[] = $reg->reg_code();
226 225
 				}
227 226
 			}
228
-			return implode( ', ', $reg_code );
227
+			return implode(', ', $reg_code);
229 228
 		}
230 229
 
231 230
 		//are we parsing ticket list?
232
-		if ( $this->_data instanceof EE_Ticket ) {
231
+		if ($this->_data instanceof EE_Ticket) {
233 232
 			$reg_code = array();
234 233
 			//loop through each registration for recipient and see if there is a match for this ticket
235
-			foreach ( $this->_registrations_for_recipient as $reg ) {
236
-				if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) {
234
+			foreach ($this->_registrations_for_recipient as $reg) {
235
+				if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) {
237 236
 					$reg_code = $reg->reg_code();
238 237
 				}
239 238
 			}
240
-			return implode( ', ', $reg_code );
239
+			return implode(', ', $reg_code);
241 240
 		}
242 241
 
243 242
 		//do we have a specific reg_obj?  Let's use it
244
-		if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) {
243
+		if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) {
245 244
 			return $this->_data->reg_obj->reg_code();
246 245
 		}
247 246
 
248 247
 		//do we have a specific reg_obj?  Let's use it
249
-		if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) {
248
+		if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) {
250 249
 			return $this->_data->reg_obj->reg_code();
251 250
 		}
252 251
 
253 252
 		//not able to determine the single reg code so let's return a comma delimited list of reg codes.
254 253
 		$reg_code = array();
255
-		foreach ( $this->_registrations_for_recipient as $reg ) {
256
-			if ( $reg instanceof EE_Registration ) {
254
+		foreach ($this->_registrations_for_recipient as $reg) {
255
+			if ($reg instanceof EE_Registration) {
257 256
 				$reg_code[] = $reg->reg_code();
258 257
 			}
259 258
 		}
260
-		return implode( ', ', $reg_code );
259
+		return implode(', ', $reg_code);
261 260
 	}
262 261
 
263 262
 
@@ -270,48 +269,48 @@  discard block
 block discarded – undo
270 269
 	protected function _get_reg_id() {
271 270
 
272 271
 		//if only one related registration for the recipient then just return that reg code.
273
-		if ( count( $this->_registrations_for_recipient ) <= 1 )  {
272
+		if (count($this->_registrations_for_recipient) <= 1) {
274 273
 			return $this->_recipient->reg_obj->ID();
275 274
 		}
276 275
 
277 276
 		//k more than one registration so let's see if we can get specific to context
278 277
 		//are we parsing event_list?
279
-		if ( $this->_data instanceof EE_Event ) {
278
+		if ($this->_data instanceof EE_Event) {
280 279
 			$registration_ids = array();
281 280
 			//loop through registrations for recipient and see if there is a match for this event
282
-			foreach ( $this->_registrations_for_recipient as $reg ) {
283
-				if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) {
281
+			foreach ($this->_registrations_for_recipient as $reg) {
282
+				if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) {
284 283
 					$registration_ids[] = $reg->ID();
285 284
 				}
286 285
 			}
287
-			return implode( ', ', $registration_ids );
286
+			return implode(', ', $registration_ids);
288 287
 		}
289 288
 
290 289
 		//are we parsing ticket list?
291
-		if ( $this->_data instanceof EE_Ticket ) {
290
+		if ($this->_data instanceof EE_Ticket) {
292 291
 			$registration_ids = array();
293 292
 			//loop through each registration for recipient and see if there is a match for this ticket
294
-			foreach ( $this->_registrations_for_recipient as $reg ) {
295
-				if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) {
293
+			foreach ($this->_registrations_for_recipient as $reg) {
294
+				if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) {
296 295
 					$registration_ids = $reg->ID();
297 296
 				}
298 297
 			}
299
-			return implode( ', ', $registration_ids );
298
+			return implode(', ', $registration_ids);
300 299
 		}
301 300
 
302 301
 		//do we have a specific reg_obj?  Let's use it
303
-		if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) {
302
+		if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) {
304 303
 			return $this->_data->reg_obj->ID();
305 304
 		}
306 305
 
307 306
 		//not able to determine the single reg code so let's return a comma delimited list of reg codes.
308 307
 		$registration_ids = array();
309
-		foreach ( $this->_registrations_for_recipient as $reg ) {
310
-			if ( $reg instanceof EE_Registration ) {
308
+		foreach ($this->_registrations_for_recipient as $reg) {
309
+			if ($reg instanceof EE_Registration) {
311 310
 				$registration_ids[] = $reg->ID();
312 311
 			}
313 312
 		}
314
-		return implode( ', ', $registration_ids );
313
+		return implode(', ', $registration_ids);
315 314
 	}
316 315
 
317 316
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Attendee_Shortcodes.lib.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -49,26 +49,26 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 	protected function _init_props() {
52
-		$this->label = esc_html__( 'Attendee Shortcodes', 'event_espresso' );
53
-		$this->description = esc_html__( 'All shortcodes specific to attendee related data', 'event_espresso' );
52
+		$this->label = esc_html__('Attendee Shortcodes', 'event_espresso');
53
+		$this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso');
54 54
 		$this->_shortcodes = array(
55
-			'[FNAME]' => esc_html__( 'First Name of an attendee.', 'event_espresso' ),
56
-			'[LNAME]' => esc_html__( 'Last Name of an attendee.', 'event_espresso' ),
57
-			'[ATTENDEE_EMAIL]' => esc_html__( 'Email address for the attendee.', 'event_espresso' ),
58
-			'[EDIT_ATTENDEE_LINK]' => esc_html__( 'Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso' ),
59
-			'[REGISTRATION_ID]' => esc_html__( 'Unique Registration ID for the registration', 'event_espresso' ),
60
-			'[REGISTRATION_CODE]' => esc_html__( 'Unique Registration Code for the registration', 'event_espresso' ),
61
-			'[REGISTRATION_STATUS_ID]' => esc_html__( 'Parses to the registration status for the attendee', 'event_espresso' ),
62
-			'[REGISTRATION_STATUS_LABEL]' => esc_html__( 'Parses to the status label for the registrant', 'event_espresso' ),
63
-			'[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__( 'Parses to the total amount paid for this registration.', 'event_espresso' ),
64
-			'[FRONTEND_EDIT_REG_LINK]' => esc_html__( 'Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso' ),
65
-			'[PHONE_NUMBER]' => esc_html__( 'The Phone Number for the Registration.', 'event_espresso' ),
66
-			'[ADDRESS]' => esc_html__( 'The Address for the Registration', 'event_espresso' ),
67
-			'[ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the registration.', 'event_espresso' ),
68
-			'[CITY]' => esc_html__( 'The city for the registration.', 'event_espresso' ),
69
-			'[ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the Registration.', 'event_espresso' ),
70
-			'[ADDRESS_STATE]' => esc_html__( 'The state/province for the registration.', 'event_espresso' ),
71
-			'[COUNTRY]' => esc_html__( 'The country for the registration.', 'event_espresso' )
55
+			'[FNAME]' => esc_html__('First Name of an attendee.', 'event_espresso'),
56
+			'[LNAME]' => esc_html__('Last Name of an attendee.', 'event_espresso'),
57
+			'[ATTENDEE_EMAIL]' => esc_html__('Email address for the attendee.', 'event_espresso'),
58
+			'[EDIT_ATTENDEE_LINK]' => esc_html__('Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso'),
59
+			'[REGISTRATION_ID]' => esc_html__('Unique Registration ID for the registration', 'event_espresso'),
60
+			'[REGISTRATION_CODE]' => esc_html__('Unique Registration Code for the registration', 'event_espresso'),
61
+			'[REGISTRATION_STATUS_ID]' => esc_html__('Parses to the registration status for the attendee', 'event_espresso'),
62
+			'[REGISTRATION_STATUS_LABEL]' => esc_html__('Parses to the status label for the registrant', 'event_espresso'),
63
+			'[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__('Parses to the total amount paid for this registration.', 'event_espresso'),
64
+			'[FRONTEND_EDIT_REG_LINK]' => esc_html__('Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso'),
65
+			'[PHONE_NUMBER]' => esc_html__('The Phone Number for the Registration.', 'event_espresso'),
66
+			'[ADDRESS]' => esc_html__('The Address for the Registration', 'event_espresso'),
67
+			'[ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the registration.', 'event_espresso'),
68
+			'[CITY]' => esc_html__('The city for the registration.', 'event_espresso'),
69
+			'[ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the Registration.', 'event_espresso'),
70
+			'[ADDRESS_STATE]' => esc_html__('The state/province for the registration.', 'event_espresso'),
71
+			'[COUNTRY]' => esc_html__('The country for the registration.', 'event_espresso')
72 72
 			);
73 73
 	}
74 74
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 	 * @return string
83 83
 	 * @throws \EE_Error
84 84
 	 */
85
-	protected function _parser( $shortcode ) {
85
+	protected function _parser($shortcode) {
86 86
 
87 87
 
88
-		$this->_xtra = ! empty( $this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee
88
+		$this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee
89 89
 			? $this->_extra_data['data']
90 90
 			: null;
91 91
 
@@ -94,34 +94,34 @@  discard block
 block discarded – undo
94 94
 			? null
95 95
 			: $this->_data;
96 96
 
97
-		if ( ! $registration instanceof EE_Registration ) {
97
+		if ( ! $registration instanceof EE_Registration) {
98 98
 			//let's attempt to get the txn_id for the error message.
99
-			$txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction
99
+			$txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction
100 100
 				? $this->_xtra->txn->ID()
101
-				: esc_html__( 'Unknown', 'event_espresso' );
102
-			$msg = esc_html__( 'There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso' );
101
+				: esc_html__('Unknown', 'event_espresso');
102
+			$msg = esc_html__('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso');
103 103
 			$dev_msg = sprintf(
104
-				esc_html__( 'The transaction ID for this request is: %s', 'event_espresso' ),
104
+				esc_html__('The transaction ID for this request is: %s', 'event_espresso'),
105 105
 				$txn_id
106 106
 			);
107
-			throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" );
107
+			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
108 108
 		}
109 109
 
110 110
 		//attendee obj for this registration
111
-		$attendee = isset( $this->_xtra->registrations[ $registration->ID() ]['att_obj'] )
112
-			?  $this->_xtra->registrations[ $registration->ID() ]['att_obj']
113
-			: null ;
111
+		$attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj'])
112
+			? $this->_xtra->registrations[$registration->ID()]['att_obj']
113
+			: null;
114 114
 
115
-		if ( ! $attendee instanceof EE_Attendee ) {
116
-			$msg = esc_html__( 'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso' );
115
+		if ( ! $attendee instanceof EE_Attendee) {
116
+			$msg = esc_html__('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso');
117 117
 			$dev_msg = sprintf(
118
-				esc_html__( 'The registration ID for this request is: %s', 'event_espresso' ),
118
+				esc_html__('The registration ID for this request is: %s', 'event_espresso'),
119 119
 				$registration->ID()
120 120
 			);
121
-			throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" );
121
+			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
122 122
 		}
123 123
 
124
-		switch ( $shortcode ) {
124
+		switch ($shortcode) {
125 125
 
126 126
 			case '[FNAME]' :
127 127
 				return $attendee->fname();
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 3 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 	protected static $_event = NULL;
36 36
 
37 37
 	/**
38
-	* array of datetimes and the spaces available for them
39
-	*
40
-	* @access private
41
-	* @var array
42
-	*/
38
+	 * array of datetimes and the spaces available for them
39
+	 *
40
+	 * @access private
41
+	 * @var array
42
+	 */
43 43
 	private static $_available_spaces = array();
44 44
 
45 45
 	/**
46
-	* max attendees that can register for event at one time
47
-	*
48
-	* @access private
49
-	* @var int
50
-	*/
46
+	 * max attendees that can register for event at one time
47
+	 *
48
+	 * @access private
49
+	 * @var int
50
+	 */
51 51
 	private static $_max_atndz = EE_INF;
52 52
 
53 53
 
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
 				return $permalink_string;
217 217
 			}
218 218
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
219
-			                     . __( 'Embed', 'event_espresso' )
220
-			                     . '</a> ';
219
+								 . __( 'Embed', 'event_espresso' )
220
+								 . '</a> ';
221 221
 			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
222 222
 			$iframe_string = esc_html(
223 223
 				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 * 	@return array|boolean
528 528
 	 */
529 529
 	public function process_ticket_selections() {
530
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
530
+		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
531 531
 		// check nonce
532 532
 		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) {
533 533
 			EE_Error::add_error(
@@ -921,11 +921,11 @@  discard block
 block discarded – undo
921 921
 
922 922
 
923 923
 	/**
924
-	* 	load js
925
-	*
926
-	* 	@access 		public
927
-	* 	@return 		void
928
-	*/
924
+	 * 	load js
925
+	 *
926
+	 * 	@access 		public
927
+	 * 	@return 		void
928
+	 */
929 929
 	public static function load_tckt_slctr_assets() {
930 930
 		// add some style
931 931
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
Please login to merge, or discard this patch.
Spacing   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
 	 * @return EED_Ticket_Selector
66 66
 	 */
67 67
 	public static function instance() {
68
-		return parent::get_instance( __CLASS__ );
68
+		return parent::get_instance(__CLASS__);
69 69
 	}
70 70
 
71 71
 
72 72
 
73
-	protected function set_config(){
74
-		$this->set_config_section( 'template_settings' );
75
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
76
-		$this->set_config_name( 'EED_Ticket_Selector' );
73
+	protected function set_config() {
74
+		$this->set_config_section('template_settings');
75
+		$this->set_config_class('EE_Ticket_Selector_Config');
76
+		$this->set_config_name('EED_Ticket_Selector');
77 77
 	}
78 78
 
79 79
 
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public static function set_hooks() {
90 90
 		// routing
91
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
92
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
93
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
91
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
92
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
93
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
94 94
 		//add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 );
95
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
95
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
96 96
 		//add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 );
97 97
 		//add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 );
98
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
98
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
99 99
 	}
100 100
 
101 101
 
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 	 *  @return 	void
108 108
 	 */
109 109
 	public static function set_hooks_admin() {
110
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
110
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
111 111
 		//add button for iframe code to event editor.
112
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
113
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
112
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
113
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
114 114
 	}
115 115
 
116 116
 
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
 	 *  @return 	void
123 123
 	 */
124 124
 	public static function set_definitions() {
125
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
126
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
125
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
126
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
127 127
 
128 128
 		//if config is not set, initialize
129 129
 		//If config is not set, set it.
130
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
130
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
131 131
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
132 132
 		}
133
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
133
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
134 134
 	}
135 135
 
136 136
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * 	@param	object 			$WP
142 142
 	 * 	@return 	void
143 143
 	 */
144
-	public function run( $WP ) {}
144
+	public function run($WP) {}
145 145
 
146 146
 
147 147
 	/**
@@ -153,23 +153,23 @@  discard block
 block discarded – undo
153 153
 	public function ticket_selector_iframe() {
154 154
 		self::$_in_iframe = true;
155 155
 		/** @type EEM_Event $EEM_Event */
156
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
156
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
157 157
 		$event = $EEM_Event->get_one_by_ID(
158
-			EE_Registry::instance()->REQ->get( 'event', 0 )
158
+			EE_Registry::instance()->REQ->get('event', 0)
159 159
 		);
160
-		EE_Registry::instance()->REQ->set_espresso_page( true );
161
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
160
+		EE_Registry::instance()->REQ->set_espresso_page(true);
161
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
162 162
 		$template_args['css'] = apply_filters(
163 163
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
164 164
 			array(
165
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
166
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
167
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
168
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
165
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
166
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
167
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
168
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
169 169
 			)
170 170
 		);
171
-		EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true;
172
-		EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' );
171
+		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
172
+		EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso');
173 173
 		$template_args['eei18n'] = apply_filters(
174 174
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings',
175 175
 			EE_Registry::localize_i18n_js_strings()
@@ -177,18 +177,18 @@  discard block
 block discarded – undo
177 177
 		$template_args['js'] = apply_filters(
178 178
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
179 179
 			array(
180
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
181
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
182
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
180
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
181
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
182
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
183 183
 			)
184 184
 		);
185
-		$template_args[ 'notices' ] = EEH_Template::display_template(
186
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
185
+		$template_args['notices'] = EEH_Template::display_template(
186
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
187 187
 			array(),
188 188
 			true
189 189
 		);
190 190
 		EEH_Template::display_template(
191
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
191
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
192 192
 			$template_args
193 193
 		);
194 194
 		exit;
@@ -207,25 +207,25 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return string The new html string for the permalink area.
209 209
 	 */
210
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
210
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
211 211
 		//make sure this is ONLY when editing and the event id has been set.
212
-		if ( ! empty( $id ) ) {
213
-			$post = get_post( $id );
212
+		if ( ! empty($id)) {
213
+			$post = get_post($id);
214 214
 			//if NOT event then let's get out.
215
-			if ( $post->post_type !== 'espresso_events' ) {
215
+			if ($post->post_type !== 'espresso_events') {
216 216
 				return $permalink_string;
217 217
 			}
218 218
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
219
-			                     . __( 'Embed', 'event_espresso' )
219
+			                     . __('Embed', 'event_espresso')
220 220
 			                     . '</a> ';
221
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
221
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
222 222
 			$iframe_string = esc_html(
223
-				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
223
+				'<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>'
224 224
 			);
225 225
 			$permalink_string .= '
226 226
 <div id="js-ts-iframe" style="display:none">
227 227
 	<div style="width:100%; height: 500px;">
228
-		' . $iframe_string . '
228
+		' . $iframe_string.'
229 229
 	</div>
230 230
 </div>';
231 231
 		}
@@ -244,22 +244,22 @@  discard block
 block discarded – undo
244 244
 	 * @param 	mixed $event
245 245
 	 * @return 	bool
246 246
 	 */
247
-	protected static function set_event( $event = null ) {
248
-		if( $event === null ) {
247
+	protected static function set_event($event = null) {
248
+		if ($event === null) {
249 249
 			global $post;
250 250
 			$event = $post;
251 251
 		}
252
-		if ( $event instanceof EE_Event ) {
252
+		if ($event instanceof EE_Event) {
253 253
 			self::$_event = $event;
254
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
254
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
255 255
 			self::$_event = $event->EE_Event;
256
-		} else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) {
257
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
256
+		} else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') {
257
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
258 258
 			self::$_event = $event->EE_Event;
259 259
 		} else {
260
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
261
-			$dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' );
262
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
260
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
261
+			$dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso');
262
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
263 263
 			return false;
264 264
 		}
265 265
 		return true;
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 	 * @param 	bool 	$view_details
279 279
 	 * @return 	string
280 280
 	 */
281
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
281
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
282 282
 		// reset filter for displaying submit button
283
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
283
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
284 284
 		// poke and prod incoming event till it tells us what it is
285
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
285
+		if ( ! EED_Ticket_Selector::set_event($event)) {
286 286
 			return false;
287 287
 		}
288 288
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 			&& (
294 294
 				! self::$_event->display_ticket_selector()
295 295
 				|| $view_details
296
-				|| post_password_required( $event_post )
296
+				|| post_password_required($event_post)
297 297
 				|| (
298 298
 					$_event_active_status != EE_Datetime::active
299 299
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -311,34 +311,34 @@  discard block
 block discarded – undo
311 311
 		$template_args = array();
312 312
 		$template_args['event_status'] = $_event_active_status;
313 313
 
314
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
315
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
314
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
315
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
316 316
 
317 317
 		$template_args['EVT_ID'] = self::$_event->ID();
318 318
 		$template_args['event'] = self::$_event;
319 319
 
320 320
 		// is the event expired ?
321 321
 		$template_args['event_is_expired'] = self::$_event->is_expired();
322
-		if ( $template_args['event_is_expired'] ) {
323
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>';
322
+		if ($template_args['event_is_expired']) {
323
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>';
324 324
 		}
325 325
 
326 326
 		$ticket_query_args = array(
327
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
328
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
327
+			array('Datetime.EVT_ID' => self::$_event->ID()),
328
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
329 329
 		);
330 330
 
331
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
331
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
332 332
 			//use the correct applicable time query depending on what version of core is being run.
333
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
334
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
333
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
334
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
335 335
 		}
336 336
 
337 337
 		// get all tickets for this event ordered by the datetime
338
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
338
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
339 339
 
340
-		if ( count( $template_args['tickets'] ) < 1 ) {
341
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
340
+		if (count($template_args['tickets']) < 1) {
341
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
342 342
 		}
343 343
 
344 344
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
@@ -347,36 +347,36 @@  discard block
 block discarded – undo
347 347
 			self::$_event->additional_limit()
348 348
 		);
349 349
 		$template_args['max_atndz'] = \EED_Ticket_Selector::$_max_atndz;
350
-		if ( $template_args['max_atndz'] < 1 ) {
351
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
352
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
353
-				$sales_closed_msg .=  sprintf(
354
-					__( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ),
350
+		if ($template_args['max_atndz'] < 1) {
351
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
352
+			if (current_user_can('edit_post', self::$_event->ID())) {
353
+				$sales_closed_msg .= sprintf(
354
+					__('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'),
355 355
 					'<div class="ee-attention" style="text-align: left;"><b>',
356 356
 					'</b><br />',
357
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
357
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
358 358
 					'</a></span></div>'
359 359
 				);
360 360
 			}
361
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
361
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
362 362
 		}
363 363
 
364
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
365
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
364
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
365
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
366 366
 
367 367
 		// redirecting to another site for registration ??
368 368
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
369 369
 		// set up the form (but not for the admin)
370
-		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : '';
370
+		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : '';
371 371
 		// if not redirecting to another site for registration
372
-		if ( ! $external_url ) {
372
+		if ( ! $external_url) {
373 373
 			// then display the ticket selector
374
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
374
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
375 375
 		} else {
376 376
 			// if not we still need to trigger the display of the submit button
377
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
377
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
378 378
 			//display notice to admin that registration is external
379
-			$ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
379
+			$ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
380 380
 		}
381 381
 		// submit button and form close tag
382 382
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -396,25 +396,25 @@  discard block
 block discarded – undo
396 396
 	 * @param 		string $external_url
397 397
 	 * @return 		string
398 398
 	 */
399
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
399
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
400 400
 		// if redirecting, we don't need any anything else
401
-		if ( $external_url ) {
402
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
403
-			$query_args = EEH_URL::get_query_string( $external_url );
404
-			foreach ( $query_args as $query_arg => $value ) {
405
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
401
+		if ($external_url) {
402
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
403
+			$query_args = EEH_URL::get_query_string($external_url);
404
+			foreach ($query_args as $query_arg => $value) {
405
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
406 406
 			}
407 407
 			return $html;
408 408
 		}
409
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
410
-		if ( ! $checkout_url ) {
411
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
409
+		$checkout_url = EEH_Event_View::event_link_url($ID);
410
+		if ( ! $checkout_url) {
411
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
412 412
 		}
413 413
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
414
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
415
-		$html .= wp_nonce_field( 	'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE );
414
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
415
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE);
416 416
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
417
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
417
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
418 418
 		return $html;
419 419
 	}
420 420
 
@@ -429,18 +429,18 @@  discard block
 block discarded – undo
429 429
 	 * 	@return		string
430 430
 	 */
431 431
 	public static function display_ticket_selector_submit() {
432
-		if ( ! is_admin() ) {
433
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) {
432
+		if ( ! is_admin()) {
433
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) {
434 434
 				$btn_text = apply_filters(
435 435
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
436
-					__('Register Now', 'event_espresso' ),
436
+					__('Register Now', 'event_espresso'),
437 437
 					EED_Ticket_Selector::$_event
438 438
 				);
439 439
 				$external_url = EED_Ticket_Selector::$_event->external_url();
440
-				$html = '<input id="ticket-selector-submit-'. EED_Ticket_Selector::$_event->ID() .'-btn"';
440
+				$html = '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"';
441 441
 				$html .= ' class="ticket-selector-submit-btn ';
442
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
443
-				$html .= ' type="submit" value="' . $btn_text . '" />';
442
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
443
+				$html .= ' type="submit" value="'.$btn_text.'" />';
444 444
 				$html .= apply_filters(
445 445
 					'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
446 446
 					'',
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 				);
449 449
 				$html .= '<div class="clear"><br/></div></form>';
450 450
 				return $html;
451
-			} else if ( is_archive() ) {
452
-				return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn();
451
+			} else if (is_archive()) {
452
+				return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn();
453 453
 			} else if (
454 454
 				EED_Ticket_Selector::$_event instanceof EE_Event
455 455
 				// if $_max_atndz === 1 (ie: a "Dude Where's my Ticket Selector?" type event)
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 				$html = apply_filters(
462 462
 					'FHEE__EE_Ticket_Selector__no_ticket_selector_submit',
463 463
 					sprintf(
464
-						__( '%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso' ),
464
+						__('%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso'),
465 465
 						'<p class="no-ticket-selector-msg important-notice">',
466 466
 						EED_Ticket_Selector::$_event->name(),
467 467
 						'</p>'
@@ -503,13 +503,13 @@  discard block
 block discarded – undo
503 503
 	 * 	@return		string
504 504
 	 */
505 505
 	public static function display_view_details_btn() {
506
-		if ( ! self::$_event->get_permalink() ) {
507
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
506
+		if ( ! self::$_event->get_permalink()) {
507
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
508 508
 		}
509
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
510
-		$btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event );
511
-		$view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />';
512
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
509
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
510
+		$btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event);
511
+		$view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />';
512
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
513 513
 		$view_details_btn .= '<div class="clear"><br/></div>';
514 514
 		$view_details_btn .= '</form>';
515 515
 		return $view_details_btn;
@@ -527,11 +527,11 @@  discard block
 block discarded – undo
527 527
 	 * 	@return array|boolean
528 528
 	 */
529 529
 	public function process_ticket_selections() {
530
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
530
+        do_action('EED_Ticket_Selector__process_ticket_selections__before');
531 531
 		// check nonce
532
-		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) {
532
+		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) {
533 533
 			EE_Error::add_error(
534
-				sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
534
+				sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
535 535
 				__FILE__, __FUNCTION__, __LINE__
536 536
 			);
537 537
 			return FALSE;
@@ -545,16 +545,16 @@  discard block
 block discarded – undo
545 545
 
546 546
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
547 547
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
548
-		EE_Registry::instance()->load_core( 'Session' );
548
+		EE_Registry::instance()->load_core('Session');
549 549
 		// unless otherwise requested, clear the session
550
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
551
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
550
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
551
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
552 552
 		}
553 553
 		//d( EE_Registry::instance()->SSN );
554 554
 
555
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
555
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
556 556
 		// do we have an event id?
557
-		if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
557
+		if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
558 558
 			// validate/sanitize data
559 559
 			$valid = self::_validate_post_data();
560 560
 
@@ -564,41 +564,41 @@  discard block
 block discarded – undo
564 564
 			//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
565 565
 
566 566
 			//check total tickets ordered vs max number of attendees that can register
567
-			if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
567
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
568 568
 
569 569
 				// ordering too many tickets !!!
570 570
 				$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
571
-				$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
571
+				$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
572 572
 				// dev only message
573 573
 				$max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso');
574
-				$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
575
-				EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
574
+				$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
575
+				EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
576 576
 			} else {
577 577
 
578 578
 				// all data appears to be valid
579 579
 				$tckts_slctd = FALSE;
580 580
 				$success = TRUE;
581 581
 				// load cart
582
-				EE_Registry::instance()->load_core( 'Cart' );
582
+				EE_Registry::instance()->load_core('Cart');
583 583
 
584 584
 				// cycle thru the number of data rows sent from the event listing
585
-				for ( $x = 0; $x < $valid['rows']; $x++ ) {
585
+				for ($x = 0; $x < $valid['rows']; $x++) {
586 586
 					// does this row actually contain a ticket quantity?
587
-					if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
587
+					if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
588 588
 						// YES we have a ticket quantity
589 589
 						$tckts_slctd = TRUE;
590 590
 						//						d( $valid['ticket_obj'][$x] );
591
-						if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
591
+						if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
592 592
 							// then add ticket to cart
593
-							$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
593
+							$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
594 594
 							$success = ! $ticket_added ? FALSE : $success;
595
-							if ( EE_Error::has_error() ) {
595
+							if (EE_Error::has_error()) {
596 596
 								break;
597 597
 							}
598 598
 						} else {
599 599
 							// nothing added to cart retrieved
600 600
 							EE_Error::add_error(
601
-								sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
601
+								sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
602 602
 								__FILE__, __FUNCTION__, __LINE__
603 603
 							);
604 604
 						}
@@ -607,45 +607,45 @@  discard block
 block discarded – undo
607 607
 				//d( EE_Registry::instance()->CART );
608 608
 				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
609 609
 
610
-				if ( $tckts_slctd ) {
611
-					if ( $success ) {
612
-						do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
610
+				if ($tckts_slctd) {
611
+					if ($success) {
612
+						do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
613 613
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
614
-						EE_Registry::instance()->CART->save_cart( FALSE );
614
+						EE_Registry::instance()->CART->save_cart(FALSE);
615 615
 						EE_Registry::instance()->SSN->update();
616 616
 						//d( EE_Registry::instance()->CART );
617 617
 						//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
618 618
 						// just return TRUE for registrations being made from admin
619
-						if ( is_admin() ) {
619
+						if (is_admin()) {
620 620
 							return TRUE;
621 621
 						}
622
-						wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
622
+						wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
623 623
 						exit();
624 624
 
625 625
 					} else {
626
-						if ( ! EE_Error::has_error() ) {
626
+						if ( ! EE_Error::has_error()) {
627 627
 							// nothing added to cart
628
-							EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
628
+							EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
629 629
 						}
630 630
 					}
631 631
 
632 632
 				} else {
633 633
 					// no ticket quantities were selected
634
-					EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
634
+					EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
635 635
 				}
636 636
 			}
637 637
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
638 638
 			// at this point, just return if registration is being made from admin
639
-			if ( is_admin() ) {
639
+			if (is_admin()) {
640 640
 				return FALSE;
641 641
 			}
642
-			if ( $valid['return_url'] ) {
643
-				EE_Error::get_notices( FALSE, TRUE );
644
-				wp_safe_redirect( $valid['return_url'] );
642
+			if ($valid['return_url']) {
643
+				EE_Error::get_notices(FALSE, TRUE);
644
+				wp_safe_redirect($valid['return_url']);
645 645
 				exit();
646
-			} elseif ( isset( $event_to_add['id'] )) {
647
-				EE_Error::get_notices( FALSE, TRUE );
648
-				wp_safe_redirect( get_permalink( $event_to_add['id'] ));
646
+			} elseif (isset($event_to_add['id'])) {
647
+				EE_Error::get_notices(FALSE, TRUE);
648
+				wp_safe_redirect(get_permalink($event_to_add['id']));
649 649
 				exit();
650 650
 			} else {
651 651
 				echo EE_Error::get_notices();
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 		} else {
655 655
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
656 656
 			EE_Error::add_error(
657
-				sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
657
+				sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
658 658
 				__FILE__, __FUNCTION__, __LINE__
659 659
 			);
660 660
 		}
@@ -672,18 +672,18 @@  discard block
 block discarded – undo
672 672
 	 * @return        array  or FALSE
673 673
 	 */
674 674
 	private static function _validate_post_data() {
675
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
675
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
676 676
 
677 677
 		// start with an empty array()
678 678
 		$valid_data = array();
679 679
 		//		d( $_POST );
680 680
 		//if event id is valid
681
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ));
682
-		if ( $id ) {
681
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
682
+		if ($id) {
683 683
 			// grab valid id
684 684
 			$valid_data['id'] = $id;
685 685
 			// grab and sanitize return-url
686
-			$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
686
+			$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
687 687
 			// array of other form names
688 688
 			$inputs_to_clean = array(
689 689
 				'event_id' => 'tkt-slctr-event-id',
@@ -696,22 +696,22 @@  discard block
 block discarded – undo
696 696
 			// let's track the total number of tickets ordered.'
697 697
 			$valid_data['total_tickets'] = 0;
698 698
 			// cycle through $inputs_to_clean array
699
-			foreach ( $inputs_to_clean as $what => $input_to_clean ) {
699
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
700 700
 				// check for POST data
701
-				if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
701
+				if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
702 702
 					// grab value
703
-					$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
703
+					$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
704 704
 					switch ($what) {
705 705
 
706 706
 						// integers
707 707
 						case 'event_id':
708
-							$valid_data[$what] = absint( $input_value );
708
+							$valid_data[$what] = absint($input_value);
709 709
 							// get event via the event id we put in the form
710
-							$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
710
+							$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
711 711
 							break;
712 712
 						case 'rows':
713 713
 						case 'max_atndz':
714
-							$valid_data[$what] = absint( $input_value );
714
+							$valid_data[$what] = absint($input_value);
715 715
 							break;
716 716
 
717 717
 						// arrays of integers
@@ -719,27 +719,27 @@  discard block
 block discarded – undo
719 719
 							//							d( $input_value );
720 720
 							$row_qty = $input_value;
721 721
 							// if qty is coming from a radio button input, then we need to assemble an array of rows
722
-							if( ! is_array( $row_qty )) {
722
+							if ( ! is_array($row_qty)) {
723 723
 								// get number of rows
724
-								$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
724
+								$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
725 725
 								//								d( $rows );
726 726
 								// explode ints by the dash
727
-								$row_qty = explode( '-', $row_qty );
728
-								$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
729
-								$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
730
-								$row_qty = array( $row => $qty );
727
+								$row_qty = explode('-', $row_qty);
728
+								$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
729
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
730
+								$row_qty = array($row => $qty);
731 731
 								//								 d( $row_qty );
732
-								for( $x = 1; $x <= $rows; $x++ ) {
733
-									if ( ! isset( $row_qty[$x] )) {
732
+								for ($x = 1; $x <= $rows; $x++) {
733
+									if ( ! isset($row_qty[$x])) {
734 734
 										$row_qty[$x] = 0;
735 735
 									}
736 736
 								}
737 737
 							}
738
-							ksort( $row_qty );
738
+							ksort($row_qty);
739 739
 							//							 d( $row_qty );
740 740
 							// cycle thru values
741
-							foreach ( $row_qty as $qty ) {
742
-								$qty = absint( $qty );
741
+							foreach ($row_qty as $qty) {
742
+								$qty = absint($qty);
743 743
 								// sanitize as integers
744 744
 								$valid_data[$what][] = $qty;
745 745
 								$valid_data['total_tickets'] += $qty;
@@ -750,19 +750,19 @@  discard block
 block discarded – undo
750 750
 						case 'ticket_id':
751 751
 							$value_array = array();
752 752
 							// cycle thru values
753
-							foreach ( $input_value as $key=>$value ) {
753
+							foreach ($input_value as $key=>$value) {
754 754
 								// allow only numbers, letters,  spaces, commas and dashes
755
-								$value_array[ $key ] = wp_strip_all_tags( $value );
755
+								$value_array[$key] = wp_strip_all_tags($value);
756 756
 								// get ticket via the ticket id we put in the form
757
-								$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
758
-								$valid_data['ticket_obj'][ $key ] = $ticket_obj;
757
+								$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
758
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
759 759
 							}
760
-							$valid_data[ $what ] = $value_array;
760
+							$valid_data[$what] = $value_array;
761 761
 							break;
762 762
 
763 763
 						case 'return_url' :
764 764
 							// grab and sanitize return-url
765
-							$valid_data[$what] = esc_url_raw( $input_value );
765
+							$valid_data[$what] = esc_url_raw($input_value);
766 766
 							break;
767 767
 
768 768
 					} 	// end switch $what
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 			} 	// end foreach $inputs_to_clean
771 771
 
772 772
 		} else {
773
-			EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
773
+			EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
774 774
 			return FALSE;
775 775
 		}
776 776
 
@@ -788,28 +788,28 @@  discard block
 block discarded – undo
788 788
 	 * @param int       $qty
789 789
 	 * @return TRUE on success, FALSE on fail
790 790
 	 */
791
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
792
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
791
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
792
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
793 793
 		// get the number of spaces left for this datetime ticket
794
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
794
+		$available_spaces = self::_ticket_datetime_availability($ticket);
795 795
 		// compare available spaces against the number of tickets being purchased
796
-		if ( $available_spaces >= $qty ) {
796
+		if ($available_spaces >= $qty) {
797 797
 			// allow addons to prevent a ticket from being added to cart
798
-			if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) {
798
+			if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) {
799 799
 				return false;
800 800
 			}
801 801
 			// add event to cart
802
-			if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
803
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
802
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
803
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
804 804
 				return true;
805 805
 			} else {
806 806
 				return false;
807 807
 			}
808 808
 		} else {
809 809
 			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
810
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
810
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
811 811
 			// greedy greedy greedy eh?
812
-			if ( $available_spaces > 0 ) {
812
+			if ($available_spaces > 0) {
813 813
 				// add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces
814 814
 				EE_Error::add_error(
815 815
 					sprintf(
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 					__FILE__, __FUNCTION__, __LINE__
826 826
 				);
827 827
 			} else {
828
-				EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
828
+				EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
829 829
 			}
830 830
 			return false;
831 831
 		}
@@ -843,22 +843,22 @@  discard block
 block discarded – undo
843 843
 	 * @param 	bool         $get_original_ticket_spaces
844 844
 	 * @return 	int
845 845
 	 */
846
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
846
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
847 847
 		// if the $_available_spaces array has not been set up yet...
848
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
849
-				self::_set_initial_ticket_datetime_availability( $ticket );
848
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
849
+				self::_set_initial_ticket_datetime_availability($ticket);
850 850
 		}
851 851
 		$available_spaces = $ticket->qty() - $ticket->sold();
852
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
852
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
853 853
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
854
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
854
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
855 855
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
856
-				if ( $get_original_ticket_spaces ) {
856
+				if ($get_original_ticket_spaces) {
857 857
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
858
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
858
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
859 859
 				} else {
860 860
 					// we want the updated ticket availability as stored in the "datetimes" array
861
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
861
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
862 862
 				}
863 863
 			}
864 864
 		}
@@ -874,23 +874,23 @@  discard block
 block discarded – undo
874 874
 	 * @param 	EE_Ticket $ticket
875 875
 	 * @return 	int
876 876
 	 */
877
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
877
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
878 878
 		// first, get all of the datetimes that are available to this ticket
879 879
 		$datetimes = $ticket->get_many_related(
880 880
 			'Datetime',
881
-			array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ))
881
+			array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC'))
882 882
 		);
883
-		if ( ! empty( $datetimes )) {
883
+		if ( ! empty($datetimes)) {
884 884
 			// now loop thru all of the datetimes
885
-			foreach ( $datetimes as $datetime  ) {
886
-				if ( $datetime instanceof EE_Datetime ) {
885
+			foreach ($datetimes as $datetime) {
886
+				if ($datetime instanceof EE_Datetime) {
887 887
 					// the number of spaces available for the datetime without considering individual ticket quantities
888 888
 					$spaces_remaining = $datetime->spaces_remaining();
889 889
 					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
890
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
890
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
891 891
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
892 892
 					// else just take the datetime spaces remaining, and assign to the datetimes array
893
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
893
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
894 894
 				}
895 895
 			}
896 896
 		}
@@ -906,12 +906,12 @@  discard block
 block discarded – undo
906 906
 	 * @param 	int   $qty
907 907
 	 * @return 	int
908 908
 	 */
909
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
910
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
909
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
910
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
911 911
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
912
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
912
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
913 913
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
914
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
914
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
915 915
 			}
916 916
 		}
917 917
 	}
@@ -928,8 +928,8 @@  discard block
 block discarded – undo
928 928
 	*/
929 929
 	public static function load_tckt_slctr_assets() {
930 930
 		// add some style
931
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
932
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
931
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
932
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
933 933
 			wp_enqueue_style('ticket_selector');
934 934
 			// make it dance
935 935
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -943,9 +943,9 @@  discard block
 block discarded – undo
943 943
 
944 944
 	public static function load_tckt_slctr_assets_admin() {
945 945
 		//iframe button js on admin event editor page
946
-		if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) {
947
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
948
-			wp_enqueue_script( 'ticket_selector_embed' );
946
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') {
947
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
948
+			wp_enqueue_script('ticket_selector_embed');
949 949
 		}
950 950
 	}
951 951
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.