Completed
Branch FET-9856-direct-instantiation (a39e7f)
by
unknown
50:47 queued 37:40
created
core/db_classes/EE_Datetime.class.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 *        get event start date.  Provide either the date format, or NULL to re-use the
288 288
 	 * last-used format, or '' to use the default date format
289 289
 	 *
290
-	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
290
+	 * @param string $dt_frmt - string representation of date format defaults to 'F j, Y'
291 291
 	 * @return        mixed        string on success, FALSE on fail
292 292
 	 */
293 293
 	public function start_date( $dt_frmt = NULL ) {
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 *        get end date. Provide either the date format, or NULL to re-use the
311 311
 	 * last-used format, or '' to use the default date format
312 312
 	 *
313
-	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
313
+	 * @param string $dt_frmt - string representation of date format defaults to 'F j, Y'
314 314
 	 * @return        mixed        string on success, FALSE on fail
315 315
 	 */
316 316
 	public function end_date( $dt_frmt = NULL ) {
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	 * @param string $dt_frmt     - string representation of date format defaults to WP settings
337 337
 	 * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with
338 338
 	 *                            the end date ie: Jan 01 "to" Dec 31
339
-	 * @return mixed        string on success, FALSE on fail
339
+	 * @return string        string on success, FALSE on fail
340 340
 	 * @throws \EE_Error
341 341
 	 */
342 342
 	public function date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	 * @param string $tm_format   string representation of time format defaults to 'g:i a'
409 409
 	 * @param string $conjunction conjunction junction what's your function ?
410 410
 	 *                            this string joins the start date with the end date ie: Jan 01 "to" Dec 31
411
-	 * @return mixed              string on success, FALSE on fail
411
+	 * @return string              string on success, FALSE on fail
412 412
 	 * @throws \EE_Error
413 413
 	 */
414 414
 	public function time_range( $tm_format = null, $conjunction = ' - ' ) {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -456,14 +456,14 @@
 block discarded – undo
456 456
 			//start and end date are the same but times are different
457 457
 			case ( $this->start_date() === $this->end_date() ) :
458 458
 				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format )
459
-				          . $conjunction
460
-				          . $this->get_i18n_datetime( 'DTT_EVT_end', $tm_format );
459
+						  . $conjunction
460
+						  . $this->get_i18n_datetime( 'DTT_EVT_end', $tm_format );
461 461
 				break;
462 462
 			//all other conditions
463 463
 			default :
464 464
 				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format )
465
-				          . $conjunction
466
-				          . $this->get_i18n_datetime( 'DTT_EVT_end', $full_format );
465
+						  . $conjunction
466
+						  . $this->get_i18n_datetime( 'DTT_EVT_end', $full_format );
467 467
 				break;
468 468
 		}
469 469
 		return $output;
Please login to merge, or discard this patch.
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	/**
69 69
 	 * @param $name
70 70
 	 */
71
-	public function set_name( $name ) {
72
-		$this->set( 'DTT_name', $name );
71
+	public function set_name($name) {
72
+		$this->set('DTT_name', $name);
73 73
 	}
74 74
 
75 75
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	/**
78 78
 	 * @param $description
79 79
 	 */
80
-	public function set_description( $description ) {
81
-		$this->set( 'DTT_description', $description );
80
+	public function set_description($description) {
81
+		$this->set('DTT_description', $description);
82 82
 	}
83 83
 
84 84
 
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
92 92
 	 */
93
-	public function set_start_date( $date ) {
94
-		$this->_set_date_for( $date, 'DTT_EVT_start' );
93
+	public function set_start_date($date) {
94
+		$this->_set_date_for($date, 'DTT_EVT_start');
95 95
 	}
96 96
 
97 97
 
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
105 105
 	 */
106
-	public function set_start_time( $time ) {
107
-		$this->_set_time_for( $time, 'DTT_EVT_start' );
106
+	public function set_start_time($time) {
107
+		$this->_set_time_for($time, 'DTT_EVT_start');
108 108
 	}
109 109
 
110 110
 
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
118 118
 	 */
119
-	public function set_end_date( $date ) {
120
-		$this->_set_date_for( $date, 'DTT_EVT_end' );
119
+	public function set_end_date($date) {
120
+		$this->_set_date_for($date, 'DTT_EVT_end');
121 121
 	}
122 122
 
123 123
 
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
131 131
 	 */
132
-	public function set_end_time( $time ) {
133
-		$this->_set_time_for( $time, 'DTT_EVT_end' );
132
+	public function set_end_time($time) {
133
+		$this->_set_time_for($time, 'DTT_EVT_end');
134 134
 	}
135 135
 
136 136
 
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @param        int $reg_limit
144 144
 	 */
145
-	public function set_reg_limit( $reg_limit ) {
146
-		$this->set( 'DTT_reg_limit', $reg_limit );
145
+	public function set_reg_limit($reg_limit) {
146
+		$this->set('DTT_reg_limit', $reg_limit);
147 147
 	}
148 148
 
149 149
 
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 	 *
154 154
 	 * @param        int $sold
155 155
 	 */
156
-	public function set_sold( $sold ) {
156
+	public function set_sold($sold) {
157 157
 		// sold can not go below zero
158
-		$sold = max( 0, $sold );
159
-		$this->set( 'DTT_sold', $sold );
158
+		$sold = max(0, $sold);
159
+		$this->set('DTT_sold', $sold);
160 160
 	}
161 161
 
162 162
 
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 * increments sold by amount passed by $qty
166 166
 	 * @param int $qty
167 167
 	 */
168
-	public function increase_sold( $qty = 1 ) {
168
+	public function increase_sold($qty = 1) {
169 169
 		$sold = $this->sold() + $qty;
170
-		$this->set_sold( $sold );
170
+		$this->set_sold($sold);
171 171
 	}
172 172
 
173 173
 
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 	 * decrements (subtracts) sold amount passed by $qty
177 177
 	 * @param int $qty
178 178
 	 */
179
-	public function decrease_sold( $qty = 1 ) {
179
+	public function decrease_sold($qty = 1) {
180 180
 		$sold = $this->sold() - $qty;
181
-		$this->set_sold( $sold );
181
+		$this->set_sold($sold);
182 182
 	}
183 183
 
184 184
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 * @return string
189 189
 	 */
190 190
 	public function name() {
191
-		return $this->get( 'DTT_name' );
191
+		return $this->get('DTT_name');
192 192
 	}
193 193
 
194 194
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @return string
199 199
 	 */
200 200
 	public function description() {
201
-		return $this->get( 'DTT_description' );
201
+		return $this->get('DTT_description');
202 202
 	}
203 203
 
204 204
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 * @return boolean          TRUE if is primary, FALSE if not.
209 209
 	 */
210 210
 	public function is_primary() {
211
-		return $this->get( 'DTT_is_primary' );
211
+		return $this->get('DTT_is_primary');
212 212
 	}
213 213
 
214 214
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @return int         The order of the datetime for this event.
219 219
 	 */
220 220
 	public function order() {
221
-		return $this->get( 'DTT_order' );
221
+		return $this->get('DTT_order');
222 222
 	}
223 223
 
224 224
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 * @return int
229 229
 	 */
230 230
 	public function parent() {
231
-		return $this->get( 'DTT_parent' );
231
+		return $this->get('DTT_parent');
232 232
 	}
233 233
 
234 234
 
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
 	 * @param    bool   $echo         - whether we echo or return (note echoing uses "pretty" formats, otherwise we use the standard formats)
245 245
 	 * @return    string|bool|void  string on success, FALSE on fail
246 246
 	 */
247
-	private function _show_datetime( $date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE ) {
247
+	private function _show_datetime($date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE) {
248 248
 		$field_name = "DTT_EVT_{$start_or_end}";
249
-		$dtt = $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo );
250
-		if ( ! $echo ) {
249
+		$dtt = $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo);
250
+		if ( ! $echo) {
251 251
 			return $dtt;
252 252
 		}
253 253
 		return '';
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
263 263
 	 * @return        mixed        string on success, FALSE on fail
264 264
 	 */
265
-	public function start_date( $dt_frmt = NULL ) {
266
-		return $this->_show_datetime( 'D', 'start', $dt_frmt );
265
+	public function start_date($dt_frmt = NULL) {
266
+		return $this->_show_datetime('D', 'start', $dt_frmt);
267 267
 	}
268 268
 
269 269
 
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
 	 * Echoes start_date()
273 273
 	 * @param string $dt_frmt
274 274
 	 */
275
-	public function e_start_date( $dt_frmt = NULL ) {
276
-		$this->_show_datetime( 'D', 'start', $dt_frmt, NULL, TRUE );
275
+	public function e_start_date($dt_frmt = NULL) {
276
+		$this->_show_datetime('D', 'start', $dt_frmt, NULL, TRUE);
277 277
 	}
278 278
 
279 279
 
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
286 286
 	 * @return        mixed        string on success, FALSE on fail
287 287
 	 */
288
-	public function end_date( $dt_frmt = NULL ) {
289
-		return $this->_show_datetime( 'D', 'end', $dt_frmt );
288
+	public function end_date($dt_frmt = NULL) {
289
+		return $this->_show_datetime('D', 'end', $dt_frmt);
290 290
 	}
291 291
 
292 292
 
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 	 * Echoes the end date. See end_date()
296 296
 	 * @param string $dt_frmt
297 297
 	 */
298
-	public function e_end_date( $dt_frmt = NULL ) {
299
-		$this->_show_datetime( 'D', 'end', $dt_frmt, NULL, TRUE );
298
+	public function e_end_date($dt_frmt = NULL) {
299
+		$this->_show_datetime('D', 'end', $dt_frmt, NULL, TRUE);
300 300
 	}
301 301
 
302 302
 
@@ -311,11 +311,11 @@  discard block
 block discarded – undo
311 311
 	 * @return mixed        string on success, FALSE on fail
312 312
 	 * @throws \EE_Error
313 313
 	 */
314
-	public function date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
315
-		$dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : $this->_dt_frmt;
316
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $dt_frmt ) );
317
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end', $dt_frmt ) );
318
-		return $start !== $end ? $start . $conjunction . $end : $start;
314
+	public function date_range($dt_frmt = NULL, $conjunction = ' - ') {
315
+		$dt_frmt = ! empty($dt_frmt) ? $dt_frmt : $this->_dt_frmt;
316
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $dt_frmt));
317
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $dt_frmt));
318
+		return $start !== $end ? $start.$conjunction.$end : $start;
319 319
 	}
320 320
 
321 321
 
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 	 * @param string $conjunction
326 326
 	 * @throws \EE_Error
327 327
 	 */
328
-	public function e_date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
329
-		echo $this->date_range( $dt_frmt, $conjunction );
328
+	public function e_date_range($dt_frmt = NULL, $conjunction = ' - ') {
329
+		echo $this->date_range($dt_frmt, $conjunction);
330 330
 	}
331 331
 
332 332
 
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
338 338
 	 * @return        mixed        string on success, FALSE on fail
339 339
 	 */
340
-	public function start_time( $tm_format = NULL ) {
341
-		return $this->_show_datetime( 'T', 'start', NULL, $tm_format );
340
+	public function start_time($tm_format = NULL) {
341
+		return $this->_show_datetime('T', 'start', NULL, $tm_format);
342 342
 	}
343 343
 
344 344
 
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
 	/**
347 347
 	 * @param null $tm_format
348 348
 	 */
349
-	public function e_start_time( $tm_format = NULL ) {
350
-		$this->_show_datetime( 'T', 'start', NULL, $tm_format, TRUE );
349
+	public function e_start_time($tm_format = NULL) {
350
+		$this->_show_datetime('T', 'start', NULL, $tm_format, TRUE);
351 351
 	}
352 352
 
353 353
 
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
359 359
 	 * @return        mixed        string on success, FALSE on fail
360 360
 	 */
361
-	public function end_time( $tm_format = NULL ) {
362
-		return $this->_show_datetime( 'T', 'end', NULL, $tm_format );
361
+	public function end_time($tm_format = NULL) {
362
+		return $this->_show_datetime('T', 'end', NULL, $tm_format);
363 363
 	}
364 364
 
365 365
 
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	/**
368 368
 	 * @param null $tm_format
369 369
 	 */
370
-	public function e_end_time( $tm_format = NULL ) {
371
-		$this->_show_datetime( 'T', 'end', NULL, $tm_format, TRUE );
370
+	public function e_end_time($tm_format = NULL) {
371
+		$this->_show_datetime('T', 'end', NULL, $tm_format, TRUE);
372 372
 	}
373 373
 
374 374
 
@@ -383,11 +383,11 @@  discard block
 block discarded – undo
383 383
 	 * @return mixed              string on success, FALSE on fail
384 384
 	 * @throws \EE_Error
385 385
 	 */
386
-	public function time_range( $tm_format = null, $conjunction = ' - ' ) {
387
-		$tm_format = !empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
388
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $tm_format ) );
389
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end',  $tm_format ) );
390
-		return $start !== $end ? $start . $conjunction . $end : $start;
386
+	public function time_range($tm_format = null, $conjunction = ' - ') {
387
+		$tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt;
388
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $tm_format));
389
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $tm_format));
390
+		return $start !== $end ? $start.$conjunction.$end : $start;
391 391
 	}
392 392
 
393 393
 
@@ -397,8 +397,8 @@  discard block
 block discarded – undo
397 397
 	 * @param string $conjunction
398 398
 	 * @throws \EE_Error
399 399
 	 */
400
-	public function e_time_range( $tm_format = NULL, $conjunction = ' - ' ) {
401
-		echo $this->time_range( $tm_format, $conjunction );
400
+	public function e_time_range($tm_format = NULL, $conjunction = ' - ') {
401
+		echo $this->time_range($tm_format, $conjunction);
402 402
 	}
403 403
 
404 404
 
@@ -414,28 +414,28 @@  discard block
 block discarded – undo
414 414
 	 * @return string
415 415
 	 * @throws \EE_Error
416 416
 	 */
417
-	public function date_and_time_range( $dt_format = '', $tm_format = '', $conjunction = ' - '  ) {
418
-		$dt_format = ! empty( $dt_format ) ? $dt_format : $this->_dt_frmt;
419
-		$tm_format = ! empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
420
-		$full_format = $dt_format . ' ' . $tm_format;
417
+	public function date_and_time_range($dt_format = '', $tm_format = '', $conjunction = ' - ') {
418
+		$dt_format = ! empty($dt_format) ? $dt_format : $this->_dt_frmt;
419
+		$tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt;
420
+		$full_format = $dt_format.' '.$tm_format;
421 421
 
422 422
 		//the range output depends on various conditions
423
-		switch ( true ) {
423
+		switch (true) {
424 424
 			//start date timestamp and end date timestamp are the same.
425
-			case ( $this->get_raw( 'DTT_EVT_start' ) === $this->get_raw( 'DTT_EVT_end' ) ) :
426
-				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format );
425
+			case ($this->get_raw('DTT_EVT_start') === $this->get_raw('DTT_EVT_end')) :
426
+				$output = $this->get_i18n_datetime('DTT_EVT_start', $full_format);
427 427
 				break;
428 428
 			//start and end date are the same but times are different
429
-			case ( $this->start_date() === $this->end_date() ) :
430
-				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format )
429
+			case ($this->start_date() === $this->end_date()) :
430
+				$output = $this->get_i18n_datetime('DTT_EVT_start', $full_format)
431 431
 				          . $conjunction
432
-				          . $this->get_i18n_datetime( 'DTT_EVT_end', $tm_format );
432
+				          . $this->get_i18n_datetime('DTT_EVT_end', $tm_format);
433 433
 				break;
434 434
 			//all other conditions
435 435
 			default :
436
-				$output = $this->get_i18n_datetime( 'DTT_EVT_start', $full_format )
436
+				$output = $this->get_i18n_datetime('DTT_EVT_start', $full_format)
437 437
 				          . $conjunction
438
-				          . $this->get_i18n_datetime( 'DTT_EVT_end', $full_format );
438
+				          . $this->get_i18n_datetime('DTT_EVT_end', $full_format);
439 439
 				break;
440 440
 		}
441 441
 		return $output;
@@ -453,8 +453,8 @@  discard block
 block discarded – undo
453 453
 	 * @return void
454 454
 	 * @throws \EE_Error
455 455
 	 */
456
-	public function e_date_and_time_range( $dt_format = '', $tm_format = '', $conjunction = ' - ' ) {
457
-		echo $this->date_and_time_range( $dt_format, $tm_format, $conjunction );
456
+	public function e_date_and_time_range($dt_format = '', $tm_format = '', $conjunction = ' - ') {
457
+		echo $this->date_and_time_range($dt_format, $tm_format, $conjunction);
458 458
 	}
459 459
 
460 460
 
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 	 * @param 	string 	$tm_format - string representation of time format defaults to 'g:i a'
467 467
 	 * @return 	mixed 	string on success, FALSE on fail
468 468
 	 */
469
-	public function start_date_and_time( $dt_format = NULL, $tm_format = NULL ) {
470
-		return $this->_show_datetime( '', 'start', $dt_format, $tm_format );
469
+	public function start_date_and_time($dt_format = NULL, $tm_format = NULL) {
470
+		return $this->_show_datetime('', 'start', $dt_format, $tm_format);
471 471
 	}
472 472
 
473 473
 
@@ -476,8 +476,8 @@  discard block
 block discarded – undo
476 476
 	 * @param null $dt_frmt
477 477
 	 * @param null $tm_format
478 478
 	 */
479
-	public function e_start_date_and_time( $dt_frmt = NULL, $tm_format = NULL ) {
480
-		$this->_show_datetime( '', 'start', $dt_frmt, $tm_format, TRUE );
479
+	public function e_start_date_and_time($dt_frmt = NULL, $tm_format = NULL) {
480
+		$this->_show_datetime('', 'start', $dt_frmt, $tm_format, TRUE);
481 481
 	}
482 482
 
483 483
 
@@ -491,11 +491,11 @@  discard block
 block discarded – undo
491 491
 	 * @param bool   $round_up
492 492
 	 * @return float|int|mixed
493 493
 	 */
494
-	public function length( $units = 'seconds', $round_up = FALSE ) {
495
-		$start = $this->get_raw( 'DTT_EVT_start' );
496
-		$end = $this->get_raw( 'DTT_EVT_end' );
494
+	public function length($units = 'seconds', $round_up = FALSE) {
495
+		$start = $this->get_raw('DTT_EVT_start');
496
+		$end = $this->get_raw('DTT_EVT_end');
497 497
 		$length_in_units = $end - $start;
498
-		switch ( $units ) {
498
+		switch ($units) {
499 499
 			//NOTE: We purposefully don't use "break;" in order to chain the divisions
500 500
 			/** @noinspection PhpMissingBreakStatementInspection */
501 501
 			case 'days':
@@ -508,10 +508,10 @@  discard block
 block discarded – undo
508 508
 				$length_in_units /= 60;
509 509
 			case 'seconds':
510 510
 			default:
511
-				$length_in_units = ceil( $length_in_units );
511
+				$length_in_units = ceil($length_in_units);
512 512
 		}
513
-		if ( $round_up ) {
514
-			$length_in_units = max( $length_in_units, 1 );
513
+		if ($round_up) {
514
+			$length_in_units = max($length_in_units, 1);
515 515
 		}
516 516
 		return $length_in_units;
517 517
 	}
@@ -525,8 +525,8 @@  discard block
 block discarded – undo
525 525
 	 * @param bool | string 	$tm_format - string representation of time format defaults to 'g:i a'
526 526
 	 * @return 	mixed        		string on success, FALSE on fail
527 527
 	 */
528
-	public function end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
529
-		return $this->_show_datetime( '', 'end', $dt_frmt, $tm_format );
528
+	public function end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
529
+		return $this->_show_datetime('', 'end', $dt_frmt, $tm_format);
530 530
 	}
531 531
 
532 532
 
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
 	 * @param bool $dt_frmt
536 536
 	 * @param bool $tm_format
537 537
 	 */
538
-	public function e_end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
539
-		$this->_show_datetime( '', 'end', $dt_frmt, $tm_format, TRUE );
538
+	public function e_end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
539
+		$this->_show_datetime('', 'end', $dt_frmt, $tm_format, TRUE);
540 540
 	}
541 541
 
542 542
 
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	 * @return        int
548 548
 	 */
549 549
 	public function start() {
550
-		return $this->get_raw( 'DTT_EVT_start' );
550
+		return $this->get_raw('DTT_EVT_start');
551 551
 	}
552 552
 
553 553
 
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	 * @return        int
559 559
 	 */
560 560
 	public function end() {
561
-		return $this->get_raw( 'DTT_EVT_end' );
561
+		return $this->get_raw('DTT_EVT_end');
562 562
 	}
563 563
 
564 564
 
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 	 * @return        mixed        int on success, FALSE on fail
570 570
 	 */
571 571
 	public function reg_limit() {
572
-		return $this->get_raw( 'DTT_reg_limit' );
572
+		return $this->get_raw('DTT_reg_limit');
573 573
 	}
574 574
 
575 575
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 	 * @return        mixed        int on success, FALSE on fail
581 581
 	 */
582 582
 	public function sold() {
583
-		return $this->get_raw( 'DTT_sold' );
583
+		return $this->get_raw('DTT_sold');
584 584
 	}
585 585
 
586 586
 
@@ -608,15 +608,15 @@  discard block
 block discarded – undo
608 608
 	 * 																	the spaces remaining for this particular datetime, hence the flag.
609 609
 	 * @return 	int
610 610
 	 */
611
-	public function spaces_remaining( $consider_tickets = FALSE ) {
611
+	public function spaces_remaining($consider_tickets = FALSE) {
612 612
 		// tickets remaining available for purchase
613 613
 		//no need for special checks for infinite, because if DTT_reg_limit == EE_INF, then EE_INF - x = EE_INF
614 614
 		$dtt_remaining = $this->reg_limit() - $this->sold();
615
-		if ( ! $consider_tickets ) {
615
+		if ( ! $consider_tickets) {
616 616
 			return $dtt_remaining;
617 617
 		}
618 618
 		$tickets_remaining = $this->tickets_remaining();
619
-		return min( $dtt_remaining, $tickets_remaining );
619
+		return min($dtt_remaining, $tickets_remaining);
620 620
 	}
621 621
 
622 622
 
@@ -627,19 +627,19 @@  discard block
 block discarded – undo
627 627
 	 * @param array $query_params like EEM_Base::get_all's
628 628
 	 * @return int
629 629
 	 */
630
-	public function tickets_remaining( $query_params = array() ) {
630
+	public function tickets_remaining($query_params = array()) {
631 631
 		$sum = 0;
632
-		$tickets = $this->tickets( $query_params );
633
-		if ( ! empty( $tickets ) ) {
634
-			foreach ( $tickets as $ticket ) {
635
-				if ( $ticket instanceof EE_Ticket ) {
632
+		$tickets = $this->tickets($query_params);
633
+		if ( ! empty($tickets)) {
634
+			foreach ($tickets as $ticket) {
635
+				if ($ticket instanceof EE_Ticket) {
636 636
 					// get the actual amount of tickets that can be sold
637
-					$qty = $ticket->qty( 'saleable' );
638
-					if ( $qty === EE_INF ) {
637
+					$qty = $ticket->qty('saleable');
638
+					if ($qty === EE_INF) {
639 639
 						return EE_INF;
640 640
 					}
641 641
 					// no negative ticket quantities plz
642
-					if ( $qty > 0 ) {
642
+					if ($qty > 0) {
643 643
 						$sum += $qty;
644 644
 					}
645 645
 				}
@@ -656,8 +656,8 @@  discard block
 block discarded – undo
656 656
 	 * @param array $query_params like EEM_Base::get_all's
657 657
 	 * @return int
658 658
 	 */
659
-	public function sum_tickets_initially_available( $query_params = array() ) {
660
-		return $this->sum_related( 'Ticket', $query_params, 'TKT_qty' );
659
+	public function sum_tickets_initially_available($query_params = array()) {
660
+		return $this->sum_related('Ticket', $query_params, 'TKT_qty');
661 661
 	}
662 662
 
663 663
 
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 	 * @return int
670 670
 	 */
671 671
 	public function total_tickets_available_at_this_datetime() {
672
-		return $this->spaces_remaining( true );
672
+		return $this->spaces_remaining(true);
673 673
 	}
674 674
 
675 675
 
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 	 * @return boolean
681 681
 	 */
682 682
 	public function is_upcoming() {
683
-		return ( $this->get_raw( 'DTT_EVT_start' ) > time() );
683
+		return ($this->get_raw('DTT_EVT_start') > time());
684 684
 	}
685 685
 
686 686
 
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 	 * @return boolean
691 691
 	 */
692 692
 	public function is_active() {
693
-		return ( $this->get_raw( 'DTT_EVT_start' ) < time() && $this->get_raw( 'DTT_EVT_end' ) > time() );
693
+		return ($this->get_raw('DTT_EVT_start') < time() && $this->get_raw('DTT_EVT_end') > time());
694 694
 	}
695 695
 
696 696
 
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	 * @return boolean
701 701
 	 */
702 702
 	public function is_expired() {
703
-		return ( $this->get_raw( 'DTT_EVT_end' ) < time() );
703
+		return ($this->get_raw('DTT_EVT_end') < time());
704 704
 	}
705 705
 
706 706
 
@@ -711,16 +711,16 @@  discard block
 block discarded – undo
711 711
 	 */
712 712
 	public function get_active_status() {
713 713
 		$total_tickets_for_this_dtt = $this->total_tickets_available_at_this_datetime();
714
-		if ( $total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1 ) {
714
+		if ($total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1) {
715 715
 			return EE_Datetime::sold_out;
716 716
 		}
717
-		if ( $this->is_expired() ) {
717
+		if ($this->is_expired()) {
718 718
 			return EE_Datetime::expired;
719 719
 		}
720
-		if ( $this->is_upcoming() ) {
720
+		if ($this->is_upcoming()) {
721 721
 			return EE_Datetime::upcoming;
722 722
 		}
723
-		if ( $this->is_active() ) {
723
+		if ($this->is_active()) {
724 724
 			return EE_Datetime::active;
725 725
 		}
726 726
 		return NULL;
@@ -734,24 +734,24 @@  discard block
 block discarded – undo
734 734
 	 * @param  boolean $use_dtt_name if TRUE then we'll use DTT->name() if its not empty.
735 735
 	 * @return string
736 736
 	 */
737
-	public function get_dtt_display_name( $use_dtt_name = FALSE ) {
738
-		if ( $use_dtt_name ) {
737
+	public function get_dtt_display_name($use_dtt_name = FALSE) {
738
+		if ($use_dtt_name) {
739 739
 			$dtt_name = $this->name();
740
-			if ( !empty( $dtt_name ) ) {
740
+			if ( ! empty($dtt_name)) {
741 741
 				return $dtt_name;
742 742
 			}
743 743
 		}
744 744
 		//first condition is to see if the months are different
745
-		if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) ) {
746
-			$display_date = $this->start_date( 'M j\, Y g:i a' ) . ' - ' . $this->end_date( 'M j\, Y g:i a' );
745
+		if (date('m', $this->get_raw('DTT_EVT_start')) != date('m', $this->get_raw('DTT_EVT_end'))) {
746
+			$display_date = $this->start_date('M j\, Y g:i a').' - '.$this->end_date('M j\, Y g:i a');
747 747
 			//next condition is if its the same month but different day
748 748
 		}
749 749
 		else {
750
-			if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) == date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) && date( 'd', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'd', $this->get_raw( 'DTT_EVT_end' ) ) ) {
751
-				$display_date = $this->start_date( 'M j\, g:i a' ) . ' - ' . $this->end_date( 'M j\, g:i a Y' );
750
+			if (date('m', $this->get_raw('DTT_EVT_start')) == date('m', $this->get_raw('DTT_EVT_end')) && date('d', $this->get_raw('DTT_EVT_start')) != date('d', $this->get_raw('DTT_EVT_end'))) {
751
+				$display_date = $this->start_date('M j\, g:i a').' - '.$this->end_date('M j\, g:i a Y');
752 752
 			}
753 753
 			else {
754
-				$display_date = $this->start_date( 'F j\, Y' ) . ' @ ' . $this->start_date( 'g:i a' ) . ' - ' . $this->end_date( 'g:i a' );
754
+				$display_date = $this->start_date('F j\, Y').' @ '.$this->start_date('g:i a').' - '.$this->end_date('g:i a');
755 755
 			}
756 756
 		}
757 757
 		return $display_date;
@@ -765,8 +765,8 @@  discard block
 block discarded – undo
765 765
 *@param array $query_params see EEM_Base::get_all()
766 766
 	 * @return EE_Ticket[]
767 767
 	 */
768
-	public function tickets( $query_params = array() ) {
769
-		return $this->get_many_related( 'Ticket', $query_params );
768
+	public function tickets($query_params = array()) {
769
+		return $this->get_many_related('Ticket', $query_params);
770 770
 	}
771 771
 
772 772
 
@@ -776,21 +776,21 @@  discard block
 block discarded – undo
776 776
 	 * @param array $query_params like EEM_Base::get_all's
777 777
 	 * @return EE_Ticket[]
778 778
 	 */
779
-	public function ticket_types_available_for_purchase( $query_params = array() ) {
779
+	public function ticket_types_available_for_purchase($query_params = array()) {
780 780
 		// first check if datetime is valid
781
-		if ( ! ( $this->is_upcoming() || $this->is_active() ) || $this->sold_out() ) {
781
+		if ( ! ($this->is_upcoming() || $this->is_active()) || $this->sold_out()) {
782 782
 			return array();
783 783
 		}
784
-		if ( empty( $query_params ) ) {
784
+		if (empty($query_params)) {
785 785
 			$query_params = array(
786 786
 				array(
787
-					'TKT_start_date' => array( '<=', EEM_Ticket::instance()->current_time_for_query( 'TKT_start_date' ) ),
788
-					'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
787
+					'TKT_start_date' => array('<=', EEM_Ticket::instance()->current_time_for_query('TKT_start_date')),
788
+					'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
789 789
 					'TKT_deleted'    => false
790 790
 				)
791 791
 			);
792 792
 		}
793
-		return $this->tickets( $query_params );
793
+		return $this->tickets($query_params);
794 794
 	}
795 795
 
796 796
 
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 	 * @return EE_Event
801 801
 	 */
802 802
 	public function event() {
803
-		return $this->get_first_related( 'Event' );
803
+		return $this->get_first_related('Event');
804 804
 	}
805 805
 
806 806
 
@@ -812,13 +812,13 @@  discard block
 block discarded – undo
812 812
 	 */
813 813
 	public function update_sold() {
814 814
 		$count_regs_for_this_datetime = EEM_Registration::instance()->count(
815
-			array( array(
815
+			array(array(
816 816
 				'STS_ID' 					=> EEM_Registration::status_id_approved,
817 817
 				'REG_deleted' 				=> 0,
818 818
 				'Ticket.Datetime.DTT_ID' 	=> $this->ID(),
819
-			) )
819
+			))
820 820
 		);
821
-		$this->set( 'DTT_sold', $count_regs_for_this_datetime );
821
+		$this->set('DTT_sold', $count_regs_for_this_datetime);
822 822
 		$this->save();
823 823
 		return $count_regs_for_this_datetime;
824 824
 	}
Please login to merge, or discard this patch.
core/db_classes/EE_Registration.class.php 3 patches
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 	/**
922 922
 	 * Sets deleted
923 923
 	 * @param boolean $deleted
924
-	 * @return boolean
924
+	 * @return boolean|null
925 925
 	 */
926 926
 	public function set_deleted($deleted) {
927 927
 		$this->set( 'REG_deleted', $deleted );
@@ -965,6 +965,7 @@  discard block
 block discarded – undo
965 965
 	 *
966 966
 	 * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against
967 967
 	 * @param bool   $check_approved   This is used to indicate whether the caller wants can_checkin to also consider registration status as well as datetime access.
968
+	 * @param integer $DTT_OR_ID
968 969
 	 *
969 970
 	 * @return bool
970 971
 	 */
@@ -1103,7 +1104,7 @@  discard block
 block discarded – undo
1103 1104
      * Returns the latest datetime related to this registration (via the ticket attached to the registration).
1104 1105
      * "Latest" is defined by the `DTT_EVT_start` column.
1105 1106
      *
1106
-     * @return EE_Datetime|null
1107
+     * @return null|EE_Base_Class
1107 1108
      * @throws \EE_Error
1108 1109
      */
1109 1110
 	public function get_latest_related_datetime() {
@@ -1374,7 +1375,7 @@  discard block
 block discarded – undo
1374 1375
 	 * This grabs the payment method corresponding to the last payment made for the amount owing on the registration.
1375 1376
 	 * Note: if there are no payments on the registration there will be no payment method returned.
1376 1377
 	 *
1377
-	 * @return EE_Payment_Method|null
1378
+	 * @return null|EE_Base_Class
1378 1379
 	 */
1379 1380
 	public function payment_method() {
1380 1381
 		return EEM_Payment_Method::instance()->get_last_used_for_registration( $this );
Please login to merge, or discard this patch.
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -645,9 +645,9 @@  discard block
 block discarded – undo
645 645
 
646 646
 
647 647
 	/**
648
-	*		get  Attendee Number
649
-	* 		@access		public
650
-	*/
648
+	 *		get  Attendee Number
649
+	 * 		@access		public
650
+	 */
651 651
 	public function count() {
652 652
 		return $this->get( 'REG_count' );
653 653
 	}
@@ -1029,20 +1029,20 @@  discard block
 block discarded – undo
1029 1029
 
1030 1030
 
1031 1031
 
1032
-    /**
1033
-     * toggle Check-in status for this registration
1034
-     * Check-ins are toggled in the following order:
1035
-     * never checked in -> checked in
1036
-     * checked in -> checked out
1037
-     * checked out -> checked in
1038
-     *
1039
-     * @param  int $DTT_ID  include specific datetime to toggle Check-in for.
1040
-     *                      If not included or null, then it is assumed latest datetime is being toggled.
1041
-     * @param bool $verify  If true then can_checkin() is used to verify whether the person
1042
-     *                      can be checked in or not.  Otherwise this forces change in checkin status.
1043
-     * @return bool|int     the chk_in status toggled to OR false if nothing got changed.
1044
-     * @throws EE_Error
1045
-     */
1032
+	/**
1033
+	 * toggle Check-in status for this registration
1034
+	 * Check-ins are toggled in the following order:
1035
+	 * never checked in -> checked in
1036
+	 * checked in -> checked out
1037
+	 * checked out -> checked in
1038
+	 *
1039
+	 * @param  int $DTT_ID  include specific datetime to toggle Check-in for.
1040
+	 *                      If not included or null, then it is assumed latest datetime is being toggled.
1041
+	 * @param bool $verify  If true then can_checkin() is used to verify whether the person
1042
+	 *                      can be checked in or not.  Otherwise this forces change in checkin status.
1043
+	 * @return bool|int     the chk_in status toggled to OR false if nothing got changed.
1044
+	 * @throws EE_Error
1045
+	 */
1046 1046
 	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1047 1047
 		if ( empty( $DTT_ID ) ) {
1048 1048
 			$datetime = $this->get_latest_related_datetime();
@@ -1099,13 +1099,13 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 
1101 1101
 
1102
-    /**
1103
-     * Returns the latest datetime related to this registration (via the ticket attached to the registration).
1104
-     * "Latest" is defined by the `DTT_EVT_start` column.
1105
-     *
1106
-     * @return EE_Datetime|null
1107
-     * @throws \EE_Error
1108
-     */
1102
+	/**
1103
+	 * Returns the latest datetime related to this registration (via the ticket attached to the registration).
1104
+	 * "Latest" is defined by the `DTT_EVT_start` column.
1105
+	 *
1106
+	 * @return EE_Datetime|null
1107
+	 * @throws \EE_Error
1108
+	 */
1109 1109
 	public function get_latest_related_datetime() {
1110 1110
 		return EEM_Datetime::instance()->get_one(
1111 1111
 			array(
@@ -1119,12 +1119,12 @@  discard block
 block discarded – undo
1119 1119
 
1120 1120
 
1121 1121
 
1122
-    /**
1123
-     * Returns the earliest datetime related to this registration (via the ticket attached to the registration).
1124
-     * "Earliest" is defined by the `DTT_EVT_start` column.
1125
-     *
1126
-     * @throws \EE_Error
1127
-     */
1122
+	/**
1123
+	 * Returns the earliest datetime related to this registration (via the ticket attached to the registration).
1124
+	 * "Earliest" is defined by the `DTT_EVT_start` column.
1125
+	 *
1126
+	 * @throws \EE_Error
1127
+	 */
1128 1128
 	public function get_earliest_related_datetime() {
1129 1129
 		return EEM_Datetime::instance()->get_one(
1130 1130
 			array(
@@ -1138,18 +1138,18 @@  discard block
 block discarded – undo
1138 1138
 
1139 1139
 
1140 1140
 
1141
-    /**
1142
-     * This method simply returns the check-in status for this registration and the given datetime.
1143
-     * If neither the datetime nor the checkin values are provided as arguments,
1144
-     * then this will return the LATEST check-in status for the registration across all datetimes it belongs to.
1145
-     *
1146
-     * @param  int $DTT_ID        The ID of the datetime we're checking against
1147
-     *                            (if empty we'll get the primary datetime for
1148
-     *                            this registration (via event) and use it's ID);
1149
-     * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1150
-     * @return int                Integer representing Check-in status.
1151
-     * @throws \EE_Error
1152
-     */
1141
+	/**
1142
+	 * This method simply returns the check-in status for this registration and the given datetime.
1143
+	 * If neither the datetime nor the checkin values are provided as arguments,
1144
+	 * then this will return the LATEST check-in status for the registration across all datetimes it belongs to.
1145
+	 *
1146
+	 * @param  int $DTT_ID        The ID of the datetime we're checking against
1147
+	 *                            (if empty we'll get the primary datetime for
1148
+	 *                            this registration (via event) and use it's ID);
1149
+	 * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1150
+	 * @return int                Integer representing Check-in status.
1151
+	 * @throws \EE_Error
1152
+	 */
1153 1153
 	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = null ) {
1154 1154
 		$checkin_query_params = array(
1155 1155
 			'order_by' => array( 'CHK_timestamp' => 'DESC' )
@@ -1161,8 +1161,8 @@  discard block
 block discarded – undo
1161 1161
 
1162 1162
 		//get checkin object (if exists)
1163 1163
 		$checkin = $checkin instanceof EE_Checkin
1164
-            ? $checkin
1165
-            : $this->get_first_related( 'Checkin', $checkin_query_params );
1164
+			? $checkin
1165
+			: $this->get_first_related( 'Checkin', $checkin_query_params );
1166 1166
 		if ( $checkin instanceof EE_Checkin ) {
1167 1167
 			if ( $checkin->get( 'CHK_in' ) ) {
1168 1168
 				return EE_Registration::checkin_status_in; //checked in
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
 
1416 1416
 
1417 1417
 
1418
-    /*************************** DEPRECATED ***************************/
1418
+	/*************************** DEPRECATED ***************************/
1419 1419
 
1420 1420
 
1421 1421
 
@@ -1465,24 +1465,24 @@  discard block
 block discarded – undo
1465 1465
 
1466 1466
 
1467 1467
 
1468
-    /**
1469
-     * Gets the primary datetime related to this registration via the related Event to this registration
1470
-     *
1471
-     * @deprecated 4.9.17
1472
-     * @return EE_Datetime
1473
-     */
1474
-    public function get_related_primary_datetime() {
1475
-        EE_Error::doing_it_wrong(
1476
-            __METHOD__,
1477
-            esc_html__(
1478
-                'Use EE_Registration::get_latest_related_datetime() or EE_Registration::get_earliest_related_datetime()',
1479
-                'event_espresso'
1480
-            ),
1481
-            '4.9.17',
1482
-            '5.0.0'
1483
-        );
1484
-        return $this->event()->primary_datetime();
1485
-    }
1468
+	/**
1469
+	 * Gets the primary datetime related to this registration via the related Event to this registration
1470
+	 *
1471
+	 * @deprecated 4.9.17
1472
+	 * @return EE_Datetime
1473
+	 */
1474
+	public function get_related_primary_datetime() {
1475
+		EE_Error::doing_it_wrong(
1476
+			__METHOD__,
1477
+			esc_html__(
1478
+				'Use EE_Registration::get_latest_related_datetime() or EE_Registration::get_earliest_related_datetime()',
1479
+				'event_espresso'
1480
+			),
1481
+			'4.9.17',
1482
+			'5.0.0'
1483
+		);
1484
+		return $this->event()->primary_datetime();
1485
+	}
1486 1486
 
1487 1487
 
1488 1488
 }
Please login to merge, or discard this patch.
Spacing   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\EntityNotFoundException;
2 2
 
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 /**
7 7
  * EE_Registration class
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @param        int $EVT_ID Event ID
42 42
 	 */
43
-	public function set_event( $EVT_ID = 0 ) {
44
-		$this->set( 'EVT_ID', $EVT_ID );
43
+	public function set_event($EVT_ID = 0) {
44
+		$this->set('EVT_ID', $EVT_ID);
45 45
 	}
46 46
 
47 47
 
@@ -52,18 +52,18 @@  discard block
 block discarded – undo
52 52
 	 * @param mixed  $field_value
53 53
 	 * @param bool   $use_default
54 54
 	 */
55
-	public function set( $field_name, $field_value, $use_default = FALSE ) {
56
-		switch( $field_name ) {
55
+	public function set($field_name, $field_value, $use_default = FALSE) {
56
+		switch ($field_name) {
57 57
 			case 'REG_code' :
58
-				if ( ! empty( $field_value ) && $this->reg_code() == '' ) {
59
-					$this->set_reg_code( $field_value, $use_default );
58
+				if ( ! empty($field_value) && $this->reg_code() == '') {
59
+					$this->set_reg_code($field_value, $use_default);
60 60
 				}
61 61
 				break;
62 62
 			case 'STS_ID' :
63
-				$this->set_status( $field_value, $use_default );
63
+				$this->set_status($field_value, $use_default);
64 64
 				break;
65 65
 			default :
66
-				parent::set( $field_name, $field_value, $use_default );
66
+				parent::set($field_name, $field_value, $use_default);
67 67
 		}
68 68
 	}
69 69
 
@@ -80,42 +80,42 @@  discard block
 block discarded – undo
80 80
 	 * @return bool
81 81
 	 * @throws \EE_Error
82 82
 	 */
83
-	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
83
+	public function set_status($new_STS_ID = NULL, $use_default = FALSE) {
84 84
 		// get current REG_Status
85 85
 		$old_STS_ID = $this->status_ID();
86 86
 		// if status has changed
87 87
 		if (
88 88
 			$this->ID() // ensure registration is in the db
89 89
 			&& $old_STS_ID != $new_STS_ID // and that status has actually changed
90
-			&& ! empty( $old_STS_ID ) // and that old status is actually set
91
-			&& ! empty( $new_STS_ID ) // as well as the new status
90
+			&& ! empty($old_STS_ID) // and that old status is actually set
91
+			&& ! empty($new_STS_ID) // as well as the new status
92 92
 		) {
93 93
 			// TO approved
94
-			if ( $new_STS_ID === EEM_Registration::status_id_approved ) {
94
+			if ($new_STS_ID === EEM_Registration::status_id_approved) {
95 95
 				// reserve a space by incrementing ticket and datetime sold values
96 96
 				$this->_reserve_registration_space();
97
-				do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID );
97
+				do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID);
98 98
 			// OR FROM  approved
99
-			} else if ( $old_STS_ID === EEM_Registration::status_id_approved ) {
99
+			} else if ($old_STS_ID === EEM_Registration::status_id_approved) {
100 100
 				// release a space by decrementing ticket and datetime sold values
101 101
 				$this->_release_registration_space();
102
-				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
102
+				do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID);
103 103
 			}
104 104
 			// update status
105
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
105
+			parent::set('STS_ID', $new_STS_ID, $use_default);
106 106
 			/** @type EE_Registration_Processor $registration_processor */
107
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
107
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
108 108
 			/** @type EE_Transaction_Processor $transaction_processor */
109
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
109
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
110 110
 			/** @type EE_Transaction_Payments $transaction_payments */
111
-			$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
111
+			$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
112 112
 			// these reg statuses should not be considered in any calculations involving monies owing
113
-			$closed_reg_statuses = ! empty( $closed_reg_statuses )
113
+			$closed_reg_statuses = ! empty($closed_reg_statuses)
114 114
 				? $closed_reg_statuses
115 115
 				: EEM_Registration::closed_reg_statuses();
116 116
 			if (
117
-				in_array( $new_STS_ID, $closed_reg_statuses )
118
-				&& ! in_array( $old_STS_ID, $closed_reg_statuses )
117
+				in_array($new_STS_ID, $closed_reg_statuses)
118
+				&& ! in_array($old_STS_ID, $closed_reg_statuses)
119 119
 			) {
120 120
 				// cancelled or declined registration
121 121
 				$registration_processor->update_registration_after_being_canceled_or_declined(
@@ -128,24 +128,24 @@  discard block
 block discarded – undo
128 128
 					false
129 129
 				);
130 130
 			} else if (
131
-				in_array( $old_STS_ID, $closed_reg_statuses )
132
-				&& ! in_array( $new_STS_ID, $closed_reg_statuses )
131
+				in_array($old_STS_ID, $closed_reg_statuses)
132
+				&& ! in_array($new_STS_ID, $closed_reg_statuses)
133 133
 			) {
134 134
 				// reinstating cancelled or declined registration
135 135
 				$registration_processor->update_canceled_or_declined_registration_after_being_reinstated(
136 136
 					$this,
137 137
 					$closed_reg_statuses
138 138
 				);
139
-				$transaction_processor->update_transaction_after_reinstating_canceled_registration( $this );
139
+				$transaction_processor->update_transaction_after_reinstating_canceled_registration($this);
140 140
 			}
141
-			$transaction_payments->recalculate_transaction_total( $this->transaction(), false );
142
-			$this->transaction()->update_status_based_on_total_paid( true );
143
-			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
141
+			$transaction_payments->recalculate_transaction_total($this->transaction(), false);
142
+			$this->transaction()->update_status_based_on_total_paid(true);
143
+			do_action('AHEE__EE_Registration__set_status__after_update', $this);
144 144
 			return TRUE;
145 145
 		} else {
146 146
 			//even though the old value matches the new value, it's still good to
147 147
 			//allow the parent set method to have a say
148
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
148
+			parent::set('STS_ID', $new_STS_ID, $use_default);
149 149
 			return TRUE;
150 150
 		}
151 151
 	}
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 *        get Status ID
157 157
 	 */
158 158
 	public function status_ID() {
159
-		return $this->get( 'STS_ID' );
159
+		return $this->get('STS_ID');
160 160
 	}
161 161
 
162 162
 
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
 	 * @param boolean $include_archived whether to include archived tickets or not.
182 182
 	 * @return EE_Ticket
183 183
 	 */
184
-	public function ticket( $include_archived = TRUE ) {
184
+	public function ticket($include_archived = TRUE) {
185 185
 		$query_params = array();
186
-		if ( $include_archived ) {
187
-			$query_params[ 'default_where_conditions' ] = 'none';
186
+		if ($include_archived) {
187
+			$query_params['default_where_conditions'] = 'none';
188 188
 		}
189
-		return $this->get_first_related( 'Ticket', $query_params );
189
+		return $this->get_first_related('Ticket', $query_params);
190 190
 	}
191 191
 
192 192
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	public function wp_user() {
216 216
 		$event = $this->event();
217
-		if ( $event instanceof EE_Event ) {
217
+		if ($event instanceof EE_Event) {
218 218
 			return $event->wp_user();
219 219
 		}
220 220
 		return 0;
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @param        int $ATT_ID Attendee ID
241 241
 	 */
242
-	public function set_attendee_id( $ATT_ID = 0 ) {
243
-		$this->set( 'ATT_ID', $ATT_ID );
242
+	public function set_attendee_id($ATT_ID = 0) {
243
+		$this->set('ATT_ID', $ATT_ID);
244 244
 	}
245 245
 
246 246
 
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @param        int $TXN_ID Transaction ID
252 252
 	 */
253
-	public function set_transaction_id( $TXN_ID = 0 ) {
254
-		$this->set( 'TXN_ID', $TXN_ID );
253
+	public function set_transaction_id($TXN_ID = 0) {
254
+		$this->set('TXN_ID', $TXN_ID);
255 255
 	}
256 256
 
257 257
 
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
 	 *
262 262
 	 * @param    string $REG_session PHP Session ID
263 263
 	 */
264
-	public function set_session( $REG_session = '' ) {
265
-		$this->set( 'REG_session', $REG_session );
264
+	public function set_session($REG_session = '') {
265
+		$this->set('REG_session', $REG_session);
266 266
 	}
267 267
 
268 268
 
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
 	 *
273 273
 	 * @param    string $REG_url_link Registration URL Link
274 274
 	 */
275
-	public function set_reg_url_link( $REG_url_link = '' ) {
276
-		$this->set( 'REG_url_link', $REG_url_link );
275
+	public function set_reg_url_link($REG_url_link = '') {
276
+		$this->set('REG_url_link', $REG_url_link);
277 277
 	}
278 278
 
279 279
 
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 	 *
284 284
 	 * @param        int $REG_count Primary Attendee
285 285
 	 */
286
-	public function set_count( $REG_count = 1 ) {
287
-		$this->set( 'REG_count', $REG_count );
286
+	public function set_count($REG_count = 1) {
287
+		$this->set('REG_count', $REG_count);
288 288
 	}
289 289
 
290 290
 
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * @param        boolean $REG_group_size Group Registration
296 296
 	 */
297
-	public function set_group_size( $REG_group_size = FALSE ) {
298
-		$this->set( 'REG_group_size', $REG_group_size );
297
+	public function set_group_size($REG_group_size = FALSE) {
298
+		$this->set('REG_group_size', $REG_group_size);
299 299
 	}
300 300
 
301 301
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @param        mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date
373 373
 	 */
374
-	public function set_reg_date( $REG_date = FALSE ) {
375
-		$this->set( 'REG_date', $REG_date );
374
+	public function set_reg_date($REG_date = FALSE) {
375
+		$this->set('REG_date', $REG_date);
376 376
 	}
377 377
 
378 378
 
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
 	 * @access    public
384 384
 	 * @param    float $REG_final_price
385 385
 	 */
386
-	public function set_final_price( $REG_final_price = 0.00 ) {
387
-		$this->set( 'REG_final_price', $REG_final_price );
386
+	public function set_final_price($REG_final_price = 0.00) {
387
+		$this->set('REG_final_price', $REG_final_price);
388 388
 	}
389 389
 
390 390
 
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 	 * @access    public
396 396
 	 * @param    float $REG_paid
397 397
 	 */
398
-	public function set_paid( $REG_paid = 0.00 ) {
399
-		$this->set( 'REG_paid', $REG_paid );
398
+	public function set_paid($REG_paid = 0.00) {
399
+		$this->set('REG_paid', $REG_paid);
400 400
 	}
401 401
 
402 402
 
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 	 *
407 407
 	 * @param        boolean $REG_att_is_going Attendee Is Going
408 408
 	 */
409
-	public function set_att_is_going( $REG_att_is_going = FALSE ) {
410
-		$this->set( 'REG_att_is_going', $REG_att_is_going );
409
+	public function set_att_is_going($REG_att_is_going = FALSE) {
410
+		$this->set('REG_att_is_going', $REG_att_is_going);
411 411
 	}
412 412
 
413 413
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 * @return EE_Attendee
418 418
 	 */
419 419
 	public function attendee() {
420
-		return $this->get_first_related( 'Attendee' );
420
+		return $this->get_first_related('Attendee');
421 421
 	}
422 422
 
423 423
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 *        get Event ID
427 427
 	 */
428 428
 	public function event_ID() {
429
-		return $this->get( 'EVT_ID' );
429
+		return $this->get('EVT_ID');
430 430
 	}
431 431
 
432 432
 
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 	 */
437 437
 	public function event_name() {
438 438
 		$event = $this->event_obj();
439
-		if ( $event ) {
439
+		if ($event) {
440 440
 			return $event->name();
441 441
 		} else {
442 442
 			return NULL;
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 	 * @return EE_Event
451 451
 	 */
452 452
 	public function event_obj() {
453
-		return $this->get_first_related( 'Event' );
453
+		return $this->get_first_related('Event');
454 454
 	}
455 455
 
456 456
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	 *        get Attendee ID
460 460
 	 */
461 461
 	public function attendee_ID() {
462
-		return $this->get( 'ATT_ID' );
462
+		return $this->get('ATT_ID');
463 463
 	}
464 464
 
465 465
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 	 *        get PHP Session ID
469 469
 	 */
470 470
 	public function session_ID() {
471
-		return $this->get( 'REG_session' );
471
+		return $this->get('REG_session');
472 472
 	}
473 473
 
474 474
 
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
479 479
 	 * @return string
480 480
 	 */
481
-	public function receipt_url( $messenger = 'html' ) {
481
+	public function receipt_url($messenger = 'html') {
482 482
 
483 483
 		/**
484 484
 		 * The below will be deprecated one version after this.  We check first if there is a custom receipt template already in use on old system.  If there is then we just return the standard url for it.
@@ -486,12 +486,12 @@  discard block
 block discarded – undo
486 486
 		 * @since 4.5.0
487 487
 		 */
488 488
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php';
489
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
489
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
490 490
 
491
-		if ( $has_custom ) {
492
-			return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) );
491
+		if ($has_custom) {
492
+			return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch'));
493 493
 		}
494
-		return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' );
494
+		return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt');
495 495
 	}
496 496
 
497 497
 
@@ -502,28 +502,28 @@  discard block
 block discarded – undo
502 502
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
503 503
 	 * @return string
504 504
 	 */
505
-	public function invoice_url( $messenger = 'html' ) {
505
+	public function invoice_url($messenger = 'html') {
506 506
 		/**
507 507
 		 * The below will be deprecated one version after this.  We check first if there is a custom invoice template already in use on old system.  If there is then we just return the standard url for it.
508 508
 		 *
509 509
 		 * @since 4.5.0
510 510
 		 */
511 511
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php';
512
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
512
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
513 513
 
514
-		if ( $has_custom ) {
515
-			if ( $messenger == 'html' ) {
516
-				return $this->invoice_url( 'launch' );
514
+		if ($has_custom) {
515
+			if ($messenger == 'html') {
516
+				return $this->invoice_url('launch');
517 517
 			}
518 518
 			$route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice';
519 519
 
520
-			$query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() );
521
-			if ( $messenger == 'html' ) {
520
+			$query_args = array('ee' => $route, 'id' => $this->reg_url_link());
521
+			if ($messenger == 'html') {
522 522
 				$query_args['html'] = TRUE;
523 523
 			}
524
-			return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) );
524
+			return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
525 525
 		}
526
-		return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' );
526
+		return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice');
527 527
 	}
528 528
 
529 529
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	 * @throws \EE_Error
537 537
 	 */
538 538
 	public function reg_url_link() {
539
-		return (string)$this->get( 'REG_url_link' );
539
+		return (string) $this->get('REG_url_link');
540 540
 	}
541 541
 
542 542
 
@@ -546,8 +546,8 @@  discard block
 block discarded – undo
546 546
 	 * @param string $type 'download','launch', or 'html' (default is 'launch')
547 547
 	 * @return void
548 548
 	 */
549
-	public function e_invoice_url( $type = 'launch' ) {
550
-		echo $this->invoice_url( $type );
549
+	public function e_invoice_url($type = 'launch') {
550
+		echo $this->invoice_url($type);
551 551
 	}
552 552
 
553 553
 
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 	 * @return string
568 568
 	 */
569 569
 	public function payment_overview_url() {
570
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
570
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
571 571
 	}
572 572
 
573 573
 
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 	 * @return string
579 579
 	 */
580 580
 	public function edit_attendee_information_url() {
581
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
581
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
582 582
 	}
583 583
 
584 584
 
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 	 * @return string
589 589
 	 */
590 590
 	public function get_admin_edit_url() {
591
-		return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) );
591
+		return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php'));
592 592
 	}
593 593
 
594 594
 
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 	 *    is_primary_registrant?
598 598
 	 */
599 599
 	public function is_primary_registrant() {
600
-		return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE;
600
+		return $this->get('REG_count') == 1 ? TRUE : FALSE;
601 601
 	}
602 602
 
603 603
 
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
 	 * This returns the primary registration object for this registration group (which may be this object).
607 607
 	 * @return EE_Registration
608 608
 	 */
609
-	public function get_primary_registration()  {
610
-		if ( $this->is_primary_registrant() )
609
+	public function get_primary_registration() {
610
+		if ($this->is_primary_registrant())
611 611
 			return $this;
612 612
 
613 613
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
614
-		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
614
+		$primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1)));
615 615
 		return $primary_registrant;
616 616
 	}
617 617
 
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	* 		@access		public
623 623
 	*/
624 624
 	public function count() {
625
-		return $this->get( 'REG_count' );
625
+		return $this->get('REG_count');
626 626
 	}
627 627
 
628 628
 
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	 *        get Group Size
632 632
 	 */
633 633
 	public function group_size() {
634
-		return $this->get( 'REG_group_size' );
634
+		return $this->get('REG_group_size');
635 635
 	}
636 636
 
637 637
 
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 	 *        get Registration Date
641 641
 	 */
642 642
 	public function date() {
643
-		return $this->get( 'REG_date' );
643
+		return $this->get('REG_date');
644 644
 	}
645 645
 
646 646
 
@@ -651,8 +651,8 @@  discard block
 block discarded – undo
651 651
 	 * @param string $time_format
652 652
 	 * @return string
653 653
 	 */
654
-	public function pretty_date( $date_format = NULL, $time_format = NULL ) {
655
-		return $this->get_datetime( 'REG_date', $date_format, $time_format );
654
+	public function pretty_date($date_format = NULL, $time_format = NULL) {
655
+		return $this->get_datetime('REG_date', $date_format, $time_format);
656 656
 	}
657 657
 
658 658
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	 * @return    float
665 665
 	 */
666 666
 	public function final_price() {
667
-		return $this->get( 'REG_final_price' );
667
+		return $this->get('REG_final_price');
668 668
 	}
669 669
 
670 670
 
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 	 * @return string
676 676
 	 */
677 677
 	public function pretty_final_price() {
678
-		return $this->get_pretty( 'REG_final_price' );
678
+		return $this->get_pretty('REG_final_price');
679 679
 	}
680 680
 
681 681
 
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 	 * @return 	float
686 686
 	 */
687 687
 	public function paid() {
688
-		return $this->get( 'REG_paid' );
688
+		return $this->get('REG_paid');
689 689
 	}
690 690
 
691 691
 
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 	 * @return 	float
696 696
 	 */
697 697
 	public function pretty_paid() {
698
-		return $this->get_pretty( 'REG_paid' );
698
+		return $this->get_pretty('REG_paid');
699 699
 	}
700 700
 
701 701
 
@@ -706,11 +706,11 @@  discard block
 block discarded – undo
706 706
 	 * @param array $requires_payment
707 707
 	 * @return bool
708 708
 	 */
709
-	public function owes_monies_and_can_pay( $requires_payment = array()) {
709
+	public function owes_monies_and_can_pay($requires_payment = array()) {
710 710
 		// these reg statuses require payment (if event is not free)
711
-		$requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
711
+		$requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
712 712
 		if (
713
-			in_array( $this->status_ID(), $requires_payment ) &&
713
+			in_array($this->status_ID(), $requires_payment) &&
714 714
 			$this->final_price() != 0 &&
715 715
 			$this->final_price() != $this->paid()
716 716
 		) {
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
 	 * @param bool $show_icons
728 728
 	 * @return void
729 729
 	 */
730
-	public function e_pretty_status( $show_icons = FALSE ) {
731
-		echo $this->pretty_status( $show_icons );
730
+	public function e_pretty_status($show_icons = FALSE) {
731
+		echo $this->pretty_status($show_icons);
732 732
 	}
733 733
 
734 734
 
@@ -739,10 +739,10 @@  discard block
 block discarded – undo
739 739
 	 * @param bool $show_icons
740 740
 	 * @return string
741 741
 	 */
742
-	public function pretty_status( $show_icons = FALSE ) {
743
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
742
+	public function pretty_status($show_icons = FALSE) {
743
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
744 744
 		$icon = '';
745
-		switch ( $this->status_ID() ) {
745
+		switch ($this->status_ID()) {
746 746
 			case EEM_Registration::status_id_approved:
747 747
 				$icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : '';
748 748
 				break;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 				$icon = $show_icons ? '<span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>' : '';
766 766
 				break;
767 767
 		}
768
-		return $icon . $status[ $this->status_ID() ];
768
+		return $icon.$status[$this->status_ID()];
769 769
 	}
770 770
 
771 771
 
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 	 *        get Attendee Is Going
775 775
 	 */
776 776
 	public function att_is_going() {
777
-		return $this->get( 'REG_att_is_going' );
777
+		return $this->get('REG_att_is_going');
778 778
 	}
779 779
 
780 780
 
@@ -784,8 +784,8 @@  discard block
 block discarded – undo
784 784
 	 * @param array $query_params like EEM_Base::get_all
785 785
 	 * @return EE_Answer[]
786 786
 	 */
787
-	public function answers( $query_params = NULL ) {
788
-		return $this->get_many_related( 'Answer', $query_params );
787
+	public function answers($query_params = NULL) {
788
+		return $this->get_many_related('Answer', $query_params);
789 789
 	}
790 790
 
791 791
 
@@ -799,9 +799,9 @@  discard block
 block discarded – undo
799 799
 	 * (because the answer might be an array of answer values, so passing pretty_value=true
800 800
 	 * will convert it into some kind of string)
801 801
 	 */
802
-	public function answer_value_to_question( $question, $pretty_value=true ) {
802
+	public function answer_value_to_question($question, $pretty_value = true) {
803 803
 		$question_id = EEM_Question::instance()->ensure_is_ID($question);
804
-		return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value);
804
+		return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value);
805 805
 	}
806 806
 
807 807
 
@@ -814,13 +814,13 @@  discard block
 block discarded – undo
814 814
 	 */
815 815
 	public function question_groups() {
816 816
 		$question_groups = array();
817
-		if ( $this->event() instanceof EE_Event ) {
817
+		if ($this->event() instanceof EE_Event) {
818 818
 			$question_groups = $this->event()->question_groups(
819 819
 				array(
820 820
 					array(
821 821
 						'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false
822 822
 					),
823
-					'order_by' => array( 'QSG_order' => 'ASC' )
823
+					'order_by' => array('QSG_order' => 'ASC')
824 824
 				)
825 825
 			);
826 826
 		}
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 	 */
838 838
 	public function count_question_groups() {
839 839
 		$qg_count = 0;
840
-		if ( $this->event() instanceof EE_Event ) {
840
+		if ($this->event() instanceof EE_Event) {
841 841
 			$qg_count = $this->event()->count_related(
842 842
 				'Question_Group',
843 843
 				array(
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
 	 * @return string
859 859
 	 */
860 860
 	public function reg_date() {
861
-		return $this->get_datetime( 'REG_date' );
861
+		return $this->get_datetime('REG_date');
862 862
 	}
863 863
 
864 864
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 	 * @return EE_Datetime_Ticket
871 871
 	 */
872 872
 	public function datetime_ticket() {
873
-		return $this->get_first_related( 'Datetime_Ticket' );
873
+		return $this->get_first_related('Datetime_Ticket');
874 874
 	}
875 875
 
876 876
 
@@ -880,15 +880,15 @@  discard block
 block discarded – undo
880 880
 	 * @param EE_Datetime_Ticket $datetime_ticket
881 881
 	 * @return EE_Datetime_Ticket
882 882
 	 */
883
-	public function set_datetime_ticket( $datetime_ticket ) {
884
-		return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' );
883
+	public function set_datetime_ticket($datetime_ticket) {
884
+		return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket');
885 885
 	}
886 886
 	/**
887 887
 	 * Gets deleted
888 888
 	 * @return boolean
889 889
 	 */
890 890
 	public function deleted() {
891
-		return $this->get( 'REG_deleted' );
891
+		return $this->get('REG_deleted');
892 892
 	}
893 893
 
894 894
 	/**
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 	 * @return boolean
898 898
 	 */
899 899
 	public function set_deleted($deleted) {
900
-		$this->set( 'REG_deleted', $deleted );
900
+		$this->set('REG_deleted', $deleted);
901 901
 	}
902 902
 
903 903
 
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 	 * @return EE_Status
908 908
 	 */
909 909
 	public function status_obj() {
910
-		return $this->get_first_related( 'Status' );
910
+		return $this->get_first_related('Status');
911 911
 	}
912 912
 
913 913
 
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 	 * @return int
919 919
 	 */
920 920
 	public function count_checkins() {
921
-		return $this->get_model()->count_related( $this, 'Checkin' );
921
+		return $this->get_model()->count_related($this, 'Checkin');
922 922
 	}
923 923
 
924 924
 
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 	 * @return int
929 929
 	 */
930 930
 	public function count_checkins_not_checkedout() {
931
-		return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) );
931
+		return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1)));
932 932
 	}
933 933
 
934 934
 
@@ -941,20 +941,20 @@  discard block
 block discarded – undo
941 941
 	 *
942 942
 	 * @return bool
943 943
 	 */
944
-	public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) {
945
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
944
+	public function can_checkin($DTT_OR_ID, $check_approved = TRUE) {
945
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
946 946
 
947 947
 		//first check registration status
948
-		if (  ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) {
948
+		if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) {
949 949
 			return false;
950 950
 		}
951 951
 		//is there a datetime ticket that matches this dtt_ID?
952
-		if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) {
952
+		if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) {
953 953
 			return false;
954 954
 		}
955 955
 
956 956
 		//final check is against TKT_uses
957
-		return $this->verify_can_checkin_against_TKT_uses( $DTT_ID );
957
+		return $this->verify_can_checkin_against_TKT_uses($DTT_ID);
958 958
 	}
959 959
 
960 960
 
@@ -967,10 +967,10 @@  discard block
 block discarded – undo
967 967
 	 * @param int | EE_Datetime  $DTT_OR_ID  The datetime the registration is being checked against
968 968
 	 * @return bool   true means can checkin.  false means cannot checkin.
969 969
 	 */
970
-	public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) {
971
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
970
+	public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) {
971
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
972 972
 
973
-		if ( ! $DTT_ID ) {
973
+		if ( ! $DTT_ID) {
974 974
 			return false;
975 975
 		}
976 976
 
@@ -978,23 +978,23 @@  discard block
 block discarded – undo
978 978
 
979 979
 		// if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in
980 980
 		// or not.
981
-		if ( ! $max_uses || $max_uses === EE_INF ) {
981
+		if ( ! $max_uses || $max_uses === EE_INF) {
982 982
 			return true;
983 983
 		}
984 984
 
985 985
 		//does this datetime have a checkin record?  If so, then the dtt count has already been verified so we can just
986 986
 		//go ahead and toggle.
987
-		if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) {
987
+		if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) {
988 988
 			return true;
989 989
 		}
990 990
 
991 991
 		//made it here so the last check is whether the number of checkins per unique datetime on this registration
992 992
 		//disallows further check-ins.
993
-		$count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true );
993
+		$count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true);
994 994
 		// checkins have already reached their max number of uses
995 995
 		// so registrant can NOT checkin
996
-		if ( $count_unique_dtt_checkins >= $max_uses ) {
997
-			EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
996
+		if ($count_unique_dtt_checkins >= $max_uses) {
997
+			EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
998 998
 			return false;
999 999
 		}
1000 1000
 		return true;
@@ -1016,15 +1016,15 @@  discard block
 block discarded – undo
1016 1016
      * @return bool|int     the chk_in status toggled to OR false if nothing got changed.
1017 1017
      * @throws EE_Error
1018 1018
      */
1019
-	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1020
-		if ( empty( $DTT_ID ) ) {
1019
+	public function toggle_checkin_status($DTT_ID = null, $verify = false) {
1020
+		if (empty($DTT_ID)) {
1021 1021
 			$datetime = $this->get_latest_related_datetime();
1022 1022
 			$DTT_ID = $datetime instanceof EE_Datetime ? $datetime->ID() : 0;
1023 1023
 		// verify the registration can checkin for the given DTT_ID
1024
-		} elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) {
1024
+		} elseif ( ! $this->can_checkin($DTT_ID, $verify)) {
1025 1025
 			EE_Error::add_error(
1026 1026
 					sprintf(
1027
-						__( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1027
+						__('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1028 1028
 						$this->ID(),
1029 1029
 						$DTT_ID
1030 1030
 					),
@@ -1038,8 +1038,8 @@  discard block
 block discarded – undo
1038 1038
 			EE_Registration::checkin_status_out => EE_Registration::checkin_status_in
1039 1039
 		);
1040 1040
 		//start by getting the current status so we know what status we'll be changing to.
1041
-		$cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL );
1042
-		$status_to = $status_paths[ $cur_status ];
1041
+		$cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL);
1042
+		$status_to = $status_paths[$cur_status];
1043 1043
 		// database only records true for checked IN or false for checked OUT
1044 1044
 		// no record ( null ) means checked in NEVER, but we obviously don't save that
1045 1045
 		$new_status = $status_to === EE_Registration::checkin_status_in ? true : false;
@@ -1047,24 +1047,24 @@  discard block
 block discarded – undo
1047 1047
 		// because we are keeping track of Check-ins over time.
1048 1048
 		// Eventually we'll probably want to show a list table
1049 1049
 		// for the individual Check-ins so that they can be managed.
1050
-		$checkin = EE_Checkin::new_instance( array(
1050
+		$checkin = EE_Checkin::new_instance(array(
1051 1051
 				'REG_ID' => $this->ID(),
1052 1052
 				'DTT_ID' => $DTT_ID,
1053 1053
 				'CHK_in' => $new_status
1054
-		) );
1054
+		));
1055 1055
 		// if the record could not be saved then return false
1056
-		if ( $checkin->save() === 0 ) {
1057
-			if ( WP_DEBUG ) {
1056
+		if ($checkin->save() === 0) {
1057
+			if (WP_DEBUG) {
1058 1058
 				global $wpdb;
1059 1059
 				$error = sprintf(
1060
-					__( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ),
1060
+					__('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'),
1061 1061
 					'<br />',
1062 1062
 					$wpdb->last_error
1063 1063
 				);
1064 1064
 			} else {
1065
-				$error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' );
1065
+				$error = __('Registration check in update failed because of an unknown database error', 'event_espresso');
1066 1066
 			}
1067
-			EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
1067
+			EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
1068 1068
 			return false;
1069 1069
 		}
1070 1070
 		return $status_to;
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 				array(
1086 1086
 					'Ticket.Registration.REG_ID' => $this->ID()
1087 1087
 				),
1088
-				'order_by' => array( 'DTT_EVT_start' => 'DESC' )
1088
+				'order_by' => array('DTT_EVT_start' => 'DESC')
1089 1089
 			)
1090 1090
 		);
1091 1091
 	}
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 				array(
1105 1105
 					'Ticket.Registration.REG_ID' => $this->ID()
1106 1106
 				),
1107
-				'order_by' => array( 'DTT_EVT_start' => 'ASC' )
1107
+				'order_by' => array('DTT_EVT_start' => 'ASC')
1108 1108
 			)
1109 1109
 		);
1110 1110
 	}
@@ -1123,21 +1123,21 @@  discard block
 block discarded – undo
1123 1123
      * @return int                Integer representing Check-in status.
1124 1124
      * @throws \EE_Error
1125 1125
      */
1126
-	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = null ) {
1126
+	public function check_in_status_for_datetime($DTT_ID = 0, $checkin = null) {
1127 1127
 		$checkin_query_params = array(
1128
-			'order_by' => array( 'CHK_timestamp' => 'DESC' )
1128
+			'order_by' => array('CHK_timestamp' => 'DESC')
1129 1129
 		);
1130 1130
 
1131
-		if ( $DTT_ID > 0 ) {
1132
-			$checkin_query_params[0] = array( 'DTT_ID' => $DTT_ID );
1131
+		if ($DTT_ID > 0) {
1132
+			$checkin_query_params[0] = array('DTT_ID' => $DTT_ID);
1133 1133
 		}
1134 1134
 
1135 1135
 		//get checkin object (if exists)
1136 1136
 		$checkin = $checkin instanceof EE_Checkin
1137 1137
             ? $checkin
1138
-            : $this->get_first_related( 'Checkin', $checkin_query_params );
1139
-		if ( $checkin instanceof EE_Checkin ) {
1140
-			if ( $checkin->get( 'CHK_in' ) ) {
1138
+            : $this->get_first_related('Checkin', $checkin_query_params);
1139
+		if ($checkin instanceof EE_Checkin) {
1140
+			if ($checkin->get('CHK_in')) {
1141 1141
 				return EE_Registration::checkin_status_in; //checked in
1142 1142
 			}
1143 1143
 			return EE_Registration::checkin_status_out; //had checked in but is now checked out.
@@ -1153,28 +1153,28 @@  discard block
 block discarded – undo
1153 1153
 	 * @param bool $error  This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name.
1154 1154
 	 * @return string         internationalized message
1155 1155
 	 */
1156
-	public function get_checkin_msg( $DTT_ID, $error = FALSE ) {
1156
+	public function get_checkin_msg($DTT_ID, $error = FALSE) {
1157 1157
 		//let's get the attendee first so we can include the name of the attendee
1158
-		$attendee = $this->get_first_related( 'Attendee' );
1159
-		if ( $attendee instanceof EE_Attendee ) {
1160
-			if ( $error ) {
1161
-				return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() );
1158
+		$attendee = $this->get_first_related('Attendee');
1159
+		if ($attendee instanceof EE_Attendee) {
1160
+			if ($error) {
1161
+				return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name());
1162 1162
 			}
1163
-			$cur_status = $this->check_in_status_for_datetime( $DTT_ID );
1163
+			$cur_status = $this->check_in_status_for_datetime($DTT_ID);
1164 1164
 			//what is the status message going to be?
1165
-			switch ( $cur_status ) {
1165
+			switch ($cur_status) {
1166 1166
 				case EE_Registration::checkin_status_never :
1167
-					return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() );
1167
+					return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name());
1168 1168
 					break;
1169 1169
 				case EE_Registration::checkin_status_in :
1170
-					return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() );
1170
+					return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name());
1171 1171
 					break;
1172 1172
 				case EE_Registration::checkin_status_out :
1173
-					return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() );
1173
+					return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name());
1174 1174
 					break;
1175 1175
 			}
1176 1176
 		}
1177
-		return __( "The check-in status could not be determined.", "event_espresso" );
1177
+		return __("The check-in status could not be determined.", "event_espresso");
1178 1178
 	}
1179 1179
 
1180 1180
 
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
 	 *        get Registration Code
1199 1199
 	 */
1200 1200
 	public function reg_code() {
1201
-		return $this->get( 'REG_code' );
1201
+		return $this->get('REG_code');
1202 1202
 	}
1203 1203
 
1204 1204
 
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 	 *        get Transaction ID
1208 1208
 	 */
1209 1209
 	public function transaction_ID() {
1210
-		return $this->get( 'TXN_ID' );
1210
+		return $this->get('TXN_ID');
1211 1211
 	}
1212 1212
 
1213 1213
 
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 	 * @return int
1217 1217
 	 */
1218 1218
 	public function ticket_ID() {
1219
-		return $this->get( 'TKT_ID' );
1219
+		return $this->get('TKT_ID');
1220 1220
 	}
1221 1221
 
1222 1222
 
@@ -1228,17 +1228,17 @@  discard block
 block discarded – undo
1228 1228
 	 * @param    string $REG_code Registration Code
1229 1229
 	 * @param	boolean $use_default
1230 1230
 	 */
1231
-	public function set_reg_code( $REG_code, $use_default = FALSE ) {
1232
-		if ( empty( $REG_code )) {
1233
-			EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1231
+	public function set_reg_code($REG_code, $use_default = FALSE) {
1232
+		if (empty($REG_code)) {
1233
+			EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1234 1234
 			return;
1235 1235
 		}
1236
-		if ( ! $this->reg_code() ) {
1237
-			parent::set( 'REG_code', $REG_code, $use_default );
1236
+		if ( ! $this->reg_code()) {
1237
+			parent::set('REG_code', $REG_code, $use_default);
1238 1238
 		} else {
1239 1239
 			EE_Error::doing_it_wrong(
1240
-				__CLASS__ . '::' . __FUNCTION__,
1241
-				__( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ),
1240
+				__CLASS__.'::'.__FUNCTION__,
1241
+				__('Can not change a registration REG_code once it has been set.', 'event_espresso'),
1242 1242
 				'4.6.0'
1243 1243
 			);
1244 1244
 		}
@@ -1258,17 +1258,17 @@  discard block
 block discarded – undo
1258 1258
 	 * @return EE_Registration[]  or empty array if this isn't a group registration.
1259 1259
 	 */
1260 1260
 	public function get_all_other_registrations_in_group() {
1261
-		if ( $this->group_size() < 2 ) {
1261
+		if ($this->group_size() < 2) {
1262 1262
 			return array();
1263 1263
 		}
1264 1264
 
1265 1265
 		$query[0] = array(
1266 1266
 			'TXN_ID' => $this->transaction_ID(),
1267
-			'REG_ID' => array( '!=', $this->ID() ),
1267
+			'REG_ID' => array('!=', $this->ID()),
1268 1268
 			'TKT_ID' => $this->ticket_ID()
1269 1269
 			);
1270 1270
 
1271
-		$registrations = $this->get_model()->get_all( $query );
1271
+		$registrations = $this->get_model()->get_all($query);
1272 1272
 		return $registrations;
1273 1273
 	}
1274 1274
 
@@ -1277,14 +1277,14 @@  discard block
 block discarded – undo
1277 1277
 	 * @return string
1278 1278
 	 */
1279 1279
 	public function get_admin_details_link() {
1280
-		EE_Registry::instance()->load_helper( 'URL' );
1280
+		EE_Registry::instance()->load_helper('URL');
1281 1281
 		return EEH_URL::add_query_args_and_nonce(
1282 1282
 			array(
1283 1283
 				'page' => 'espresso_registrations',
1284 1284
 				'action' => 'view_registration',
1285 1285
 				'_REG_ID' => $this->ID()
1286 1286
 			),
1287
-			admin_url( 'admin.php' )
1287
+			admin_url('admin.php')
1288 1288
 		);
1289 1289
 	}
1290 1290
 
@@ -1309,12 +1309,12 @@  discard block
 block discarded – undo
1309 1309
 	 * @return string
1310 1310
 	 */
1311 1311
 	public function get_admin_overview_link() {
1312
-		EE_Registry::instance()->load_helper( 'URL' );
1312
+		EE_Registry::instance()->load_helper('URL');
1313 1313
 		return EEH_URL::add_query_args_and_nonce(
1314 1314
 			array(
1315 1315
 				'page' => 'espresso_registrations'
1316 1316
 			),
1317
-			admin_url( 'admin.php' )
1317
+			admin_url('admin.php')
1318 1318
 		);
1319 1319
 	}
1320 1320
 
@@ -1325,8 +1325,8 @@  discard block
 block discarded – undo
1325 1325
 	 * @return \EE_Registration[]
1326 1326
 	 * @throws \EE_Error
1327 1327
 	 */
1328
-	public function payments( $query_params = array() ) {
1329
-		return $this->get_many_related( 'Payment', $query_params );
1328
+	public function payments($query_params = array()) {
1329
+		return $this->get_many_related('Payment', $query_params);
1330 1330
 	}
1331 1331
 
1332 1332
 
@@ -1336,8 +1336,8 @@  discard block
 block discarded – undo
1336 1336
 	 * @return \EE_Registration_Payment[]
1337 1337
 	 * @throws \EE_Error
1338 1338
 	 */
1339
-	public function registration_payments( $query_params = array() ) {
1340
-		return $this->get_many_related( 'Registration_Payment', $query_params );
1339
+	public function registration_payments($query_params = array()) {
1340
+		return $this->get_many_related('Registration_Payment', $query_params);
1341 1341
 	}
1342 1342
 
1343 1343
 
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 	 * @return EE_Payment_Method|null
1351 1351
 	 */
1352 1352
 	public function payment_method() {
1353
-		return EEM_Payment_Method::instance()->get_last_used_for_registration( $this );
1353
+		return EEM_Payment_Method::instance()->get_last_used_for_registration($this);
1354 1354
 	}
1355 1355
 
1356 1356
 
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -17,19 +17,19 @@  discard block
 block discarded – undo
17 17
 	protected static $_event;
18 18
 
19 19
 	/**
20
-	* array of datetimes and the spaces available for them
21
-	*
22
-	* @access private
23
-	* @var array
24
-	*/
20
+	 * array of datetimes and the spaces available for them
21
+	 *
22
+	 * @access private
23
+	 * @var array
24
+	 */
25 25
 	private static $_available_spaces = array();
26 26
 
27 27
 	/**
28
-	* max attendees that can register for event at one time
29
-	*
30
-	* @access private
31
-	* @var int
32
-	*/
28
+	 * max attendees that can register for event at one time
29
+	 *
30
+	 * @access private
31
+	 * @var int
32
+	 */
33 33
 	private static $_max_atndz = EE_INF;
34 34
 
35 35
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 				return $permalink_string;
198 198
 			}
199 199
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
200
-			                     . __( 'Embed', 'event_espresso' )
201
-			                     . '</a> ';
200
+								 . __( 'Embed', 'event_espresso' )
201
+								 . '</a> ';
202 202
 			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
203 203
 			$iframe_string = esc_html(
204 204
 				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	 * @throws \EE_Error
420 420
 	 */
421 421
 	public static function display_ticket_selector_submit() {
422
-        $html = '';
422
+		$html = '';
423 423
 		if ( ! is_admin() ) {
424 424
 			// standard TS displayed with submit button, ie: "Register Now"
425 425
 			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) {
@@ -478,14 +478,14 @@  discard block
 block discarded – undo
478 478
 				$html .= EED_Ticket_Selector::display_view_details_btn();
479 479
 			} else {
480 480
 				// no submit or view details button, and no additional content
481
-                $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
481
+				$html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
482 482
 			}
483
-            if ( ! is_archive()) {
484
-	            $html .= \EEH_Template::powered_by_event_espresso('', '', array( 'utm_content' => 'ticket_selector' ));
485
-            }
486
-        }
487
-        return $html;
488
-    }
483
+			if ( ! is_archive()) {
484
+				$html .= \EEH_Template::powered_by_event_espresso('', '', array( 'utm_content' => 'ticket_selector' ));
485
+			}
486
+		}
487
+		return $html;
488
+	}
489 489
 
490 490
 
491 491
 
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 	 * 	@return array|boolean
583 583
 	 */
584 584
 	public function process_ticket_selections() {
585
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
585
+		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
586 586
 		// do we have an event id?
587 587
 		if ( ! EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
588 588
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
@@ -1005,11 +1005,11 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
 
1007 1007
 	/**
1008
-	* 	load js
1009
-	*
1010
-	* 	@access 		public
1011
-	* 	@return 		void
1012
-	*/
1008
+	 * 	load js
1009
+	 *
1010
+	 * 	@access 		public
1011
+	 * 	@return 		void
1012
+	 */
1013 1013
 	public static function load_tckt_slctr_assets() {
1014 1014
 		// add some style
1015 1015
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
Please login to merge, or discard this patch.
Spacing   +215 added lines, -215 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
  * Ticket Selector  class
4 4
  *
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
 	 * @return EED_Ticket_Selector
48 48
 	 */
49 49
 	public static function instance() {
50
-		return parent::get_instance( __CLASS__ );
50
+		return parent::get_instance(__CLASS__);
51 51
 	}
52 52
 
53 53
 
54 54
 
55
-	protected function set_config(){
56
-		$this->set_config_section( 'template_settings' );
57
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
58
-		$this->set_config_name( 'EED_Ticket_Selector' );
55
+	protected function set_config() {
56
+		$this->set_config_section('template_settings');
57
+		$this->set_config_class('EE_Ticket_Selector_Config');
58
+		$this->set_config_name('EED_Ticket_Selector');
59 59
 	}
60 60
 
61 61
 
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public static function set_hooks() {
72 72
 		// routing
73
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
74
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
75
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
76
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
77
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
73
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
74
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
75
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
76
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
77
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
78 78
 	}
79 79
 
80 80
 
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 	 *  @return 	void
87 87
 	 */
88 88
 	public static function set_hooks_admin() {
89
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
89
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
90 90
 		//add button for iframe code to event editor.
91
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
92
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
91
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
92
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
93 93
 	}
94 94
 
95 95
 
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 	 *  @return 	void
102 102
 	 */
103 103
 	public static function set_definitions() {
104
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
105
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
104
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
105
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
106 106
 
107 107
 		//if config is not set, initialize
108 108
 		//If config is not set, set it.
109
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
109
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
110 110
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
111 111
 		}
112
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
112
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
113 113
 	}
114 114
 
115 115
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 * 	@param	WP $WP
121 121
 	 * 	@return void
122 122
 	 */
123
-	public function run( $WP ) {}
123
+	public function run($WP) {}
124 124
 
125 125
 
126 126
 
@@ -134,23 +134,23 @@  discard block
 block discarded – undo
134 134
 	public function ticket_selector_iframe() {
135 135
 		self::$_in_iframe = true;
136 136
 		/** @type EEM_Event $EEM_Event */
137
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
137
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
138 138
 		$event = $EEM_Event->get_one_by_ID(
139
-			EE_Registry::instance()->REQ->get( 'event', 0 )
139
+			EE_Registry::instance()->REQ->get('event', 0)
140 140
 		);
141
-		EE_Registry::instance()->REQ->set_espresso_page( true );
142
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
141
+		EE_Registry::instance()->REQ->set_espresso_page(true);
142
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
143 143
 		$template_args['css'] = apply_filters(
144 144
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
145 145
 			array(
146
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
147
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
148
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
149
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
146
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
147
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
148
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
149
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
150 150
 			)
151 151
 		);
152
-		EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true;
153
-		EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = esc_html__( 'Please choose at least one ticket before continuing.', 'event_espresso' );
152
+		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
153
+		EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = esc_html__('Please choose at least one ticket before continuing.', 'event_espresso');
154 154
 		$template_args['eei18n'] = apply_filters(
155 155
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings',
156 156
 			EE_Registry::localize_i18n_js_strings()
@@ -158,18 +158,18 @@  discard block
 block discarded – undo
158 158
 		$template_args['js'] = apply_filters(
159 159
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
160 160
 			array(
161
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
162
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
163
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
161
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
162
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
163
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
164 164
 			)
165 165
 		);
166
-		$template_args[ 'notices' ] = EEH_Template::display_template(
167
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
166
+		$template_args['notices'] = EEH_Template::display_template(
167
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
168 168
 			array(),
169 169
 			true
170 170
 		);
171 171
 		EEH_Template::display_template(
172
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
172
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
173 173
 			$template_args
174 174
 		);
175 175
 		exit;
@@ -188,25 +188,25 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @return string The new html string for the permalink area.
190 190
 	 */
191
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
191
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
192 192
 		//make sure this is ONLY when editing and the event id has been set.
193
-		if ( ! empty( $id ) ) {
194
-			$post = get_post( $id );
193
+		if ( ! empty($id)) {
194
+			$post = get_post($id);
195 195
 			//if NOT event then let's get out.
196
-			if ( $post->post_type !== 'espresso_events' ) {
196
+			if ($post->post_type !== 'espresso_events') {
197 197
 				return $permalink_string;
198 198
 			}
199 199
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
200
-			                     . __( 'Embed', 'event_espresso' )
200
+			                     . __('Embed', 'event_espresso')
201 201
 			                     . '</a> ';
202
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
202
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
203 203
 			$iframe_string = esc_html(
204
-				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
204
+				'<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>'
205 205
 			);
206 206
 			$permalink_string .= '
207 207
 <div id="js-ts-iframe" style="display:none">
208 208
 	<div style="width:100%; height: 500px;">
209
-		' . $iframe_string . '
209
+		' . $iframe_string.'
210 210
 	</div>
211 211
 </div>';
212 212
 		}
@@ -225,22 +225,22 @@  discard block
 block discarded – undo
225 225
 	 * @param 	mixed $event
226 226
 	 * @return 	bool
227 227
 	 */
228
-	protected static function set_event( $event = null ) {
229
-		if( $event === null ) {
228
+	protected static function set_event($event = null) {
229
+		if ($event === null) {
230 230
 			global $post;
231 231
 			$event = $post;
232 232
 		}
233
-		if ( $event instanceof EE_Event ) {
233
+		if ($event instanceof EE_Event) {
234 234
 			self::$_event = $event;
235
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
235
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
236 236
 			self::$_event = $event->EE_Event;
237
-		} else if ( $event instanceof WP_Post && $event->post_type === 'espresso_events' ) {
238
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
237
+		} else if ($event instanceof WP_Post && $event->post_type === 'espresso_events') {
238
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
239 239
 			self::$_event = $event->EE_Event;
240 240
 		} else {
241
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
242
-			$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' );
243
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
241
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
242
+			$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');
243
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
244 244
 			return false;
245 245
 		}
246 246
 		return true;
@@ -257,11 +257,11 @@  discard block
 block discarded – undo
257 257
 	 * @return string
258 258
 	 * @throws \EE_Error
259 259
 	 */
260
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
260
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
261 261
 		// reset filter for displaying submit button
262
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
262
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
263 263
 		// poke and prod incoming event till it tells us what it is
264
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
264
+		if ( ! EED_Ticket_Selector::set_event($event)) {
265 265
 			return false;
266 266
 		}
267 267
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 			&& (
273 273
 				! self::$_event->display_ticket_selector()
274 274
 				|| $view_details
275
-				|| post_password_required( $event_post )
275
+				|| post_password_required($event_post)
276 276
 				|| (
277 277
 					$_event_active_status !== EE_Datetime::active
278 278
 					&& $_event_active_status !== EE_Datetime::upcoming
@@ -290,34 +290,34 @@  discard block
 block discarded – undo
290 290
 		$template_args = array();
291 291
 		$template_args['event_status'] = $_event_active_status;
292 292
 
293
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
294
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
293
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
294
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
295 295
 
296 296
 		$template_args['EVT_ID'] = self::$_event->ID();
297 297
 		$template_args['event'] = self::$_event;
298 298
 
299 299
 		// is the event expired ?
300 300
 		$template_args['event_is_expired'] = self::$_event->is_expired();
301
-		if ( $template_args['event_is_expired'] ) {
302
-			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>';
301
+		if ($template_args['event_is_expired']) {
302
+			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>';
303 303
 		}
304 304
 
305 305
 		$ticket_query_args = array(
306
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
307
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
306
+			array('Datetime.EVT_ID' => self::$_event->ID()),
307
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
308 308
 		);
309 309
 
310
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
310
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
311 311
 			//use the correct applicable time query depending on what version of core is being run.
312
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
313
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
312
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
313
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
314 314
 		}
315 315
 
316 316
 		// get all tickets for this event ordered by the datetime
317
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
317
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
318 318
 
319
-		if ( count( $template_args['tickets'] ) < 1 ) {
320
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
319
+		if (count($template_args['tickets']) < 1) {
320
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
321 321
 		}
322 322
 
323 323
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
@@ -326,41 +326,41 @@  discard block
 block discarded – undo
326 326
 			self::$_event->additional_limit()
327 327
 		);
328 328
 		$template_args['max_atndz'] = \EED_Ticket_Selector::$_max_atndz;
329
-		if ( $template_args['max_atndz'] < 1 ) {
330
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
331
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
332
-				$sales_closed_msg .=  sprintf(
333
-					__( '%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' ),
329
+		if ($template_args['max_atndz'] < 1) {
330
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
331
+			if (current_user_can('edit_post', self::$_event->ID())) {
332
+				$sales_closed_msg .= sprintf(
333
+					__('%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'),
334 334
 					'<div class="ee-attention" style="text-align: left;"><b>',
335 335
 					'</b><br />',
336
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
336
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
337 337
 					'</a></span></div>'
338 338
 				);
339 339
 			}
340
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
340
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
341 341
 		}
342 342
 
343
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
344
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
343
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
344
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
345 345
 
346 346
 		// redirecting to another site for registration ??
347 347
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
348 348
 		// if not redirecting to another site for registration
349
-		if ( ! $external_url ) {
349
+		if ( ! $external_url) {
350 350
 			// then display the ticket selector
351
-			$ticket_selector = EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
351
+			$ticket_selector = EEH_Template::locate_template($templates['ticket_selector'], $template_args);
352 352
 		} else {
353 353
 			// if not we still need to trigger the display of the submit button
354
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
354
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
355 355
 			//display notice to admin that registration is external
356
-			$ticket_selector = ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
356
+			$ticket_selector = ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
357 357
 		}
358 358
 		// now set up the form (but not for the admin)
359 359
 		$ticket_selector = ! is_admin()
360 360
 			? EED_Ticket_Selector::ticket_selector_form_open(
361 361
 				self::$_event->ID(),
362 362
 				$external_url
363
-			) . $ticket_selector
363
+			).$ticket_selector
364 364
 			: $ticket_selector;
365 365
 		// submit button and form close tag
366 366
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -380,31 +380,31 @@  discard block
 block discarded – undo
380 380
 	 * @param 		string $external_url
381 381
 	 * @return 		string
382 382
 	 */
383
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
383
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
384 384
 		// if redirecting, we don't need any anything else
385
-		if ( $external_url ) {
386
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
387
-			$query_args = (array) EEH_URL::get_query_string( $external_url );
388
-			foreach ( $query_args as $query_arg => $value ) {
385
+		if ($external_url) {
386
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
387
+			$query_args = (array) EEH_URL::get_query_string($external_url);
388
+			foreach ($query_args as $query_arg => $value) {
389 389
 				$html .= '
390
-				<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
390
+				<input type="hidden" name="' . $query_arg.'" value="'.$value.'">';
391 391
 			}
392 392
 			return $html;
393 393
 		}
394 394
 		// if there is no submit button, then don't start building a form
395 395
 		// because the "View Details" button will build its own form
396
-		if ( ! apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) {
396
+		if ( ! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
397 397
 			return '';
398 398
 		}
399
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
400
-		if ( ! $checkout_url ) {
401
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
399
+		$checkout_url = EEH_Event_View::event_link_url($ID);
400
+		if ( ! $checkout_url) {
401
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
402 402
 		}
403 403
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
404
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
405
-		$html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce_' . $ID, TRUE, FALSE );
404
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
405
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce_'.$ID, TRUE, FALSE);
406 406
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
407
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
407
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
408 408
 		return $html;
409 409
 	}
410 410
 
@@ -420,26 +420,26 @@  discard block
 block discarded – undo
420 420
 	 */
421 421
 	public static function display_ticket_selector_submit() {
422 422
         $html = '';
423
-		if ( ! is_admin() ) {
423
+		if ( ! is_admin()) {
424 424
 			// standard TS displayed with submit button, ie: "Register Now"
425
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) {
425
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
426 426
 				$btn_text = apply_filters(
427 427
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
428
-					__('Register Now', 'event_espresso' ),
428
+					__('Register Now', 'event_espresso'),
429 429
 					EED_Ticket_Selector::$_event
430 430
 				);
431 431
 				$external_url = EED_Ticket_Selector::$_event->external_url();
432
-				$html .= '<input id="ticket-selector-submit-'. EED_Ticket_Selector::$_event->ID() .'-btn"';
432
+				$html .= '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"';
433 433
 				$html .= ' class="ticket-selector-submit-btn ';
434
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
435
-				$html .= ' type="submit" value="' . $btn_text . '" />';
434
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
435
+				$html .= ' type="submit" value="'.$btn_text.'" />';
436 436
 				$html .= apply_filters(
437 437
 					'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
438 438
 					'',
439 439
 					EED_Ticket_Selector::$_event
440 440
 				);
441 441
 				$html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
442
-				$html .= '<br/>' . \EED_Ticket_Selector::ticket_selector_form_close();
442
+				$html .= '<br/>'.\EED_Ticket_Selector::ticket_selector_form_close();
443 443
 			} else if (
444 444
 				// a "Dude Where's my Ticket Selector?" (DWMTS) type event (ie: $_max_atndz === 1)
445 445
 				EED_Ticket_Selector::$_max_atndz === 1
@@ -465,14 +465,14 @@  discard block
 block discarded – undo
465 465
 				$html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
466 466
 			} else if (
467 467
 				EED_Ticket_Selector::$_max_atndz === 1
468
-				&& apply_filters( 'FHEE__EE_Ticket_Selector__hide_ticket_selector', false )
468
+				&& apply_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector', false)
469 469
 				&& ! is_single()
470 470
 			) {
471 471
 				// this is a "Dude Where's my Ticket Selector?" (DWMTS) type event,
472 472
 				// but no tickets are available, so display event's "View Details" button.
473 473
 				// it is being viewed via somewhere other than a single post
474
-				$html .= EED_Ticket_Selector::display_view_details_btn( true );
475
-			} else if ( is_archive() ) {
474
+				$html .= EED_Ticket_Selector::display_view_details_btn(true);
475
+			} else if (is_archive()) {
476 476
 				// event list, no tickets available so display event's "View Details" button
477 477
 				$html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
478 478
 				$html .= EED_Ticket_Selector::display_view_details_btn();
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
                 $html .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
482 482
 			}
483 483
             if ( ! is_archive()) {
484
-	            $html .= \EEH_Template::powered_by_event_espresso('', '', array( 'utm_content' => 'ticket_selector' ));
484
+	            $html .= \EEH_Template::powered_by_event_espresso('', '', array('utm_content' => 'ticket_selector'));
485 485
             }
486 486
         }
487 487
         return $html;
@@ -543,22 +543,22 @@  discard block
 block discarded – undo
543 543
 	 * @return string
544 544
 	 * @throws \EE_Error
545 545
 	 */
546
-	public static function display_view_details_btn( $DWMTS = false) {
547
-		if ( ! self::$_event->get_permalink() ) {
546
+	public static function display_view_details_btn($DWMTS = false) {
547
+		if ( ! self::$_event->get_permalink()) {
548 548
 			EE_Error::add_error(
549
-				__('The URL for the Event Details page could not be retrieved.', 'event_espresso' ),
549
+				__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
550 550
 				__FILE__, __FUNCTION__, __LINE__
551 551
 			);
552 552
 		}
553
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
553
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
554 554
 		$btn_text = apply_filters(
555 555
 			'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
556
-			__( 'View Details', 'event_espresso' ),
556
+			__('View Details', 'event_espresso'),
557 557
 			self::$_event
558 558
 		);
559
-		$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 . '" />';
560
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
561
-		if ( $DWMTS ) {
559
+		$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.'" />';
560
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
561
+		if ($DWMTS) {
562 562
 			$view_details_btn .= \EED_Ticket_Selector::ticket_selector_form_close();
563 563
 			$view_details_btn .= \EED_Ticket_Selector::no_tkt_slctr_end_dv();
564 564
 			$view_details_btn .= '<br/>';
@@ -582,9 +582,9 @@  discard block
 block discarded – undo
582 582
 	 * 	@return array|boolean
583 583
 	 */
584 584
 	public function process_ticket_selections() {
585
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
585
+        do_action('EED_Ticket_Selector__process_ticket_selections__before');
586 586
 		// do we have an event id?
587
-		if ( ! EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
587
+		if ( ! EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
588 588
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
589 589
 			EE_Error::add_error(
590 590
 				sprintf(
@@ -600,17 +600,17 @@  discard block
 block discarded – undo
600 600
 			);
601 601
 		}
602 602
 		//if event id is valid
603
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ) );
603
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
604 604
 		// check nonce
605 605
 		if (
606 606
 			! is_admin()
607 607
 			&& (
608
-				! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce_' . $id )
609
-				|| ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce_' . $id ), 'process_ticket_selections' )
608
+				! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce_'.$id)
609
+				|| ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce_'.$id), 'process_ticket_selections')
610 610
 			)
611 611
 		) {
612 612
 			EE_Error::add_error(
613
-				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/>' ),
613
+				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/>'),
614 614
 				__FILE__, __FUNCTION__, __LINE__
615 615
 			);
616 616
 			return FALSE;
@@ -624,16 +624,16 @@  discard block
 block discarded – undo
624 624
 
625 625
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
626 626
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
627
-		EE_Registry::instance()->load_core( 'Session' );
627
+		EE_Registry::instance()->load_core('Session');
628 628
 		// unless otherwise requested, clear the session
629
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
630
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
629
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
630
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
631 631
 		}
632 632
 		//d( EE_Registry::instance()->SSN );
633 633
 
634
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
634
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
635 635
 		// validate/sanitize data
636
-		$valid = self::_validate_post_data( $id );
636
+		$valid = self::_validate_post_data($id);
637 637
 
638 638
 		//EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
639 639
 		//EEH_Debug_Tools::printr( $valid, '$valid', __FILE__, __LINE__ );
@@ -641,41 +641,41 @@  discard block
 block discarded – undo
641 641
 		//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
642 642
 
643 643
 		//check total tickets ordered vs max number of attendees that can register
644
-		if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
644
+		if ($valid['total_tickets'] > $valid['max_atndz']) {
645 645
 
646 646
 			// ordering too many tickets !!!
647 647
 			$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
648
-			$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
648
+			$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
649 649
 			// dev only message
650 650
 			$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');
651
-			$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
652
-			EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
651
+			$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
652
+			EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
653 653
 		} else {
654 654
 
655 655
 			// all data appears to be valid
656 656
 			$tckts_slctd = FALSE;
657 657
 			$success = TRUE;
658 658
 			// load cart
659
-			EE_Registry::instance()->load_core( 'Cart' );
659
+			EE_Registry::instance()->load_core('Cart');
660 660
 
661 661
 			// cycle thru the number of data rows sent from the event listing
662
-			for ( $x = 0; $x < $valid['rows']; $x++ ) {
662
+			for ($x = 0; $x < $valid['rows']; $x++) {
663 663
 				// does this row actually contain a ticket quantity?
664
-				if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
664
+				if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
665 665
 					// YES we have a ticket quantity
666 666
 					$tckts_slctd = TRUE;
667 667
 					//						d( $valid['ticket_obj'][$x] );
668
-					if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
668
+					if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
669 669
 						// then add ticket to cart
670
-						$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
670
+						$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
671 671
 						$success = ! $ticket_added ? FALSE : $success;
672
-						if ( EE_Error::has_error() ) {
672
+						if (EE_Error::has_error()) {
673 673
 							break;
674 674
 						}
675 675
 					} else {
676 676
 						// nothing added to cart retrieved
677 677
 						EE_Error::add_error(
678
-							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/>' ),
678
+							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/>'),
679 679
 							__FILE__, __FUNCTION__, __LINE__
680 680
 						);
681 681
 					}
@@ -684,45 +684,45 @@  discard block
 block discarded – undo
684 684
 			//d( EE_Registry::instance()->CART );
685 685
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
686 686
 
687
-			if ( $tckts_slctd ) {
688
-				if ( $success ) {
689
-					do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
687
+			if ($tckts_slctd) {
688
+				if ($success) {
689
+					do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
690 690
 					EE_Registry::instance()->CART->recalculate_all_cart_totals();
691
-					EE_Registry::instance()->CART->save_cart( FALSE );
691
+					EE_Registry::instance()->CART->save_cart(FALSE);
692 692
 					EE_Registry::instance()->SSN->update();
693 693
 					//d( EE_Registry::instance()->CART );
694 694
 					//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
695 695
 					// just return TRUE for registrations being made from admin
696
-					if ( is_admin() ) {
696
+					if (is_admin()) {
697 697
 						return TRUE;
698 698
 					}
699
-					wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
699
+					wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
700 700
 					exit();
701 701
 
702 702
 				} else {
703
-					if ( ! EE_Error::has_error() ) {
703
+					if ( ! EE_Error::has_error()) {
704 704
 						// nothing added to cart
705
-						EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
705
+						EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
706 706
 					}
707 707
 				}
708 708
 
709 709
 			} else {
710 710
 				// no ticket quantities were selected
711
-				EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
711
+				EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
712 712
 			}
713 713
 		}
714 714
 		//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
715 715
 		// at this point, just return if registration is being made from admin
716
-		if ( is_admin() ) {
716
+		if (is_admin()) {
717 717
 			return FALSE;
718 718
 		}
719
-		if ( $valid['return_url'] ) {
720
-			EE_Error::get_notices( FALSE, TRUE );
721
-			wp_safe_redirect( $valid['return_url'] );
719
+		if ($valid['return_url']) {
720
+			EE_Error::get_notices(FALSE, TRUE);
721
+			wp_safe_redirect($valid['return_url']);
722 722
 			exit();
723
-		} elseif ( isset( $event_to_add['id'] )) {
724
-			EE_Error::get_notices( FALSE, TRUE );
725
-			wp_safe_redirect( get_permalink( $event_to_add['id'] ));
723
+		} elseif (isset($event_to_add['id'])) {
724
+			EE_Error::get_notices(FALSE, TRUE);
725
+			wp_safe_redirect(get_permalink($event_to_add['id']));
726 726
 			exit();
727 727
 		} else {
728 728
 			echo EE_Error::get_notices();
@@ -742,13 +742,13 @@  discard block
 block discarded – undo
742 742
 	 * @param int $id
743 743
 	 * @return array|FALSE
744 744
 	 */
745
-	private static function _validate_post_data( $id = 0 ) {
746
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
745
+	private static function _validate_post_data($id = 0) {
746
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
747 747
 
748 748
 		//		d( $_POST );
749
-		if ( ! $id ) {
749
+		if ( ! $id) {
750 750
 			EE_Error::add_error(
751
-				__( 'The event id provided was not valid.', 'event_espresso' ),
751
+				__('The event id provided was not valid.', 'event_espresso'),
752 752
 				__FILE__,
753 753
 				__FUNCTION__,
754 754
 				__LINE__
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 		// grab valid id
761 761
 		$valid_data['id'] = $id;
762 762
 		// grab and sanitize return-url
763
-		$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
763
+		$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
764 764
 		// array of other form names
765 765
 		$inputs_to_clean = array(
766 766
 			'event_id' => 'tkt-slctr-event-id',
@@ -773,22 +773,22 @@  discard block
 block discarded – undo
773 773
 		// let's track the total number of tickets ordered.'
774 774
 		$valid_data['total_tickets'] = 0;
775 775
 		// cycle through $inputs_to_clean array
776
-		foreach ( $inputs_to_clean as $what => $input_to_clean ) {
776
+		foreach ($inputs_to_clean as $what => $input_to_clean) {
777 777
 			// check for POST data
778
-			if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
778
+			if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
779 779
 				// grab value
780
-				$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
780
+				$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
781 781
 				switch ($what) {
782 782
 
783 783
 					// integers
784 784
 					case 'event_id':
785
-						$valid_data[$what] = absint( $input_value );
785
+						$valid_data[$what] = absint($input_value);
786 786
 						// get event via the event id we put in the form
787
-						$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
787
+						$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
788 788
 						break;
789 789
 					case 'rows':
790 790
 					case 'max_atndz':
791
-						$valid_data[$what] = absint( $input_value );
791
+						$valid_data[$what] = absint($input_value);
792 792
 						break;
793 793
 
794 794
 					// arrays of integers
@@ -796,27 +796,27 @@  discard block
 block discarded – undo
796 796
 						/** @var array $row_qty */
797 797
 						$row_qty = $input_value;
798 798
 						// if qty is coming from a radio button input, then we need to assemble an array of rows
799
-						if( ! is_array( $row_qty )) {
799
+						if ( ! is_array($row_qty)) {
800 800
 							// get number of rows
801
-							$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
801
+							$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
802 802
 							//								d( $rows );
803 803
 							// explode ints by the dash
804
-							$row_qty = explode( '-', $row_qty );
805
-							$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
806
-							$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
807
-							$row_qty = array( $row => $qty );
804
+							$row_qty = explode('-', $row_qty);
805
+							$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
806
+							$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
807
+							$row_qty = array($row => $qty);
808 808
 							//								 d( $row_qty );
809
-							for( $x = 1; $x <= $rows; $x++ ) {
810
-								if ( ! isset( $row_qty[$x] )) {
809
+							for ($x = 1; $x <= $rows; $x++) {
810
+								if ( ! isset($row_qty[$x])) {
811 811
 									$row_qty[$x] = 0;
812 812
 								}
813 813
 							}
814 814
 						}
815
-						ksort( $row_qty );
815
+						ksort($row_qty);
816 816
 						//							 d( $row_qty );
817 817
 						// cycle thru values
818
-						foreach ( $row_qty as $qty ) {
819
-							$qty = absint( $qty );
818
+						foreach ($row_qty as $qty) {
819
+							$qty = absint($qty);
820 820
 							// sanitize as integers
821 821
 							$valid_data[$what][] = $qty;
822 822
 							$valid_data['total_tickets'] += $qty;
@@ -827,19 +827,19 @@  discard block
 block discarded – undo
827 827
 					case 'ticket_id':
828 828
 						$value_array = array();
829 829
 						// cycle thru values
830
-						foreach ( (array) $input_value as $key => $value ) {
830
+						foreach ((array) $input_value as $key => $value) {
831 831
 							// allow only numbers, letters,  spaces, commas and dashes
832
-							$value_array[ $key ] = wp_strip_all_tags( $value );
832
+							$value_array[$key] = wp_strip_all_tags($value);
833 833
 							// get ticket via the ticket id we put in the form
834
-							$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
835
-							$valid_data['ticket_obj'][ $key ] = $ticket_obj;
834
+							$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
835
+							$valid_data['ticket_obj'][$key] = $ticket_obj;
836 836
 						}
837
-						$valid_data[ $what ] = $value_array;
837
+						$valid_data[$what] = $value_array;
838 838
 						break;
839 839
 
840 840
 					case 'return_url' :
841 841
 						// grab and sanitize return-url
842
-						$valid_data[$what] = esc_url_raw( $input_value );
842
+						$valid_data[$what] = esc_url_raw($input_value);
843 843
 						break;
844 844
 
845 845
 				} 	// end switch $what
@@ -862,28 +862,28 @@  discard block
 block discarded – undo
862 862
 	 * @return TRUE on success, FALSE on fail
863 863
 	 * @throws \EE_Error
864 864
 	 */
865
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
866
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
865
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
866
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
867 867
 		// get the number of spaces left for this datetime ticket
868
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
868
+		$available_spaces = self::_ticket_datetime_availability($ticket);
869 869
 		// compare available spaces against the number of tickets being purchased
870
-		if ( $available_spaces >= $qty ) {
870
+		if ($available_spaces >= $qty) {
871 871
 			// allow addons to prevent a ticket from being added to cart
872
-			if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) {
872
+			if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) {
873 873
 				return false;
874 874
 			}
875 875
 			// add event to cart
876
-			if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
877
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
876
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
877
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
878 878
 				return true;
879 879
 			} else {
880 880
 				return false;
881 881
 			}
882 882
 		} else {
883 883
 			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
884
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
884
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
885 885
 			// greedy greedy greedy eh?
886
-			if ( $available_spaces > 0 ) {
886
+			if ($available_spaces > 0) {
887 887
 				// 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
888 888
 				EE_Error::add_error(
889 889
 					sprintf(
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 					__FILE__, __FUNCTION__, __LINE__
900 900
 				);
901 901
 			} else {
902
-				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__ );
902
+				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__);
903 903
 			}
904 904
 			return false;
905 905
 		}
@@ -918,22 +918,22 @@  discard block
 block discarded – undo
918 918
 	 * @return int
919 919
 	 * @throws \EE_Error
920 920
 	 */
921
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
921
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
922 922
 		// if the $_available_spaces array has not been set up yet...
923
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
924
-				self::_set_initial_ticket_datetime_availability( $ticket );
923
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
924
+				self::_set_initial_ticket_datetime_availability($ticket);
925 925
 		}
926 926
 		$available_spaces = $ticket->qty() - $ticket->sold();
927
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
927
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
928 928
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
929
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
929
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
930 930
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
931
-				if ( $get_original_ticket_spaces ) {
931
+				if ($get_original_ticket_spaces) {
932 932
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
933
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
933
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
934 934
 				} else {
935 935
 					// we want the updated ticket availability as stored in the "datetimes" array
936
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
936
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
937 937
 				}
938 938
 			}
939 939
 		}
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 	 * @return void
951 951
 	 * @throws \EE_Error
952 952
 	 */
953
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
953
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
954 954
 		// first, get all of the datetimes that are available to this ticket
955 955
 		$datetimes = $ticket->get_many_related(
956 956
 			'Datetime',
@@ -958,23 +958,23 @@  discard block
 block discarded – undo
958 958
 				array(
959 959
 					'DTT_EVT_end' => array(
960 960
 						'>=',
961
-						EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ),
961
+						EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'),
962 962
 					),
963 963
 				),
964
-				'order_by' => array( 'DTT_EVT_start' => 'ASC' ),
964
+				'order_by' => array('DTT_EVT_start' => 'ASC'),
965 965
 			)
966 966
 		);
967
-		if ( ! empty( $datetimes )) {
967
+		if ( ! empty($datetimes)) {
968 968
 			// now loop thru all of the datetimes
969
-			foreach ( $datetimes as $datetime  ) {
970
-				if ( $datetime instanceof EE_Datetime ) {
969
+			foreach ($datetimes as $datetime) {
970
+				if ($datetime instanceof EE_Datetime) {
971 971
 					// the number of spaces available for the datetime without considering individual ticket quantities
972 972
 					$spaces_remaining = $datetime->spaces_remaining();
973 973
 					// 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
974
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
974
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
975 975
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
976 976
 					// else just take the datetime spaces remaining, and assign to the datetimes array
977
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
977
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
978 978
 				}
979 979
 			}
980 980
 		}
@@ -990,12 +990,12 @@  discard block
 block discarded – undo
990 990
 	 * @param 	int   $qty
991 991
 	 * @return 	void
992 992
 	 */
993
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
994
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
993
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
994
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
995 995
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
996
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
996
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
997 997
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
998
-				self::$_available_spaces['datetimes'][ $DTD_ID ] -= $qty;
998
+				self::$_available_spaces['datetimes'][$DTD_ID] -= $qty;
999 999
 			}
1000 1000
 		}
1001 1001
 	}
@@ -1012,8 +1012,8 @@  discard block
 block discarded – undo
1012 1012
 	*/
1013 1013
 	public static function load_tckt_slctr_assets() {
1014 1014
 		// add some style
1015
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
1016
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
1015
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
1016
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
1017 1017
 			wp_enqueue_style('ticket_selector');
1018 1018
 			// make it dance
1019 1019
 			// wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -1027,9 +1027,9 @@  discard block
 block discarded – undo
1027 1027
 
1028 1028
 	public static function load_tckt_slctr_assets_admin() {
1029 1029
 		//iframe button js on admin event editor page
1030
-		if ( EE_Registry::instance()->REQ->get('page') === 'espresso_events' && EE_Registry::instance()->REQ->get('action') === 'edit' ) {
1031
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
1032
-			wp_enqueue_script( 'ticket_selector_embed' );
1030
+		if (EE_Registry::instance()->REQ->get('page') === 'espresso_events' && EE_Registry::instance()->REQ->get('action') === 'edit') {
1031
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
1032
+			wp_enqueue_script('ticket_selector_embed');
1033 1033
 		}
1034 1034
 	}
1035 1035
 
Please login to merge, or discard this patch.
core/admin/EE_Admin.core.php 1 patch
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public static function instance() {
42 42
 		// check if class object is instantiated
43
-		if (  ! self::$_instance instanceof EE_Admin ) {
43
+		if ( ! self::$_instance instanceof EE_Admin) {
44 44
 			self::$_instance = new self();
45 45
 		}
46 46
 		return self::$_instance;
@@ -57,30 +57,30 @@  discard block
 block discarded – undo
57 57
 		// define global EE_Admin constants
58 58
 		$this->_define_all_constants();
59 59
 		// set autoloaders for our admin page classes based on included path information
60
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
60
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
61 61
 		// admin hooks
62
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
62
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
63 63
 		// load EE_Request_Handler early
64
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
65
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
64
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
65
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
66 66
 		// post shortcode tracking
67 67
 		add_action(
68 68
 			'AHEE__EE_System__initialize_last',
69
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' )
69
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin')
70 70
 		);
71
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
72
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
73
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
74
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
75
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
76
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
77
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
78
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
71
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
72
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
73
+		add_action('admin_init', array($this, 'admin_init'), 100);
74
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
75
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
76
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
77
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
78
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
79 79
 
80 80
 		//reset Environment config (we only do this on admin page loads);
81 81
 		EE_Registry::instance()->CFG->environment->recheck_values();
82 82
 
83
-		do_action( 'AHEE__EE_Admin__loaded' );
83
+		do_action('AHEE__EE_Admin__loaded');
84 84
 	}
85 85
 
86 86
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	private function _define_all_constants() {
98
-		define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
99
-		define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
100
-		define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
101
-		define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
102
-		define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ));
98
+		define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
99
+		define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
100
+		define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
101
+		define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
102
+		define('WP_AJAX_URL', admin_url('admin-ajax.php'));
103 103
 	}
104 104
 
105 105
 
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
 	 * @param 	string 	$plugin
113 113
 	 * @return 	array
114 114
 	 */
115
-	public function filter_plugin_actions( $links, $plugin ) {
115
+	public function filter_plugin_actions($links, $plugin) {
116 116
 		// set $main_file in stone
117 117
 		static $main_file;
118 118
 		// if $main_file is not set yet
119
-		if ( ! $main_file ) {
120
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
119
+		if ( ! $main_file) {
120
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
121 121
 		}
122
-		 if ( $plugin === $main_file ) {
122
+		 if ($plugin === $main_file) {
123 123
 		 	// compare current plugin to this one
124
-			if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) {
125
-				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>';
126
-				array_unshift( $links, $maintenance_link );
124
+			if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) {
125
+				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>';
126
+				array_unshift($links, $maintenance_link);
127 127
 			} else {
128
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
129
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
128
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
129
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
130 130
 				// add before other links
131
-				array_unshift( $links, $org_settings_link, $events_link );
131
+				array_unshift($links, $org_settings_link, $events_link);
132 132
 			}
133 133
 		}
134 134
 		return $links;
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 *	@return void
144 144
 	 */
145 145
 	public function get_request() {
146
-		EE_Registry::instance()->load_core( 'Request_Handler' );
147
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
146
+		EE_Registry::instance()->load_core('Request_Handler');
147
+		EE_Registry::instance()->load_core('CPT_Strategy');
148 148
 	}
149 149
 
150 150
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	 * @param array $admin_page_folder_names
157 157
 	 * @return array
158 158
 	 */
159
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
159
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
160 160
 		return array(
161
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
162
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
163
-			'support' => EE_ADMIN_PAGES . 'support' . DS
161
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
162
+			'about' => EE_ADMIN_PAGES.'about'.DS,
163
+			'support' => EE_ADMIN_PAGES.'support'.DS
164 164
 		);
165 165
 	}
166 166
 
@@ -174,31 +174,31 @@  discard block
 block discarded – undo
174 174
 	*/
175 175
 	public function init() {
176 176
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
177
-		if ( EE_Maintenance_Mode::instance()->models_can_query() ){
177
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
178 178
 			//ok so we want to enable the entire admin
179
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
180
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
181
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
179
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
180
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
181
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
182 182
 			//at a glance dashboard widget
183
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 );
183
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
184 184
 			//filter for get_edit_post_link used on comments for custom post types
185
-			add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 );
185
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2);
186 186
 		}
187 187
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
188
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
188
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
189 189
 			try {
190 190
 				//this loads the controller for the admin pages which will setup routing etc
191
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
192
-			} catch ( EE_Error $e ) {
191
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
192
+			} catch (EE_Error $e) {
193 193
 				$e->get_error();
194 194
 			}
195 195
 		}
196
-		add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
196
+		add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
197 197
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
198
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
199
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
198
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
199
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
200 200
 		//exclude EE critical pages from all nav menus and wp_list_pages
201
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
201
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
202 202
 	}
203 203
 
204 204
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 	 * @param  object $post_type WP post type object
212 212
 	 * @return object            WP post type object
213 213
 	 */
214
-	public function remove_pages_from_nav_menu( $post_type ) {
214
+	public function remove_pages_from_nav_menu($post_type) {
215 215
 		//if this isn't the "pages" post type let's get out
216
-		if ( $post_type->name !== 'page' ) {
216
+		if ($post_type->name !== 'page') {
217 217
 			return $post_type;
218 218
 		}
219 219
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -233,28 +233,28 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function enable_hidden_ee_nav_menu_metaboxes() {
235 235
 		global $wp_meta_boxes, $pagenow;
236
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
236
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
237 237
 			return;
238 238
 		}
239 239
 		$user = wp_get_current_user();
240 240
 		//has this been done yet?
241
-		if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) {
241
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
242 242
 			return;
243 243
 		}
244 244
 
245
-		$hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID );
246
-		$initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) );
245
+		$hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID);
246
+		$initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page'));
247 247
 
248
-		if ( is_array( $hidden_meta_boxes ) ) {
249
-			foreach ( $hidden_meta_boxes as $key => $meta_box_id ) {
250
-				if ( in_array( $meta_box_id, $initial_meta_boxes ) ) {
251
-					unset( $hidden_meta_boxes[ $key ] );
248
+		if (is_array($hidden_meta_boxes)) {
249
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
250
+				if (in_array($meta_box_id, $initial_meta_boxes)) {
251
+					unset($hidden_meta_boxes[$key]);
252 252
 				}
253 253
 			}
254 254
 		}
255 255
 
256
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
257
-		update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true );
256
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
257
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
258 258
 	}
259 259
 
260 260
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return void
274 274
 	 */
275 275
 	public function register_custom_nav_menu_boxes() {
276
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
276
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
277 277
 	}
278 278
 
279 279
 
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return string  the (maybe) modified link
291 291
 	 */
292
-	public function modify_edit_post_link( $link, $id ) {
293
-		if ( ! $post = get_post( $id ) ){
292
+	public function modify_edit_post_link($link, $id) {
293
+		if ( ! $post = get_post($id)) {
294 294
 			return $link;
295 295
 		}
296
-		if ( $post->post_type === 'espresso_attendees' ) {
296
+		if ($post->post_type === 'espresso_attendees') {
297 297
 			$query_args = array(
298 298
 				'action' => 'edit_attendee',
299 299
 				'post' => $id
300 300
 			);
301
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
301
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
302 302
 		}
303 303
 		return $link;
304 304
 	}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 		global $nav_menu_selected_id;
311 311
 
312 312
 		$db_fields = false;
313
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
313
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
314 314
 		$current_tab = 'event-archives';
315 315
 
316 316
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 		?>
330 330
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
331 331
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
332
-				<li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>>
333
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));} ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
334
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
332
+				<li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>>
333
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); } ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
334
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
335 335
 					</a>
336 336
 				</li>
337 337
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -349,13 +349,13 @@  discard block
 block discarded – undo
349 349
  			<?php */ ?>
350 350
 
351 351
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
352
-			echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
352
+			echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
353 353
 			?>">
354 354
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
355 355
 					<?php
356 356
 					$pages = $this->_get_extra_nav_menu_pages_items();
357 357
 					$args['walker'] = $walker;
358
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
358
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
359 359
 					?>
360 360
 				</ul>
361 361
 			</div><!-- /.tabs-panel -->
@@ -363,18 +363,18 @@  discard block
 block discarded – undo
363 363
 			<p class="button-controls">
364 364
 				<span class="list-controls">
365 365
 					<a href="<?php
366
-						echo esc_url( add_query_arg(
366
+						echo esc_url(add_query_arg(
367 367
 							array(
368 368
 								'extra-nav-menu-pages-tab' => 'event-archives',
369 369
 								'selectall' => 1,
370 370
 							),
371
-							remove_query_arg( $removed_args )
371
+							remove_query_arg($removed_args)
372 372
 						));
373 373
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
374 374
 				</span>
375 375
 
376 376
 				<span class="add-to-menu">
377
-					<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" />
377
+					<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" />
378 378
 					<span class="spinner"></span>
379 379
 				</span>
380 380
 			</p>
@@ -395,10 +395,10 @@  discard block
 block discarded – undo
395 395
 	private function _get_extra_nav_menu_pages_items() {
396 396
 		$menuitems[] = array(
397 397
 			'title' => __('Event List', 'event_espresso'),
398
-			'url' => get_post_type_archive_link( 'espresso_events' ),
398
+			'url' => get_post_type_archive_link('espresso_events'),
399 399
 			'description' => __('Archive page for all events.', 'event_espresso')
400 400
 		);
401
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
401
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
402 402
 	}
403 403
 
404 404
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * @param $menu_item_values
411 411
 	 * @return stdClass
412 412
 	 */
413
-	private function _setup_extra_nav_menu_pages_items( $menu_item_values ) {
413
+	private function _setup_extra_nav_menu_pages_items($menu_item_values) {
414 414
 		$menu_item = new stdClass();
415 415
 		$keys = array(
416 416
 			'ID' => 0,
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 			'xfn' => ''
431 431
 		);
432 432
 
433
-		foreach ( $keys as $key => $value) {
434
-			$menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value;
433
+		foreach ($keys as $key => $value) {
434
+			$menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value;
435 435
 		}
436 436
 		return $menu_item;
437 437
 	}
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
 		 * - check if doing post processing of one of EE CPTs
471 471
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
472 472
 		 */
473
-		if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) {
474
-			EE_Registry::instance()->load_core( 'Register_CPTs' );
475
-			EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
473
+		if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') {
474
+			EE_Registry::instance()->load_core('Register_CPTs');
475
+			EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
476 476
 		}
477 477
 
478 478
 
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 		 * 'options-reading.php' core WordPress admin settings page.  This is for user-proofing.
482 482
 		 */
483 483
 		global $pagenow;
484
-		if ( $pagenow === 'options-reading.php' ) {
485
-			add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
484
+		if ($pagenow === 'options-reading.php') {
485
+			add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
486 486
 		}
487 487
 
488 488
 	}
@@ -494,25 +494,25 @@  discard block
 block discarded – undo
494 494
 	 * @param string $output  Current output.
495 495
 	 * @return string
496 496
 	 */
497
-	public function modify_dropdown_pages( $output ) {
497
+	public function modify_dropdown_pages($output) {
498 498
 		//get critical pages
499 499
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
500 500
 
501 501
 		//split current output by line break for easier parsing.
502
-		$split_output = explode( "\n", $output );
502
+		$split_output = explode("\n", $output);
503 503
 
504 504
 		//loop through to remove any critical pages from the array.
505
-		foreach ( $critical_pages as $page_id ) {
506
-			$needle = 'value="' . $page_id . '"';
507
-			foreach( $split_output as $key => $haystack ) {
508
-				if( strpos( $haystack, $needle ) !== false ) {
509
-					unset( $split_output[$key] );
505
+		foreach ($critical_pages as $page_id) {
506
+			$needle = 'value="'.$page_id.'"';
507
+			foreach ($split_output as $key => $haystack) {
508
+				if (strpos($haystack, $needle) !== false) {
509
+					unset($split_output[$key]);
510 510
 				}
511 511
 			}
512 512
 		}
513 513
 
514 514
 		//replace output with the new contents
515
-		return implode( "\n", $split_output );
515
+		return implode("\n", $split_output);
516 516
 	}
517 517
 
518 518
 
@@ -526,36 +526,36 @@  discard block
 block discarded – undo
526 526
 	public function enqueue_admin_scripts() {
527 527
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
528 528
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
529
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
529
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
530 530
 		// register cookie script for future dependencies
531
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
531
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
532 532
 		// jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
533
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
533
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
534 534
 			// register jQuery Validate
535
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
535
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
536 536
 		}
537 537
 		//joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' );
538
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
538
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
539 539
 			//joyride style
540
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
541
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
542
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
540
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
541
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
542
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
543 543
 			//joyride JS
544
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
544
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
545 545
 			// wanna go for a joyride?
546 546
 			wp_enqueue_style('ee-joyride-css');
547 547
 			wp_enqueue_script('jquery-joyride');
548 548
 		}
549 549
 		//qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' );
550
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
550
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
551 551
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
552 552
 		}
553 553
 		//accounting.js library
554 554
 		// @link http://josscrowcroft.github.io/accounting.js/
555
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
556
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
557
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
558
-			wp_enqueue_script( 'ee-accounting' );
555
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
556
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
557
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
558
+			wp_enqueue_script('ee-accounting');
559 559
 			// array of settings to get converted to JSON array via wp_localize_script
560 560
 			$currency_config = array(
561 561
 				'currency' => array(
@@ -602,11 +602,11 @@  discard block
 block discarded – undo
602 602
 	public function get_persistent_admin_notices() {
603 603
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
604 604
 		$args = array(
605
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
606
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
605
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
606
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
607 607
 		);
608
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
609
-		echo EE_Error::get_persistent_admin_notices( $return_url );
608
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
609
+		echo EE_Error::get_persistent_admin_notices($return_url);
610 610
 	}
611 611
 
612 612
 
@@ -627,26 +627,26 @@  discard block
 block discarded – undo
627 627
 	 * @param $elements
628 628
 	 * @return array
629 629
 	 */
630
-	public function dashboard_glance_items( $elements ) {
630
+	public function dashboard_glance_items($elements) {
631 631
 		$events = EEM_Event::instance()->count();
632
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
633
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
632
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
633
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
634 634
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
635 635
 		$registrations = EEM_Registration::instance()->count(
636 636
 			array(
637 637
 				array(
638
-					'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete )
638
+					'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)
639 639
 				)
640 640
 			)
641 641
 		);
642
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
643
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
642
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
643
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
644 644
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
645 645
 
646
-		$items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
646
+		$items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
647 647
 
648
-		foreach ( $items as $type => $item_properties ) {
649
-			$elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] );
648
+		foreach ($items as $type => $item_properties) {
649
+			$elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
650 650
 		}
651 651
 		return $elements;
652 652
 	}
@@ -663,31 +663,31 @@  discard block
 block discarded – undo
663 663
 	 * @throws EE_Error
664 664
 	 * @return    string
665 665
 	 */
666
-	public function check_for_invalid_datetime_formats( $value, $option ) {
666
+	public function check_for_invalid_datetime_formats($value, $option) {
667 667
 		// check for date_format or time_format
668
-		switch ( $option ) {
668
+		switch ($option) {
669 669
 			case 'date_format' :
670
-				$date_time_format = $value . ' ' . get_option('time_format');
670
+				$date_time_format = $value.' '.get_option('time_format');
671 671
 				break;
672 672
 			case 'time_format' :
673
-				$date_time_format = get_option('date_format') . ' ' . $value;
673
+				$date_time_format = get_option('date_format').' '.$value;
674 674
 				break;
675 675
 			default :
676 676
 				$date_time_format = FALSE;
677 677
 		}
678 678
 		// do we have a date_time format to check ?
679
-		if ( $date_time_format ) {
680
-			$error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format );
679
+		if ($date_time_format) {
680
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
681 681
 
682
-			if ( is_array( $error_msg ) ) {
683
-				$msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format  ) . '</p><p><ul>';
682
+			if (is_array($error_msg)) {
683
+				$msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>';
684 684
 
685 685
 
686
-				foreach ( $error_msg as $error ) {
687
-					$msg .= '<li>' . $error . '</li>';
686
+				foreach ($error_msg as $error) {
687
+					$msg .= '<li>'.$error.'</li>';
688 688
 				}
689 689
 
690
-				$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
690
+				$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
691 691
 
692 692
 				// trigger WP settings error
693 693
 				add_settings_error(
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 				);
698 698
 
699 699
 				// set format to something valid
700
-				switch ( $option ) {
700
+				switch ($option) {
701 701
 					case 'date_format' :
702 702
 						$value = 'F j, Y';
703 703
 						break;
@@ -719,8 +719,8 @@  discard block
 block discarded – undo
719 719
 	 * @param $content
720 720
 	 * @return    string
721 721
 	 */
722
-	public function its_eSpresso( $content ) {
723
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
722
+	public function its_eSpresso($content) {
723
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
724 724
 	}
725 725
 
726 726
 
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 	 *  @return 	string
733 733
 	 */
734 734
 	public function espresso_admin_footer() {
735
-		return \EEH_Template::powered_by_event_espresso( 'aln-cntr', '', array( 'utm_content' => 'admin_footer' ));
735
+		return \EEH_Template::powered_by_event_espresso('aln-cntr', '', array('utm_content' => 'admin_footer'));
736 736
 	}
737 737
 
738 738
 
@@ -751,12 +751,12 @@  discard block
 block discarded – undo
751 751
 	 * @param array $config
752 752
 	 * @return void
753 753
 	 */
754
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
755
-		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
756
-		if ( class_exists( 'EE_Register_Admin_Page' ) ) {
754
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
755
+		EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3');
756
+		if (class_exists('EE_Register_Admin_Page')) {
757 757
 			$config['page_path'] = $page_path;
758 758
 		}
759
-		EE_Register_Admin_Page::register( $page_basename, $config );
759
+		EE_Register_Admin_Page::register($page_basename, $config);
760 760
 
761 761
 	}
762 762
 
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
 	 * @param  \WP_Post $post
770 770
 	 * @return void
771 771
 	 */
772
-	public static function parse_post_content_on_save( $post_ID, $post ) {
772
+	public static function parse_post_content_on_save($post_ID, $post) {
773 773
 		EE_Error::doing_it_wrong(
774 774
 			__METHOD__,
775 775
 			__(
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 			),
779 779
 			'4.8.41'
780 780
 		);
781
-		EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post );
781
+		EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post);
782 782
 	}
783 783
 
784 784
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 * @param  $value
792 792
 	 * @return void
793 793
 	 */
794
-	public function reset_page_for_posts_on_change( $option, $old_value, $value ) {
794
+	public function reset_page_for_posts_on_change($option, $old_value, $value) {
795 795
 		EE_Error::doing_it_wrong(
796 796
 			__METHOD__,
797 797
 			__(
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 			),
801 801
 			'4.8.41'
802 802
 		);
803
-		EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value );
803
+		EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value);
804 804
 	}
805 805
 
806 806
 }
Please login to merge, or discard this patch.
core/libraries/messages/messenger/EE_Html_messenger.class.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'NO direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 	public function __construct() {
44 44
 		//set properties
45 45
 		$this->name = 'html';
46
-		$this->description = __( 'This messenger outputs a message to a browser for display.', 'event_espresso' );
46
+		$this->description = __('This messenger outputs a message to a browser for display.', 'event_espresso');
47 47
 		$this->label = array(
48
-			'singular' => __( 'html', 'event_espresso' ),
49
-			'plural'   => __( 'html', 'event_espresso' ),
48
+			'singular' => __('html', 'event_espresso'),
49
+			'plural'   => __('html', 'event_espresso'),
50 50
 		);
51 51
 		$this->activate_on_install = true;
52 52
 		// add the "powered by EE" credit link to the HTML receipt and invoice
53 53
 		add_filter(
54 54
 			'FHEE__EE_Html_messenger___send_message__main_body',
55
-			array( $this, 'add_powered_by_credit_link_to_receipt_and_invoice' ),
55
+			array($this, 'add_powered_by_credit_link_to_receipt_and_invoice'),
56 56
 			10,
57 57
 			3
58 58
 		);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @see abstract declaration in EE_messenger for details.
92 92
 	 */
93 93
 	protected function _set_admin_pages() {
94
-		$this->admin_registered_pages = array( 'events_edit' => true );
94
+		$this->admin_registered_pages = array('events_edit' => true);
95 95
 	}
96 96
 
97 97
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	protected function _set_validator_config() {
112 112
 		$this->_validator_config = array(
113 113
 			'subject'                       => array(
114
-				'shortcodes' => array( 'organization', 'primary_registration_details', 'email', 'transaction' ),
114
+				'shortcodes' => array('organization', 'primary_registration_details', 'email', 'transaction'),
115 115
 			),
116 116
 			'content'                       => array(
117 117
 				'shortcodes' => array(
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 					'primary_registration_list',
138 138
 					'event_author',
139 139
 				),
140
-				'required'   => array( '[EVENT_LIST]' ),
140
+				'required'   => array('[EVENT_LIST]'),
141 141
 			),
142 142
 			'ticket_list'                   => array(
143 143
 				'shortcodes' => array(
@@ -148,39 +148,39 @@  discard block
 block discarded – undo
148 148
 					'line_item_list',
149 149
 					'venue',
150 150
 				),
151
-				'required'   => array( '[TICKET_LIST]' ),
151
+				'required'   => array('[TICKET_LIST]'),
152 152
 			),
153 153
 			'ticket_line_item_no_pms'       => array(
154
-				'shortcodes' => array( 'line_item', 'ticket' ),
155
-				'required'   => array( '[TICKET_LINE_ITEM_LIST]' ),
154
+				'shortcodes' => array('line_item', 'ticket'),
155
+				'required'   => array('[TICKET_LINE_ITEM_LIST]'),
156 156
 			),
157 157
 			'ticket_line_item_pms'          => array(
158
-				'shortcodes' => array( 'line_item', 'ticket', 'line_item_list' ),
159
-				'required'   => array( '[TICKET_LINE_ITEM_LIST]' ),
158
+				'shortcodes' => array('line_item', 'ticket', 'line_item_list'),
159
+				'required'   => array('[TICKET_LINE_ITEM_LIST]'),
160 160
 			),
161 161
 			'price_modifier_line_item_list' => array(
162
-				'shortcodes' => array( 'line_item' ),
163
-				'required'   => array( '[PRICE_MODIFIER_LINE_ITEM_LIST]' ),
162
+				'shortcodes' => array('line_item'),
163
+				'required'   => array('[PRICE_MODIFIER_LINE_ITEM_LIST]'),
164 164
 			),
165 165
 			'datetime_list'                 => array(
166
-				'shortcodes' => array( 'datetime' ),
167
-				'required'   => array( '[DATETIME_LIST]' ),
166
+				'shortcodes' => array('datetime'),
167
+				'required'   => array('[DATETIME_LIST]'),
168 168
 			),
169 169
 			'attendee_list'                 => array(
170
-				'shortcodes' => array( 'attendee' ),
171
-				'required'   => array( '[ATTENDEE_LIST]' ),
170
+				'shortcodes' => array('attendee'),
171
+				'required'   => array('[ATTENDEE_LIST]'),
172 172
 			),
173 173
 			'tax_line_item_list'            => array(
174
-				'shortcodes' => array( 'line_item' ),
175
-				'required'   => array( '[TAX_LINE_ITEM_LIST]' ),
174
+				'shortcodes' => array('line_item'),
175
+				'required'   => array('[TAX_LINE_ITEM_LIST]'),
176 176
 			),
177 177
 			'additional_line_item_list'     => array(
178
-				'shortcodes' => array( 'line_item' ),
179
-				'required'   => array( '[ADDITIONAL_LINE_ITEM_LIST]' ),
178
+				'shortcodes' => array('line_item'),
179
+				'required'   => array('[ADDITIONAL_LINE_ITEM_LIST]'),
180 180
 			),
181 181
 			'payment_list'                  => array(
182
-				'shortcodes' => array( 'payment' ),
183
-				'required'   => array( '[PAYMENT_LIST_*]' ),
182
+				'shortcodes' => array('payment'),
183
+				'required'   => array('[PAYMENT_LIST_*]'),
184 184
 			),
185 185
 		);
186 186
 	}
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 	 * @param string $sending_messenger_name the name of the sending messenger so we only set the hooks needed.
197 197
 	 * @return void
198 198
 	 */
199
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
200
-		if ( $sending_messenger_name = 'pdf' ) {
201
-			add_filter( 'EE_messenger__get_variation__variation', array( $this, 'add_html_css' ), 10, 8 );
199
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
200
+		if ($sending_messenger_name = 'pdf') {
201
+			add_filter('EE_messenger__get_variation__variation', array($this, 'add_html_css'), 10, 8);
202 202
 		}
203 203
 	}
204 204
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	public function enqueue_scripts_styles() {
249 249
 		parent::enqueue_scripts_styles();
250
-		do_action( 'AHEE__EE_Html_messenger__enqueue_scripts_styles' );
250
+		do_action('AHEE__EE_Html_messenger__enqueue_scripts_styles');
251 251
 	}
252 252
 
253 253
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		$this->_template_fields = array(
276 276
 			'subject' => array(
277 277
 				'input'      => 'text',
278
-				'label'      => __( 'Page Title', 'event_espresso' ),
278
+				'label'      => __('Page Title', 'event_espresso'),
279 279
 				'type'       => 'string',
280 280
 				'required'   => true,
281 281
 				'validation' => true,
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 				'content' => array(
289 289
 					'main'                          => array(
290 290
 						'input'      => 'wp_editor',
291
-						'label'      => __( 'Main Content', 'event_espresso' ),
291
+						'label'      => __('Main Content', 'event_espresso'),
292 292
 						'type'       => 'string',
293 293
 						'required'   => true,
294 294
 						'validation' => true,
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 						'validation'          => true,
304 304
 						'format'              => '%s',
305 305
 						'rows'                => '15',
306
-						'shortcodes_required' => array( '[EVENT_LIST]' ),
306
+						'shortcodes_required' => array('[EVENT_LIST]'),
307 307
 					),
308 308
 					'ticket_list'                   => array(
309 309
 						'input'               => 'textarea',
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
 						'format'              => '%s',
315 315
 						'css_class'           => 'large-text',
316 316
 						'rows'                => '10',
317
-						'shortcodes_required' => array( '[TICKET_LIST]' ),
317
+						'shortcodes_required' => array('[TICKET_LIST]'),
318 318
 					),
319 319
 					'ticket_line_item_no_pms'       => array(
320 320
 						'input'               => 'textarea',
321
-						'label'               => '[TICKET_LINE_ITEM_LIST] <br>' . __(
321
+						'label'               => '[TICKET_LINE_ITEM_LIST] <br>'.__(
322 322
 								'Ticket Line Item List with no Price Modifiers',
323 323
 								'event_espresso'
324 324
 							),
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
 						'format'              => '%s',
329 329
 						'css_class'           => 'large-text',
330 330
 						'rows'                => '5',
331
-						'shortcodes_required' => array( '[TICKET_LINE_ITEM_LIST]' ),
331
+						'shortcodes_required' => array('[TICKET_LINE_ITEM_LIST]'),
332 332
 					),
333 333
 					'ticket_line_item_pms'          => array(
334 334
 						'input'               => 'textarea',
335
-						'label'               => '[TICKET_LINE_ITEM_LIST] <br>' . __(
335
+						'label'               => '[TICKET_LINE_ITEM_LIST] <br>'.__(
336 336
 								'Ticket Line Item List with Price Modifiers',
337 337
 								'event_espresso'
338 338
 							),
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 						'format'              => '%s',
343 343
 						'css_class'           => 'large-text',
344 344
 						'rows'                => '5',
345
-						'shortcodes_required' => array( '[TICKET_LINE_ITEM_LIST]' ),
345
+						'shortcodes_required' => array('[TICKET_LINE_ITEM_LIST]'),
346 346
 					),
347 347
 					'price_modifier_line_item_list' => array(
348 348
 						'input'               => 'textarea',
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 						'format'              => '%s',
354 354
 						'css_class'           => 'large-text',
355 355
 						'rows'                => '5',
356
-						'shortcodes_required' => array( '[PRICE_MODIFIER_LINE_ITEM_LIST]' ),
356
+						'shortcodes_required' => array('[PRICE_MODIFIER_LINE_ITEM_LIST]'),
357 357
 					),
358 358
 					'datetime_list'                 => array(
359 359
 						'input'               => 'textarea',
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 						'format'              => '%s',
365 365
 						'css_class'           => 'large-text',
366 366
 						'rows'                => '5',
367
-						'shortcodes_required' => array( '[DATETIME_LIST]' ),
367
+						'shortcodes_required' => array('[DATETIME_LIST]'),
368 368
 					),
369 369
 					'attendee_list'                 => array(
370 370
 						'input'               => 'textarea',
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 						'format'              => '%s',
376 376
 						'css_class'           => 'large-text',
377 377
 						'rows'                => '5',
378
-						'shortcodes_required' => array( '[ATTENDEE_LIST]' ),
378
+						'shortcodes_required' => array('[ATTENDEE_LIST]'),
379 379
 					),
380 380
 					'tax_line_item_list'            => array(
381 381
 						'input'               => 'textarea',
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 						'format'              => '%s',
387 387
 						'css_class'           => 'large-text',
388 388
 						'rows'                => '5',
389
-						'shortcodes_required' => array( '[TAX_LINE_ITEM_LIST]' ),
389
+						'shortcodes_required' => array('[TAX_LINE_ITEM_LIST]'),
390 390
 					),
391 391
 					'additional_line_item_list'     => array(
392 392
 						'input'               => 'textarea',
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 						'format'              => '%s',
398 398
 						'css_class'           => 'large-text',
399 399
 						'rows'                => '5',
400
-						'shortcodes_required' => array( '[ADDITIONAL_LINE_ITEM_LIST]' ),
400
+						'shortcodes_required' => array('[ADDITIONAL_LINE_ITEM_LIST]'),
401 401
 					),
402 402
 					'payment_list'                  => array(
403 403
 						'input'               => 'textarea',
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 						'format'              => '%s',
409 409
 						'css_class'           => 'large-text',
410 410
 						'rows'                => '5',
411
-						'shortcodes_required' => array( '[PAYMENT_LIST_*]' ),
411
+						'shortcodes_required' => array('[PAYMENT_LIST_*]'),
412 412
 					),
413 413
 				),
414 414
 			),
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 * @since 4.5.0
423 423
 	 */
424 424
 	protected function _set_default_message_types() {
425
-		$this->_default_message_types = array( 'receipt', 'invoice' );
425
+		$this->_default_message_types = array('receipt', 'invoice');
426 426
 	}
427 427
 
428 428
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	 * @since 4.5.0
433 433
 	 */
434 434
 	protected function _set_valid_message_types() {
435
-		$this->_valid_message_types = array( 'receipt', 'invoice' );
435
+		$this->_valid_message_types = array('receipt', 'invoice');
436 436
 	}
437 437
 
438 438
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	protected function _send_message() {
447 447
 		$this->_template_args = array(
448
-			'page_title' => html_entity_decode( stripslashes( $this->_subject ), ENT_QUOTES, "UTF-8" ),
448
+			'page_title' => html_entity_decode(stripslashes($this->_subject), ENT_QUOTES, "UTF-8"),
449 449
 			'base_css'   => $this->get_variation(
450 450
 				$this->_tmp_pack,
451 451
 				$this->_incoming_message_type->name,
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 			),
484 484
 		);
485 485
 		$this->_deregister_wp_hooks();
486
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) );
486
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles'));
487 487
 		echo $this->_get_main_template();
488 488
 		exit();
489 489
 	}
@@ -499,16 +499,16 @@  discard block
 block discarded – undo
499 499
 	 * @return void
500 500
 	 */
501 501
 	protected function _deregister_wp_hooks() {
502
-		remove_all_actions( 'wp_head' );
503
-		remove_all_actions( 'wp_footer' );
504
-		remove_all_actions( 'wp_print_footer_scripts' );
505
-		remove_all_actions( 'wp_enqueue_scripts' );
502
+		remove_all_actions('wp_head');
503
+		remove_all_actions('wp_footer');
504
+		remove_all_actions('wp_print_footer_scripts');
505
+		remove_all_actions('wp_enqueue_scripts');
506 506
 		global $wp_scripts, $wp_styles;
507 507
 		$wp_scripts = $wp_styles = array();
508 508
 		//just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load.
509
-		add_action( 'wp_footer', 'wp_print_footer_scripts' );
510
-		add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
511
-		add_action( 'wp_head', 'wp_enqueue_scripts' );
509
+		add_action('wp_footer', 'wp_print_footer_scripts');
510
+		add_action('wp_print_footer_scripts', '_wp_footer_scripts');
511
+		add_action('wp_head', 'wp_enqueue_scripts');
512 512
 	}
513 513
 
514 514
 
@@ -520,11 +520,11 @@  discard block
 block discarded – undo
520 520
 	 * @param bool $preview
521 521
 	 * @return string
522 522
 	 */
523
-	protected function _get_main_template( $preview = false ) {
524
-		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, 'main' );
523
+	protected function _get_main_template($preview = false) {
524
+		$wrapper_template = $this->_tmp_pack->get_wrapper($this->name, 'main');
525 525
 		//include message type as a template arg
526 526
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
527
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, true );
527
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, true);
528 528
 	}
529 529
 
530 530
 
@@ -557,15 +557,15 @@  discard block
 block discarded – undo
557 557
 		EE_message_type $incoming_message_type
558 558
 	) {
559 559
 		if (
560
-			( $incoming_message_type->name === 'invoice' || $incoming_message_type->name === 'receipt' )
561
-			&& apply_filters( 'FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', true )
560
+			($incoming_message_type->name === 'invoice' || $incoming_message_type->name === 'receipt')
561
+			&& apply_filters('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', true)
562 562
 		) {
563 563
 			$content .= \EEH_Template::powered_by_event_espresso(
564 564
 				'aln-cntr',
565 565
 				'',
566
-				array( 'utm_content' => 'messages_system' )
566
+				array('utm_content' => 'messages_system')
567 567
 			)
568
-			. EEH_HTML::div( EEH_HTML::p('&nbsp;') );
568
+			. EEH_HTML::div(EEH_HTML::p('&nbsp;'));
569 569
 		}
570 570
 		return $content;
571 571
 	}
Please login to merge, or discard this patch.
caffeinated/core/libraries/shortcodes/EE_Newsletter_Shortcodes.lib.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -20,81 +20,81 @@
 block discarded – undo
20 20
  */
21 21
 class EE_Newsletter_Shortcodes extends EE_Shortcodes {
22 22
 
23
-    protected function _init_props() {
24
-        $this->label = __("Batch Messages Shortcodes", 'event_espresso');
25
-        $this->description = __('All shortcodes used for the batch message type', 'event_espresso');
26
-        $this->_shortcodes = array(
27
-            '[NEWSLETTER_CONTENT]' => __('This will parse to whatever is found in the related [newsletter_content] field.  Note that when triggering a batch message, whatever is added for the custom message will be inserted where this shortcode is placed.', 'event_espresso')
28
-            );
29
-    }
23
+	protected function _init_props() {
24
+		$this->label = __("Batch Messages Shortcodes", 'event_espresso');
25
+		$this->description = __('All shortcodes used for the batch message type', 'event_espresso');
26
+		$this->_shortcodes = array(
27
+			'[NEWSLETTER_CONTENT]' => __('This will parse to whatever is found in the related [newsletter_content] field.  Note that when triggering a batch message, whatever is added for the custom message will be inserted where this shortcode is placed.', 'event_espresso')
28
+			);
29
+	}
30 30
 
31 31
 
32 32
 
33
-    protected function _parser( $shortcode ) {
34
-        if ( $shortcode == '[NEWSLETTER_CONTENT]' ) {
35
-            $this->_validate_list_requirements();
36
-            $valid_shortcodes = array('recipient_details', 'organization');
37
-            $template = $this->_data['template']['newsletter_content'];
38
-            $data = $this->_data;
39
-            return $this->_shortcode_helper->parse_message_template( $template, $data['data'], $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );
40
-        }
41
-    }
33
+	protected function _parser( $shortcode ) {
34
+		if ( $shortcode == '[NEWSLETTER_CONTENT]' ) {
35
+			$this->_validate_list_requirements();
36
+			$valid_shortcodes = array('recipient_details', 'organization');
37
+			$template = $this->_data['template']['newsletter_content'];
38
+			$data = $this->_data;
39
+			return $this->_shortcode_helper->parse_message_template( $template, $data['data'], $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );
40
+		}
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * Callback set in args for EE_Register_Messages_Shortcode_Library::register for 'msgr_validator_callback'.
46
-     *
47
-     * EE_Register_Messages_Shortcode_Library::register registers this callback with the
48
-     * 'FHEE__EE_messenger__get_validator_config' filter.
49
-     *
50
-     * @since    4.3.0
51
-     * @param  array        $validator_config  current validator configuration array
52
-     * @param  EE_messenger $messenger
53
-     * @return  array                                             new validator config.
54
-     */
55
-    public static function messenger_validator_config( $validator_config, EE_messenger $messenger ) {
56
-        if ( $messenger->name !== 'email' )
57
-            return $validator_config;
44
+	/**
45
+	 * Callback set in args for EE_Register_Messages_Shortcode_Library::register for 'msgr_validator_callback'.
46
+	 *
47
+	 * EE_Register_Messages_Shortcode_Library::register registers this callback with the
48
+	 * 'FHEE__EE_messenger__get_validator_config' filter.
49
+	 *
50
+	 * @since    4.3.0
51
+	 * @param  array        $validator_config  current validator configuration array
52
+	 * @param  EE_messenger $messenger
53
+	 * @return  array                                             new validator config.
54
+	 */
55
+	public static function messenger_validator_config( $validator_config, EE_messenger $messenger ) {
56
+		if ( $messenger->name !== 'email' )
57
+			return $validator_config;
58 58
 
59
-        $validator_config['content']['shortcodes'][] = 'newsletter';
60
-        $validator_config['newsletter_content'] = array(
61
-            'shortcodes' => array('recipient_details', 'organization'),
62
-            'required' => array('[NEWSLETTER_CONTENT]')
63
-            );
64
-        return $validator_config;
65
-    }
59
+		$validator_config['content']['shortcodes'][] = 'newsletter';
60
+		$validator_config['newsletter_content'] = array(
61
+			'shortcodes' => array('recipient_details', 'organization'),
62
+			'required' => array('[NEWSLETTER_CONTENT]')
63
+			);
64
+		return $validator_config;
65
+	}
66 66
 
67 67
 
68 68
 
69 69
 
70
-    /**
71
-     * Callback set in args for EE_Register_Messages_Shortcode_Library::register for
72
-     * 'msgr_template_fields_callback'.
73
-     *
74
-     * EE_Register_Messages_Shortcode_Library::register registers this callback with the
75
-     * FHEE__EE_messenger__get_template_fields filter.
76
-     *
77
-     * @since    4.3.0
78
-     *
79
-     * @param  array        $template_fields current template fields setup array.
80
-     * @param  EE_messenger $messenger
81
-     * @return  array                                           new/modified template fields array.
82
-     */
83
-    public static function messenger_template_fields( $template_fields, EE_messenger $messenger ) {
84
-        if ( $messenger->name !== 'email' )
85
-            return $template_fields;
70
+	/**
71
+	 * Callback set in args for EE_Register_Messages_Shortcode_Library::register for
72
+	 * 'msgr_template_fields_callback'.
73
+	 *
74
+	 * EE_Register_Messages_Shortcode_Library::register registers this callback with the
75
+	 * FHEE__EE_messenger__get_template_fields filter.
76
+	 *
77
+	 * @since    4.3.0
78
+	 *
79
+	 * @param  array        $template_fields current template fields setup array.
80
+	 * @param  EE_messenger $messenger
81
+	 * @return  array                                           new/modified template fields array.
82
+	 */
83
+	public static function messenger_template_fields( $template_fields, EE_messenger $messenger ) {
84
+		if ( $messenger->name !== 'email' )
85
+			return $template_fields;
86 86
 
87
-        $template_fields['extra']['content']['newsletter_content'] = array(
88
-            'input' => 'wp_editor',
89
-            'label' => '[NEWSLETTER_CONTENT]',
90
-            'type' => 'string',
91
-            'required' => TRUE,
92
-            'validation' => TRUE,
93
-            'format' => '%s',
94
-            'rows' => '15',
95
-            'shortcodes_required' => array('[NEWSLETTER_CONTENT]')
96
-            );
97
-        return $template_fields;
98
-    }
87
+		$template_fields['extra']['content']['newsletter_content'] = array(
88
+			'input' => 'wp_editor',
89
+			'label' => '[NEWSLETTER_CONTENT]',
90
+			'type' => 'string',
91
+			'required' => TRUE,
92
+			'validation' => TRUE,
93
+			'format' => '%s',
94
+			'rows' => '15',
95
+			'shortcodes_required' => array('[NEWSLETTER_CONTENT]')
96
+			);
97
+		return $template_fields;
98
+	}
99 99
 
100 100
 } //end class EE_Newsletter_Shortcodes
Please login to merge, or discard this patch.
messages/message_type/newsletter/EE_Newsletter_message_type.class.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 
23 23
 	public function __construct() {
24 24
 		$this->name = 'newsletter';
25
-		$this->description = __( 'Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.', 'event_espresso' );
25
+		$this->description = __('Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.', 'event_espresso');
26 26
 		$this->label = array(
27
-			'singular' => __( 'batch', 'event_espresso' ),
28
-			'plural' => __( 'batches', 'event_espresso' )
27
+			'singular' => __('batch', 'event_espresso'),
28
+			'plural' => __('batches', 'event_espresso')
29 29
 			);
30 30
 		$this->_master_templates = array(
31 31
 			'email' => 'registration',
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 
52
-	protected function _get_data_for_context( $context, EE_Registration $registration, $id ) {
52
+	protected function _get_data_for_context($context, EE_Registration $registration, $id) {
53 53
 		//newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects.
54
-		return array( $registration );
54
+		return array($registration);
55 55
 	}
56 56
 
57 57
 
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
 
65 65
 	protected function _set_contexts() {
66 66
 		$this->_context_label = array(
67
-			'label' => __( 'recipient', 'event_espresso' ),
68
-			'plural' => __( 'recipients', 'event_espresso' ),
69
-			'description' => __( 'Recipient\'s are who will receive the message.', 'event_espresso' )
67
+			'label' => __('recipient', 'event_espresso'),
68
+			'plural' => __('recipients', 'event_espresso'),
69
+			'description' => __('Recipient\'s are who will receive the message.', 'event_espresso')
70 70
 			);
71 71
 
72 72
 		$this->_contexts = array(
73 73
 			'attendee' => array(
74
-				'label' => __( 'Registrant', 'event_espresso' ),
75
-				'description' => __( 'This template goes to selected registrants.', 'event_espresso' )
74
+				'label' => __('Registrant', 'event_espresso'),
75
+				'description' => __('This template goes to selected registrants.', 'event_espresso')
76 76
 				)
77 77
 			);
78 78
 	}
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 			'newsletter',
99 99
 			);
100 100
 
101
-		foreach ( $this->_valid_shortcodes as $context => $shortcodes ) {
102
-			foreach ( $shortcodes as $key => $shortcode ) {
103
-				if ( ! in_array( $shortcode, $included_shortcodes ) ) {
104
-					unset( $this->_valid_shortcodes[ $context ][ $key ] );
101
+		foreach ($this->_valid_shortcodes as $context => $shortcodes) {
102
+			foreach ($shortcodes as $key => $shortcode) {
103
+				if ( ! in_array($shortcode, $included_shortcodes)) {
104
+					unset($this->_valid_shortcodes[$context][$key]);
105 105
 				}
106 106
 			}
107
-			$this->_valid_shortcodes[ $context ][] = 'newsletter';
107
+			$this->_valid_shortcodes[$context][] = 'newsletter';
108 108
 		}
109 109
 
110 110
 	}
@@ -118,44 +118,44 @@  discard block
 block discarded – undo
118 118
 		$addressee = array();
119 119
 
120 120
 		//looping through registrations
121
-		foreach ( $this->_data->registrations as $reg_id => $details ) {
121
+		foreach ($this->_data->registrations as $reg_id => $details) {
122 122
 			//set $attendee array to blank on each loop
123 123
 			$aee = array();
124 124
 
125 125
 			//need to get the attendee from this registration.
126
-			$attendee = isset( $details['att_obj'] ) && $details['att_obj'] instanceof EE_Attendee
126
+			$attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee
127 127
 				? $details['att_obj']
128 128
 				: null;
129 129
 
130
-			if ( ! $attendee instanceof EE_Attendee ) {
130
+			if ( ! $attendee instanceof EE_Attendee) {
131 131
 				continue;
132 132
 			}
133 133
 
134 134
 			//set $aee from attendee object
135 135
 			$aee['att_obj'] = $attendee;
136
-			$aee['reg_objs'] = isset( $this->_data->attendees[ $attendee->ID() ]['reg_objs'] )
137
-				? $this->_data->attendees[ $attendee->ID() ]['reg_objs']
136
+			$aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs'])
137
+				? $this->_data->attendees[$attendee->ID()]['reg_objs']
138 138
 				: array();
139 139
 			$aee['attendee_email'] = $attendee->email();
140
-			$aee['tkt_objs'] = isset( $this->_data->attendees[ $attendee->ID() ]['tkt_objs'] )
141
-				? $this->_data->attendees[ $attendee->ID() ]['tkt_objs']
140
+			$aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs'])
141
+				? $this->_data->attendees[$attendee->ID()]['tkt_objs']
142 142
 				: array();
143 143
 
144
-			if ( isset( $this->_data->attendees[ $attendee->ID() ]['evt_objs'] ) ) {
145
-				$aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
146
-				$aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
144
+			if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) {
145
+				$aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
146
+				$aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
147 147
 			} else {
148 148
 				$aee['evt_objs'] = $aee['events'] = array();
149 149
 			}
150 150
 
151
-			$aee['reg_obj'] = isset( $details['reg_obj'] )
151
+			$aee['reg_obj'] = isset($details['reg_obj'])
152 152
 				? $details['reg_obj']
153 153
 				: null;
154 154
 			$aee['attendees'] = $this->_data->attendees;
155 155
 
156 156
 			//merge in the primary attendee data
157
-			$aee = array_merge( $this->_default_addressee_data, $aee );
158
-			$addressee[] = new EE_Messages_Addressee( $aee );
157
+			$aee = array_merge($this->_default_addressee_data, $aee);
158
+			$addressee[] = new EE_Messages_Addressee($aee);
159 159
 		}
160 160
 		return $addressee;
161 161
 	}
Please login to merge, or discard this patch.
admin_pages/support/Support_Admin_Page.core.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 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
 /**
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 class Support_Admin_Page extends EE_Admin_Page {
31 31
 
32 32
 
33
-	public function __construct( $routing = TRUE ) {
34
-		parent::__construct( $routing );
33
+	public function __construct($routing = TRUE) {
34
+		parent::__construct($routing);
35 35
 	}
36 36
 
37 37
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 				'nav' => array(
85 85
 					'label' => __('Support', 'event_espresso'),
86 86
 					'order' => 30),
87
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_support_boxes' ) ),
87
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_support_boxes')),
88 88
 				'require_nonce' => FALSE
89 89
 				),
90 90
 			'developers' => array(
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 				'nav' => array(
99 99
 					'label' => __('Shortcodes', 'event_espresso'),
100 100
 					'order' => 60),
101
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_shortcodes_boxes' ) ),
101
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_shortcodes_boxes')),
102 102
 				'require_nonce' => FALSE
103 103
 				),
104 104
 			);
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 
120 120
 
121 121
 	protected function _installation() {
122
-		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php';
123
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE);
122
+		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_installation.template.php';
123
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE);
124 124
 		$this->display_admin_page_with_sidebar();
125 125
 	}
126 126
 
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 			'other_resources' => __('Other Resources', 'event_espresso')
146 146
 			);
147 147
 
148
-		foreach ( $boxes as $box => $label ) {
149
-			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php';
148
+		foreach ($boxes as $box => $label) {
149
+			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php';
150 150
 			$callback_args = array('template_path' => $template_path);
151
-			add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
151
+			add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
152 152
 		}
153 153
 	}
154 154
 
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 			'shortcodes_event_listings' => __('Event Listings', 'event_espresso'),
170 170
 			'shortcodes_ticket_selector' => __('Event Ticket Selector', 'event_espresso'),
171 171
 			'shortcodes_category' => __('Event Categories', 'event_espresso'),
172
-			'shortcodes_attendee' => __( 'Event Attendees', 'event_espresso' )
172
+			'shortcodes_attendee' => __('Event Attendees', 'event_espresso')
173 173
 			/*'shortcodes_single_events' => __('Single Events', 'event_espresso'),*/
174 174
 			/*'shortcodes_attendee_listings' => __('Attendee Listings', 'event_espresso'),*/
175 175
 			);
176 176
 
177
-		foreach ( $boxes as $box => $label ) {
178
-			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php';
177
+		foreach ($boxes as $box => $label) {
178
+			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php';
179 179
 			$callback_args = array('template_path' => $template_path);
180
-			add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
180
+			add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
181 181
 		}
182 182
 	}
183 183
 
@@ -196,17 +196,17 @@  discard block
 block discarded – undo
196 196
 			'important_information' => __('Important Information', 'event_espresso')
197 197
 			);
198 198
 
199
-		foreach ( $boxes as $box => $label ) {
200
-			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php';
199
+		foreach ($boxes as $box => $label) {
200
+			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php';
201 201
 			$callback_args = array('template_path' => $template_path, 'template_args' => $this->_template_args);
202
-			add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
202
+			add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
203 203
 		}
204 204
 	}
205 205
 
206 206
 
207 207
 	protected function _developers() {
208
-		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php';
209
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true );
208
+		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'developers_admin_details.template.php';
209
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true);
210 210
 		$this->display_admin_page_with_sidebar();
211 211
 	}
212 212
 } //end Support_Admin_Page class
Please login to merge, or discard this patch.
payment_methods/Paypal_Standard/EEG_Paypal_Standard.gateway.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -274,26 +274,26 @@  discard block
 block discarded – undo
274 274
 		if ( ! $this->validate_ipn( $update_info, $payment ) ) {
275 275
 			return $payment;
276 276
 		}
277
-        // kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction,
278
-        // registrations, ticket counts, etc)
279
-        if (
280
-            (
281
-                $update_info[ 'payment_status' ] === 'Refunded'
282
-                || $update_info[ 'payment_status' ] === 'Partially_Refunded'
283
-            )
284
-            && apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true )
285
-        ) {
286
-            throw new EventEspresso\core\exceptions\IpnException(
287
-                sprintf(
288
-                    esc_html__( 'Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'),
289
-                    $update_info['payment_status']
290
-                ),
291
-                EventEspresso\core\exceptions\IpnException::UNSUPPORTED,
292
-                null,
293
-                $payment,
294
-                $update_info
295
-            );
296
-        }
277
+		// kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction,
278
+		// registrations, ticket counts, etc)
279
+		if (
280
+			(
281
+				$update_info[ 'payment_status' ] === 'Refunded'
282
+				|| $update_info[ 'payment_status' ] === 'Partially_Refunded'
283
+			)
284
+			&& apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true )
285
+		) {
286
+			throw new EventEspresso\core\exceptions\IpnException(
287
+				sprintf(
288
+					esc_html__( 'Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'),
289
+					$update_info['payment_status']
290
+				),
291
+				EventEspresso\core\exceptions\IpnException::UNSUPPORTED,
292
+				null,
293
+				$payment,
294
+				$update_info
295
+			);
296
+		}
297 297
 		//ok, well let's process this payment then!
298 298
 		switch ( $update_info[ 'payment_status' ] ) {
299 299
 
@@ -541,17 +541,17 @@  discard block
 block discarded – undo
541 541
 
542 542
 		//might paypal have changed the taxes?
543 543
 		if( $this->_paypal_taxes && $payment_was_itemized ) {
544
-            // note that we're doing this BEFORE adding shipping;
544
+			// note that we're doing this BEFORE adding shipping;
545 545
 			// we actually want PayPal's shipping to remain non-taxable
546
-            $this->_line_item->set_line_items_taxable( $transaction_total_line_item, true, 'paypal_shipping' );
547
-            $this->_line_item->set_total_tax_to(
548
-	            $transaction_total_line_item,
549
-                (float)$update_info['tax'],
550
-                esc_html__( 'Taxes', 'event_espresso' ),
551
-                esc_html__( 'Calculated by Paypal', 'event_espresso' ),
552
-                'paypal_tax'
553
-            );
554
-            $grand_total_needs_resaving = TRUE;
546
+			$this->_line_item->set_line_items_taxable( $transaction_total_line_item, true, 'paypal_shipping' );
547
+			$this->_line_item->set_total_tax_to(
548
+				$transaction_total_line_item,
549
+				(float)$update_info['tax'],
550
+				esc_html__( 'Taxes', 'event_espresso' ),
551
+				esc_html__( 'Calculated by Paypal', 'event_espresso' ),
552
+				'paypal_tax'
553
+			);
554
+			$grand_total_needs_resaving = TRUE;
555 555
 		}
556 556
 
557 557
 		$shipping_amount = (float)$update_info[ 'mc_shipping' ];
Please login to merge, or discard this patch.
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @return EEG_Paypal_Standard
71 71
 	 */
72 72
 	public function __construct() {
73
-		$this->set_uses_separate_IPN_request( true ) ;
73
+		$this->set_uses_separate_IPN_request(true);
74 74
 		parent::__construct();
75 75
 	}
76 76
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * Also sets the gateway url class variable based on whether debug mode is enabled or not
81 81
 	 * @param array $settings_array
82 82
 	 */
83
-	public function set_settings($settings_array){
83
+	public function set_settings($settings_array) {
84 84
 		parent::set_settings($settings_array);
85 85
 		$this->_gateway_url = $this->_debug_mode
86 86
 			? 'https://www.sandbox.paypal.com/cgi-bin/webscr'
@@ -114,42 +114,42 @@  discard block
 block discarded – undo
114 114
 
115 115
 		$total_discounts_to_cart_total = $transaction->paid();
116 116
 		//only itemize the order if we're paying for the rest of the order's amount
117
-		if( EEH_Money::compare_floats( $payment->amount(), $transaction->total(), '==' ) ) {
118
-			$payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true );
117
+		if (EEH_Money::compare_floats($payment->amount(), $transaction->total(), '==')) {
118
+			$payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true);
119 119
 			//this payment is for the remaining transaction amount,
120 120
 			//keep track of exactly how much the itemized order amount equals
121 121
 			$itemized_sum = 0;
122 122
 			$shipping_previously_added = 0;
123 123
 			//so let's show all the line items
124
-			foreach($total_line_item->get_items() as $line_item){
125
-				if ( $line_item instanceof EE_Line_Item ) {
124
+			foreach ($total_line_item->get_items() as $line_item) {
125
+				if ($line_item instanceof EE_Line_Item) {
126 126
 					//it's some kind of discount
127
-					if( $line_item->total() < 0 ) {
128
-						$total_discounts_to_cart_total += abs( $line_item->total() );
127
+					if ($line_item->total() < 0) {
128
+						$total_discounts_to_cart_total += abs($line_item->total());
129 129
 						$itemized_sum += $line_item->total();
130 130
 						continue;
131 131
 					}
132 132
 					//dont include shipping again.
133
-					if( strpos( $line_item->code(), 'paypal_shipping_') === 0 ) {
133
+					if (strpos($line_item->code(), 'paypal_shipping_') === 0) {
134 134
 						$shipping_previously_added = $line_item->total();
135 135
 						continue;
136 136
 					}
137
-					$redirect_args[ 'item_name_' . $item_num ] = substr(
138
-						$this->_format_line_item_name( $line_item, $payment ),
137
+					$redirect_args['item_name_'.$item_num] = substr(
138
+						$this->_format_line_item_name($line_item, $payment),
139 139
 						0, 127
140 140
 					);
141
-					$redirect_args[ 'amount_' . $item_num ] = $line_item->unit_price();
142
-					$redirect_args[ 'quantity_' . $item_num ] = $line_item->quantity();
141
+					$redirect_args['amount_'.$item_num] = $line_item->unit_price();
142
+					$redirect_args['quantity_'.$item_num] = $line_item->quantity();
143 143
 					//if we're not letting PayPal calculate shipping, tell them its 0
144
-					if ( ! $this->_paypal_shipping ) {
145
-						$redirect_args[ 'shipping_' . $item_num ] = '0';
146
-						$redirect_args[ 'shipping2_' . $item_num ] = '0';
144
+					if ( ! $this->_paypal_shipping) {
145
+						$redirect_args['shipping_'.$item_num] = '0';
146
+						$redirect_args['shipping2_'.$item_num] = '0';
147 147
 					}
148 148
 					$item_num++;
149 149
 					$itemized_sum += $line_item->total();
150 150
 				}
151 151
 			}
152
-			$taxes_li = $this->_line_item->get_taxes_subtotal( $total_line_item );
152
+			$taxes_li = $this->_line_item->get_taxes_subtotal($total_line_item);
153 153
 			//ideally itemized sum equals the transaction total. but if not (which is weird)
154 154
 			//and the itemized sum is LESS than the transaction total
155 155
 			//add another line item
@@ -159,47 +159,47 @@  discard block
 block discarded – undo
159 159
 				$transaction->total() - $itemized_sum - $taxes_li->total() - $shipping_previously_added,
160 160
 				2
161 161
 			);
162
-			if( $itemized_sum_diff_from_txn_total < 0 ) {
162
+			if ($itemized_sum_diff_from_txn_total < 0) {
163 163
 				//itemized sum is too big
164
-				$total_discounts_to_cart_total += abs( $itemized_sum_diff_from_txn_total );
165
-			} elseif( $itemized_sum_diff_from_txn_total > 0 ) {
166
-				$redirect_args[ 'item_name_' . $item_num ] = substr(
167
-						__( 'Other charges', 'event_espresso' ), 0, 127 );
168
-				$redirect_args[ 'amount_' . $item_num ] = $this->format_currency( $itemized_sum_diff_from_txn_total );
169
-				$redirect_args[ 'quantity_' . $item_num ] = 1;
164
+				$total_discounts_to_cart_total += abs($itemized_sum_diff_from_txn_total);
165
+			} elseif ($itemized_sum_diff_from_txn_total > 0) {
166
+				$redirect_args['item_name_'.$item_num] = substr(
167
+						__('Other charges', 'event_espresso'), 0, 127 );
168
+				$redirect_args['amount_'.$item_num] = $this->format_currency($itemized_sum_diff_from_txn_total);
169
+				$redirect_args['quantity_'.$item_num] = 1;
170 170
 				$item_num++;
171 171
 			}
172
-			if( $total_discounts_to_cart_total > 0 ) {
173
-				$redirect_args[ 'discount_amount_cart' ] = $this->format_currency( $total_discounts_to_cart_total );
172
+			if ($total_discounts_to_cart_total > 0) {
173
+				$redirect_args['discount_amount_cart'] = $this->format_currency($total_discounts_to_cart_total);
174 174
 			}
175 175
 			//add our taxes to the order if we're NOT using PayPal's
176
-			if( ! $this->_paypal_taxes ){
176
+			if ( ! $this->_paypal_taxes) {
177 177
 				$redirect_args['tax_cart'] = $total_line_item->get_total_tax();
178 178
 			}
179 179
 		} else {
180
-			$payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, false );
180
+			$payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, false);
181 181
 			//partial payment that's not for the remaining amount, so we can't send an itemized list
182
-			$redirect_args['item_name_' . $item_num] = substr(
183
-				$this->_format_partial_payment_line_item_name( $payment ),
182
+			$redirect_args['item_name_'.$item_num] = substr(
183
+				$this->_format_partial_payment_line_item_name($payment),
184 184
 				0, 127
185 185
 			);
186
-			$redirect_args['amount_' . $item_num] = $payment->amount();
187
-			$redirect_args['shipping_' . $item_num ] = '0';
188
-			$redirect_args['shipping2_' . $item_num ] = '0';
186
+			$redirect_args['amount_'.$item_num] = $payment->amount();
187
+			$redirect_args['shipping_'.$item_num] = '0';
188
+			$redirect_args['shipping2_'.$item_num] = '0';
189 189
 			$redirect_args['tax_cart'] = '0';
190 190
 			$item_num++;
191 191
 		}
192 192
 
193
-		if($this->_debug_mode){
194
-			$redirect_args['item_name_' . $item_num] = 'DEBUG INFO (this item only added in sandbox mode';
195
-			$redirect_args['amount_' . $item_num] = 0;
193
+		if ($this->_debug_mode) {
194
+			$redirect_args['item_name_'.$item_num] = 'DEBUG INFO (this item only added in sandbox mode';
195
+			$redirect_args['amount_'.$item_num] = 0;
196 196
 			$redirect_args['on0_'.$item_num] = 'NOTIFY URL';
197
-			$redirect_args['os0_' . $item_num] = $notify_url;
197
+			$redirect_args['os0_'.$item_num] = $notify_url;
198 198
 			$redirect_args['on1_'.$item_num] = 'RETURN URL';
199
-			$redirect_args['os1_' . $item_num] = $return_url;
199
+			$redirect_args['os1_'.$item_num] = $return_url;
200 200
 //			$redirect_args['option_index_' . $item_num] = 1; // <-- dunno if this is needed ?
201
-			$redirect_args['shipping_' . $item_num ] = '0';
202
-			$redirect_args['shipping2_' . $item_num ] = '0';
201
+			$redirect_args['shipping_'.$item_num] = '0';
202
+			$redirect_args['shipping2_'.$item_num] = '0';
203 203
 		}
204 204
 
205 205
 		$redirect_args['business'] = $this->_paypal_id;
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
 		$redirect_args['cmd'] = '_cart';
210 210
 		$redirect_args['upload'] = 1;
211 211
 		$redirect_args['currency_code'] = $payment->currency_code();
212
-		$redirect_args['rm'] = 2;//makes the user return with method=POST
213
-		if($this->_image_url){
212
+		$redirect_args['rm'] = 2; //makes the user return with method=POST
213
+		if ($this->_image_url) {
214 214
 			$redirect_args['image_url'] = $this->_image_url;
215 215
 		}
216 216
 		$redirect_args['no_shipping'] = $this->_shipping_details;
217
-		$redirect_args['bn'] = 'EventEspresso_SP';//EE will blow up if you change this
217
+		$redirect_args['bn'] = 'EventEspresso_SP'; //EE will blow up if you change this
218 218
 
219
-		$redirect_args = apply_filters( "FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this );
219
+		$redirect_args = apply_filters("FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this);
220 220
 
221 221
 		$payment->set_redirect_url($this->_gateway_url);
222 222
 		$payment->set_redirect_args($redirect_args);
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		$this->log(
225 225
 			array(
226 226
 				'message'     => sprintf(
227
-					__( 'PayPal payment request initiated.', 'event_espresso' )
227
+					__('PayPal payment request initiated.', 'event_espresso')
228 228
 				),
229 229
 				'transaction' => $transaction->model_field_array(),
230 230
 			),
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
 	 * @return \EEI_Payment updated
245 245
 	 * @throws \EE_Error, IpnException
246 246
 	 */
247
-	public function handle_payment_update( $update_info, $transaction ){
247
+	public function handle_payment_update($update_info, $transaction) {
248 248
 		// verify there's payment data that's been sent
249
-		if ( empty( $update_info[ 'payment_status' ] ) || empty( $update_info[ 'txn_id' ] ) ) {
249
+		if (empty($update_info['payment_status']) || empty($update_info['txn_id'])) {
250 250
 			// log the results
251 251
 			$this->log(
252 252
 				array(
253 253
 					'message' => sprintf(
254
-						__( 'PayPal IPN response is missing critical payment data. This may indicate a PDT request and require your PayPal account settings to be corrected.', 'event_espresso' )
254
+						__('PayPal IPN response is missing critical payment data. This may indicate a PDT request and require your PayPal account settings to be corrected.', 'event_espresso')
255 255
 					),
256 256
 					'update_info' => $update_info,
257 257
 				),
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
 			);
260 260
 			// waaaait... is this a PDT request? (see https://developer.paypal.com/docs/classic/products/payment-data-transfer/)
261 261
 			// indicated by the "tx" argument? If so, we don't need it. We'll just use the IPN data when it comes
262
-			if ( isset( $update_info[ 'tx' ] ) ) {
262
+			if (isset($update_info['tx'])) {
263 263
 				return $transaction->last_payment();
264 264
 			} else {
265 265
 				return null;
266 266
 			}
267 267
 		}
268
-		$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr( $update_info[ 'txn_id' ] );
269
-		if ( ! $payment instanceof EEI_Payment ) {
268
+		$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info['txn_id']);
269
+		if ( ! $payment instanceof EEI_Payment) {
270 270
 			$payment = $transaction->last_payment();
271 271
 		}
272 272
 		// ok, then validate the IPN. Even if we've already processed this payment,
273 273
 		// let PayPal know we don't want to hear from them anymore!
274
-		if ( ! $this->validate_ipn( $update_info, $payment ) ) {
274
+		if ( ! $this->validate_ipn($update_info, $payment)) {
275 275
 			return $payment;
276 276
 		}
277 277
         // kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction,
278 278
         // registrations, ticket counts, etc)
279 279
         if (
280 280
             (
281
-                $update_info[ 'payment_status' ] === 'Refunded'
282
-                || $update_info[ 'payment_status' ] === 'Partially_Refunded'
281
+                $update_info['payment_status'] === 'Refunded'
282
+                || $update_info['payment_status'] === 'Partially_Refunded'
283 283
             )
284
-            && apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true )
284
+            && apply_filters('FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true)
285 285
         ) {
286 286
             throw new EventEspresso\core\exceptions\IpnException(
287 287
                 sprintf(
288
-                    esc_html__( 'Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'),
288
+                    esc_html__('Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'),
289 289
                     $update_info['payment_status']
290 290
                 ),
291 291
                 EventEspresso\core\exceptions\IpnException::UNSUPPORTED,
@@ -295,34 +295,34 @@  discard block
 block discarded – undo
295 295
             );
296 296
         }
297 297
 		//ok, well let's process this payment then!
298
-		switch ( $update_info[ 'payment_status' ] ) {
298
+		switch ($update_info['payment_status']) {
299 299
 
300 300
 			case 'Completed' :
301 301
 				$status = $this->_pay_model->approved_status();
302
-				$gateway_response = esc_html__( 'The payment is approved.', 'event_espresso' );
302
+				$gateway_response = esc_html__('The payment is approved.', 'event_espresso');
303 303
 				break;
304 304
 
305 305
 			case 'Pending' :
306 306
 				$status = $this->_pay_model->pending_status();
307
-				$gateway_response = esc_html__( 'The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso' );
307
+				$gateway_response = esc_html__('The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso');
308 308
 				break;
309 309
 
310 310
 			case 'Denied' :
311 311
 				$status = $this->_pay_model->declined_status();
312
-				$gateway_response = esc_html__( 'The payment has been declined.', 'event_espresso' );
312
+				$gateway_response = esc_html__('The payment has been declined.', 'event_espresso');
313 313
 				break;
314 314
 
315 315
 			case 'Expired' :
316 316
 			case 'Failed' :
317 317
 				$status = $this->_pay_model->failed_status();
318
-				$gateway_response = esc_html__( 'The payment failed for technical reasons or expired.', 'event_espresso' );
318
+				$gateway_response = esc_html__('The payment failed for technical reasons or expired.', 'event_espresso');
319 319
 				break;
320 320
 
321 321
 			case 'Refunded' :
322 322
 			case 'Partially_Refunded' :
323 323
 				// even though it's a refund, we consider the payment as approved, it just has a negative value
324 324
 				$status = $this->_pay_model->approved_status();
325
-				$gateway_response = esc_html__( 'The payment has been refunded. Please update registrations accordingly.', 'event_espresso' );
325
+				$gateway_response = esc_html__('The payment has been refunded. Please update registrations accordingly.', 'event_espresso');
326 326
 				break;
327 327
 
328 328
 			case 'Voided' :
@@ -330,19 +330,19 @@  discard block
 block discarded – undo
330 330
 			case 'Canceled_Reversal' :
331 331
 			default :
332 332
 				$status = $this->_pay_model->cancelled_status();
333
-				$gateway_response = esc_html__( 'The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso' );
333
+				$gateway_response = esc_html__('The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso');
334 334
 				break;
335 335
 
336 336
 		}
337 337
 
338 338
 		//check if we've already processed this payment
339
-		if ( $payment instanceof EEI_Payment ) {
339
+		if ($payment instanceof EEI_Payment) {
340 340
 			//payment exists. if this has the exact same status and amount, don't bother updating. just return
341
-			if ( $payment->status() === $status && (float)$payment->amount() === (float)$update_info[ 'mc_gross' ] ) {
341
+			if ($payment->status() === $status && (float) $payment->amount() === (float) $update_info['mc_gross']) {
342 342
 				// DUPLICATED IPN! don't bother updating transaction
343 343
 				throw new IpnException(
344 344
 					sprintf(
345
-						esc_html__( 'It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso' ),
345
+						esc_html__('It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso'),
346 346
 						$payment->ID()
347 347
 					),
348 348
 					IpnException::DUPLICATE,
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
 				);
353 353
 			} else {
354 354
 				// new payment yippee !!!
355
-				$payment->set_status( $status );
356
-				$payment->set_amount( (float)$update_info[ 'mc_gross' ] );
357
-				$payment->set_gateway_response( $gateway_response );
358
-				$payment->set_details( $update_info );
359
-				$payment->set_txn_id_chq_nmbr( $update_info[ 'txn_id' ] );
355
+				$payment->set_status($status);
356
+				$payment->set_amount((float) $update_info['mc_gross']);
357
+				$payment->set_gateway_response($gateway_response);
358
+				$payment->set_details($update_info);
359
+				$payment->set_txn_id_chq_nmbr($update_info['txn_id']);
360 360
 				$this->log(
361 361
 					array(
362
-						'message'  => esc_html__( 'Updated payment either from IPN or as part of POST from PayPal', 'event_espresso' ),
362
+						'message'  => esc_html__('Updated payment either from IPN or as part of POST from PayPal', 'event_espresso'),
363 363
 						'url'      => $this->_process_response_url(),
364 364
 						'payment'  => $payment->model_field_array(),
365 365
 						'IPN_data' => $update_info
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 			}
370 370
 
371 371
 		}
372
-		do_action( 'FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this );
372
+		do_action('FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this);
373 373
 		return $payment;
374 374
 	}
375 375
 
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
 	 * @return boolean
385 385
 	 * @throws \EE_Error
386 386
 	 */
387
-	public function validate_ipn( $update_info, $payment ) {
387
+	public function validate_ipn($update_info, $payment) {
388 388
 		//allow us to skip validating IPNs with PayPal (useful for testing)
389
-		if ( apply_filters( 'FHEE__EEG_Paypal_Standard__validate_ipn__skip', false ) ) {
389
+		if (apply_filters('FHEE__EEG_Paypal_Standard__validate_ipn__skip', false)) {
390 390
 			return true;
391 391
 		}
392 392
 		//...otherwise, we actually don't care what the $update_info is, we need to look
@@ -394,22 +394,22 @@  discard block
 block discarded – undo
394 394
 		// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
395 395
 		// Instead, read raw POST data from the input stream.
396 396
 		// @see https://gist.github.com/xcommerce-gists/3440401
397
-		$raw_post_data = file_get_contents( 'php://input' );
398
-		$raw_post_array = explode( '&', $raw_post_data );
397
+		$raw_post_data = file_get_contents('php://input');
398
+		$raw_post_array = explode('&', $raw_post_data);
399 399
 		$update_info = array();
400
-		foreach ( $raw_post_array as $keyval ) {
401
-			$keyval = explode( '=', $keyval );
402
-			if ( count( $keyval ) === 2 ) {
403
-				$update_info[ $keyval[ 0 ] ] = urldecode( $keyval[ 1 ] );
400
+		foreach ($raw_post_array as $keyval) {
401
+			$keyval = explode('=', $keyval);
402
+			if (count($keyval) === 2) {
403
+				$update_info[$keyval[0]] = urldecode($keyval[1]);
404 404
 			}
405 405
 		}
406 406
 		// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'
407 407
 		$req = 'cmd=_notify-validate';
408
-		$uses_get_magic_quotes = function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() === 1
408
+		$uses_get_magic_quotes = function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() === 1
409 409
 			? true
410 410
 			: false;
411
-		foreach ( $update_info as $key => $value ) {
412
-			$value = $uses_get_magic_quotes ? urlencode( stripslashes( $value ) ) : urlencode( $value );
411
+		foreach ($update_info as $key => $value) {
412
+			$value = $uses_get_magic_quotes ? urlencode(stripslashes($value)) : urlencode($value);
413 413
 			$req .= "&$key=$value";
414 414
 		}
415 415
 		// HTTP POST the complete, unaltered IPN back to PayPal
@@ -418,38 +418,38 @@  discard block
 block discarded – undo
418 418
 			array(
419 419
 				'body' 				=> $req,
420 420
 				'sslverify' 		=> false,
421
-				'timeout' 		=> 60 ,
421
+				'timeout' 		=> 60,
422 422
 				// make sure to set a site specific unique "user-agent" string since the WordPres default gets declined by PayPal
423 423
 				// plz see: https://github.com/websharks/s2member/issues/610
424
-				'user-agent' 	=> 'Event Espresso v' . EVENT_ESPRESSO_VERSION . '; ' . home_url(),
424
+				'user-agent' 	=> 'Event Espresso v'.EVENT_ESPRESSO_VERSION.'; '.home_url(),
425 425
 				'httpversion' => '1.1'
426 426
 			)
427 427
 		);
428 428
 		// then check the response
429 429
 		if (
430
-			array_key_exists( 'body', $response )
431
-			&& ! is_wp_error( $response )
432
-			&& strcmp( $response[ 'body' ], "VERIFIED" ) === 0
430
+			array_key_exists('body', $response)
431
+			&& ! is_wp_error($response)
432
+			&& strcmp($response['body'], "VERIFIED") === 0
433 433
 		) {
434 434
 			return true;
435 435
 		}
436 436
 		// huh, something's wack... the IPN didn't validate. We must have replied to the IPN incorrectly,
437 437
 		// or their API must have changed: http://www.paypalobjects.com/en_US/ebook/PP_OrderManagement_IntegrationGuide/ipn.html
438
-		if( $response instanceof WP_Error ) {
438
+		if ($response instanceof WP_Error) {
439 439
 			$error_msg = sprintf(
440
-				esc_html__( 'WP Error. Code: "%1$s", Message: "%2$s", Data: "%3$s"', 'event_espresso' ),
440
+				esc_html__('WP Error. Code: "%1$s", Message: "%2$s", Data: "%3$s"', 'event_espresso'),
441 441
 				$response->get_error_code(),
442 442
 				$response->get_error_message(),
443
-				print_r( $response->get_error_data(), true )
443
+				print_r($response->get_error_data(), true)
444 444
 			);
445
-		} elseif( is_array( $response ) && isset( $response[ 'body' ] ) ) {
446
-			$error_msg = $response[ 'body' ];
445
+		} elseif (is_array($response) && isset($response['body'])) {
446
+			$error_msg = $response['body'];
447 447
 		} else {
448
-			$error_msg = print_r( $response, true );
448
+			$error_msg = print_r($response, true);
449 449
 		}
450
-		$payment->set_gateway_response( sprintf( esc_html__( "IPN Validation failed! Paypal responded with '%s'", "event_espresso" ), $error_msg ) );
451
-		$payment->set_details( array( 'REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response ) );
452
-		$payment->set_status( EEM_Payment::status_id_failed );
450
+		$payment->set_gateway_response(sprintf(esc_html__("IPN Validation failed! Paypal responded with '%s'", "event_espresso"), $error_msg));
451
+		$payment->set_details(array('REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response));
452
+		$payment->set_status(EEM_Payment::status_id_failed);
453 453
 		// log the results
454 454
 		$this->log(
455 455
 			array(
@@ -469,9 +469,9 @@  discard block
 block discarded – undo
469 469
 	 * @return string
470 470
 	 */
471 471
 	protected function _process_response_url() {
472
-		if ( isset( $_SERVER[ 'HTTP_HOST' ], $_SERVER[ 'REQUEST_URI' ] ) ) {
472
+		if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) {
473 473
 			$url = is_ssl() ? 'https://' : 'http://';
474
-			$url .= EEH_URL::filter_input_server_url( 'HTTP_HOST' );
474
+			$url .= EEH_URL::filter_input_server_url('HTTP_HOST');
475 475
 			$url .= EEH_URL::filter_input_server_url();
476 476
 		} else {
477 477
 			$url = 'unknown';
@@ -488,12 +488,12 @@  discard block
 block discarded – undo
488 488
 	 * @param EEI_Payment $payment
489 489
 	 * @throws \EE_Error
490 490
 	 */
491
-	public function update_txn_based_on_payment( $payment ) {
491
+	public function update_txn_based_on_payment($payment) {
492 492
 		$update_info = $payment->details();
493 493
 		/** @var EE_Transaction $transaction */
494 494
 		$transaction = $payment->transaction();
495
-		$payment_was_itemized = $payment->get_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true, false );
496
-		if( ! $transaction ){
495
+		$payment_was_itemized = $payment->get_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true, false);
496
+		if ( ! $transaction) {
497 497
 			$this->log(
498 498
 				esc_html__(
499 499
 					'Payment with ID %d has no related transaction, and so update_txn_based_on_payment couldn\'t be executed properly',
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
 			);
504 504
 			return;
505 505
 		}
506
-		if(
507
-			! is_array( $update_info )
508
-			|| ! isset( $update_info[ 'mc_shipping' ] )
509
-			|| ! isset( $update_info[ 'tax' ] )
506
+		if (
507
+			! is_array($update_info)
508
+			|| ! isset($update_info['mc_shipping'])
509
+			|| ! isset($update_info['tax'])
510 510
 		) {
511 511
 			$this->log(
512 512
 				array(
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 			);
522 522
 			return;
523 523
 		}
524
-		if( $payment->status() !== $this->_pay_model->approved_status() ) {
524
+		if ($payment->status() !== $this->_pay_model->approved_status()) {
525 525
 			$this->log(
526 526
 				array(
527 527
 					'message' => esc_html__(
@@ -540,44 +540,44 @@  discard block
 block discarded – undo
540 540
 		$transaction_total_line_item = $transaction->total_line_item();
541 541
 
542 542
 		//might paypal have changed the taxes?
543
-		if( $this->_paypal_taxes && $payment_was_itemized ) {
543
+		if ($this->_paypal_taxes && $payment_was_itemized) {
544 544
             // note that we're doing this BEFORE adding shipping;
545 545
 			// we actually want PayPal's shipping to remain non-taxable
546
-            $this->_line_item->set_line_items_taxable( $transaction_total_line_item, true, 'paypal_shipping' );
546
+            $this->_line_item->set_line_items_taxable($transaction_total_line_item, true, 'paypal_shipping');
547 547
             $this->_line_item->set_total_tax_to(
548 548
 	            $transaction_total_line_item,
549
-                (float)$update_info['tax'],
550
-                esc_html__( 'Taxes', 'event_espresso' ),
551
-                esc_html__( 'Calculated by Paypal', 'event_espresso' ),
549
+                (float) $update_info['tax'],
550
+                esc_html__('Taxes', 'event_espresso'),
551
+                esc_html__('Calculated by Paypal', 'event_espresso'),
552 552
                 'paypal_tax'
553 553
             );
554 554
             $grand_total_needs_resaving = TRUE;
555 555
 		}
556 556
 
557
-		$shipping_amount = (float)$update_info[ 'mc_shipping' ];
557
+		$shipping_amount = (float) $update_info['mc_shipping'];
558 558
 		//might paypal have added shipping?
559
-		if( $this->_paypal_shipping && $shipping_amount && $payment_was_itemized ){
559
+		if ($this->_paypal_shipping && $shipping_amount && $payment_was_itemized) {
560 560
 			$this->_line_item->add_unrelated_item(
561 561
 				$transaction_total_line_item,
562
-				sprintf( esc_html__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID() ),
562
+				sprintf(esc_html__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID()),
563 563
 				$shipping_amount,
564 564
 				esc_html__('Shipping charges calculated by Paypal', 'event_espresso'),
565 565
 				1,
566 566
 				false,
567
-				'paypal_shipping_' . $transaction->ID()
567
+				'paypal_shipping_'.$transaction->ID()
568 568
 			);
569 569
 			$grand_total_needs_resaving = true;
570 570
 		}
571 571
 
572
-		if( $grand_total_needs_resaving ){
573
-			$transaction_total_line_item->save_this_and_descendants_to_txn( $transaction->ID() );
572
+		if ($grand_total_needs_resaving) {
573
+			$transaction_total_line_item->save_this_and_descendants_to_txn($transaction->ID());
574 574
 			/** @var EE_Registration_Processor $registration_processor */
575
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
576
-			$registration_processor->update_registration_final_prices( $transaction );
575
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
576
+			$registration_processor->update_registration_final_prices($transaction);
577 577
 		}
578 578
 		$this->log(
579 579
 			array(
580
-				'message'                     => esc_html__( 'Updated transaction related to payment', 'event_espresso' ),
580
+				'message'                     => esc_html__('Updated transaction related to payment', 'event_espresso'),
581 581
 				'url'                         => $this->_process_response_url(),
582 582
 				'transaction (updated)'       => $transaction->model_field_array(),
583 583
 				'payment (updated)'           => $payment->model_field_array(),
Please login to merge, or discard this patch.