Completed
Branch BUG-9019-ticket-selector-submi... (c1f9d8)
by
unknown
435:14 queued 416:01
created
core/EE_Psr4AutoloaderInit.core.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 		static $initialized = false;
27
-		if ( ! $initialized ) {
27
+		if ( ! $initialized) {
28 28
 			// instantiate PSR4 autoloader
29
-			espresso_load_required( 'Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php' );
29
+			espresso_load_required('Psr4Autoloader', EE_CORE.'Psr4Autoloader.php');
30 30
 			EE_Psr4AutoloaderInit::$psr4_loader = new \EventEspresso\Core\Psr4Autoloader();
31 31
 			// register the autoloader
32 32
 			EE_Psr4AutoloaderInit::$psr4_loader->register();
33 33
 			// register the base directories for the namespace prefix
34
-			EE_Psr4AutoloaderInit::$psr4_loader->addNamespace( 'EventEspresso', EE_PLUGIN_DIR_PATH );
34
+			EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH);
35 35
 			$initialized = true;
36 36
 		}
37 37
 	}
Please login to merge, or discard this patch.
core/db_classes/EE_Datetime.class.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 *                             		    date_format and the second value is the time format
75 75
 	 * @return EE_Datetime
76 76
 	 */
77
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
78
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
79
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
77
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
78
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
79
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
80 80
 	}
81 81
 
82 82
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *                          		the website will be used.
88 88
 	 * @return EE_Datetime
89 89
 	 */
90
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
91
-		return new self( $props_n_values, TRUE, $timezone );
90
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
91
+		return new self($props_n_values, TRUE, $timezone);
92 92
 	}
93 93
 
94 94
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	/**
97 97
 	 * @param $name
98 98
 	 */
99
-	public function set_name( $name ) {
100
-		$this->set( 'DTT_name', $name );
99
+	public function set_name($name) {
100
+		$this->set('DTT_name', $name);
101 101
 	}
102 102
 
103 103
 
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 * @param $description
107 107
 	 */
108
-	public function set_description( $description ) {
109
-		$this->set( 'DTT_description', $description );
108
+	public function set_description($description) {
109
+		$this->set('DTT_description', $description);
110 110
 	}
111 111
 
112 112
 
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 * @access        public
120 120
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
121 121
 	 */
122
-	public function set_start_date( $date ) {
123
-		$this->_set_date_for( $date, 'DTT_EVT_start' );
122
+	public function set_start_date($date) {
123
+		$this->_set_date_for($date, 'DTT_EVT_start');
124 124
 	}
125 125
 
126 126
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @access        public
134 134
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
135 135
 	 */
136
-	public function set_start_time( $time ) {
137
-		$this->_set_time_for( $time, 'DTT_EVT_start' );
136
+	public function set_start_time($time) {
137
+		$this->_set_time_for($time, 'DTT_EVT_start');
138 138
 	}
139 139
 
140 140
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @access        public
148 148
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
149 149
 	 */
150
-	public function set_end_date( $date ) {
151
-		$this->_set_date_for( $date, 'DTT_EVT_end' );
150
+	public function set_end_date($date) {
151
+		$this->_set_date_for($date, 'DTT_EVT_end');
152 152
 	}
153 153
 
154 154
 
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 	 * @access        public
162 162
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
163 163
 	 */
164
-	public function set_end_time( $time ) {
165
-		$this->_set_time_for( $time, 'DTT_EVT_end' );
164
+	public function set_end_time($time) {
165
+		$this->_set_time_for($time, 'DTT_EVT_end');
166 166
 	}
167 167
 
168 168
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @access        public
176 176
 	 * @param        int $reg_limit
177 177
 	 */
178
-	public function set_reg_limit( $reg_limit ) {
179
-		$this->set( 'DTT_reg_limit', $reg_limit );
178
+	public function set_reg_limit($reg_limit) {
179
+		$this->set('DTT_reg_limit', $reg_limit);
180 180
 	}
181 181
 
182 182
 
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
 	 * @access        public
188 188
 	 * @param        int $sold
189 189
 	 */
190
-	public function set_sold( $sold ) {
190
+	public function set_sold($sold) {
191 191
 		// sold can not go below zero
192
-		$sold = max( 0, $sold );
193
-		$this->set( 'DTT_sold', $sold );
192
+		$sold = max(0, $sold);
193
+		$this->set('DTT_sold', $sold);
194 194
 	}
195 195
 
196 196
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 	 * increments sold by amount passed by $qty
200 200
 	 * @param int $qty
201 201
 	 */
202
-	function increase_sold( $qty = 1 ) {
202
+	function increase_sold($qty = 1) {
203 203
 		$sold = $this->sold() + $qty;
204
-		$this->set_sold( $sold );
204
+		$this->set_sold($sold);
205 205
 	}
206 206
 
207 207
 
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 	 * decrements (subtracts) sold amount passed by $qty
211 211
 	 * @param int $qty
212 212
 	 */
213
-	function decrease_sold( $qty = 1 ) {
213
+	function decrease_sold($qty = 1) {
214 214
 		$sold = $this->sold() - $qty;
215
-		$this->set_sold( $sold );
215
+		$this->set_sold($sold);
216 216
 	}
217 217
 
218 218
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * @return string
223 223
 	 */
224 224
 	public function name() {
225
-		return $this->get( 'DTT_name' );
225
+		return $this->get('DTT_name');
226 226
 	}
227 227
 
228 228
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return string
233 233
 	 */
234 234
 	public function description() {
235
-		return $this->get( 'DTT_description' );
235
+		return $this->get('DTT_description');
236 236
 	}
237 237
 
238 238
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 * @return boolean          TRUE if is primary, FALSE if not.
243 243
 	 */
244 244
 	public function is_primary() {
245
-		return $this->get( 'DTT_is_primary' );
245
+		return $this->get('DTT_is_primary');
246 246
 	}
247 247
 
248 248
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @return int         The order of the datetime for this event.
253 253
 	 */
254 254
 	public function order() {
255
-		return $this->get( 'DTT_order' );
255
+		return $this->get('DTT_order');
256 256
 	}
257 257
 
258 258
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @return int
263 263
 	 */
264 264
 	public function parent() {
265
-		return $this->get( 'DTT_parent' );
265
+		return $this->get('DTT_parent');
266 266
 	}
267 267
 
268 268
 
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 	 * @param    bool   $echo         - whether we echo or return (note echoing uses "pretty" formats, otherwise we use the standard formats)
279 279
 	 * @return    string|bool|void  string on success, FALSE on fail
280 280
 	 */
281
-	private function _show_datetime( $date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE ) {
281
+	private function _show_datetime($date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE) {
282 282
 		$field_name = "DTT_EVT_{$start_or_end}";
283
-		$dtt = $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo );
284
-		if ( ! $echo ) {
283
+		$dtt = $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo);
284
+		if ( ! $echo) {
285 285
 			return $dtt;
286 286
 		}
287 287
 		return '';
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
298 298
 	 * @return        mixed        string on success, FALSE on fail
299 299
 	 */
300
-	public function start_date( $dt_frmt = NULL ) {
301
-		return $this->_show_datetime( 'D', 'start', $dt_frmt );
300
+	public function start_date($dt_frmt = NULL) {
301
+		return $this->_show_datetime('D', 'start', $dt_frmt);
302 302
 	}
303 303
 
304 304
 
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
 	 * Echoes start_date()
308 308
 	 * @param string $dt_frmt
309 309
 	 */
310
-	public function e_start_date( $dt_frmt = NULL ) {
311
-		$this->_show_datetime( 'D', 'start', $dt_frmt, NULL, TRUE );
310
+	public function e_start_date($dt_frmt = NULL) {
311
+		$this->_show_datetime('D', 'start', $dt_frmt, NULL, TRUE);
312 312
 	}
313 313
 
314 314
 
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
322 322
 	 * @return        mixed        string on success, FALSE on fail
323 323
 	 */
324
-	public function end_date( $dt_frmt = NULL ) {
325
-		return $this->_show_datetime( 'D', 'end', $dt_frmt );
324
+	public function end_date($dt_frmt = NULL) {
325
+		return $this->_show_datetime('D', 'end', $dt_frmt);
326 326
 	}
327 327
 
328 328
 
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 	 * Echoes the end date. See end_date()
332 332
 	 * @param string $dt_frmt
333 333
 	 */
334
-	public function e_end_date( $dt_frmt = NULL ) {
335
-		$this->_show_datetime( 'D', 'end', $dt_frmt, NULL, TRUE );
334
+	public function e_end_date($dt_frmt = NULL) {
335
+		$this->_show_datetime('D', 'end', $dt_frmt, NULL, TRUE);
336 336
 	}
337 337
 
338 338
 
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 	 * @param        string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
346 346
 	 * @return        mixed        string on success, FALSE on fail
347 347
 	 */
348
-	public function date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
349
-		$dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : $this->_dt_frmt;
350
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $dt_frmt ) );
351
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end', $dt_frmt ) );
352
-		return $start != $end ? $start . $conjunction . $end : $start;
348
+	public function date_range($dt_frmt = NULL, $conjunction = ' - ') {
349
+		$dt_frmt = ! empty($dt_frmt) ? $dt_frmt : $this->_dt_frmt;
350
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $dt_frmt));
351
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $dt_frmt));
352
+		return $start != $end ? $start.$conjunction.$end : $start;
353 353
 	}
354 354
 
355 355
 
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
 	 * @param null   $dt_frmt
359 359
 	 * @param string $conjunction
360 360
 	 */
361
-	public function e_date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
362
-		echo $this->date_range( $dt_frmt, $conjunction );
361
+	public function e_date_range($dt_frmt = NULL, $conjunction = ' - ') {
362
+		echo $this->date_range($dt_frmt, $conjunction);
363 363
 	}
364 364
 
365 365
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
372 372
 	 * @return        mixed        string on success, FALSE on fail
373 373
 	 */
374
-	public function start_time( $tm_format = NULL ) {
375
-		return $this->_show_datetime( 'T', 'start', NULL, $tm_format );
374
+	public function start_time($tm_format = NULL) {
375
+		return $this->_show_datetime('T', 'start', NULL, $tm_format);
376 376
 	}
377 377
 
378 378
 
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
 	/**
381 381
 	 * @param null $tm_format
382 382
 	 */
383
-	public function e_start_time( $tm_format = NULL ) {
384
-		$this->_show_datetime( 'T', 'start', NULL, $tm_format, TRUE );
383
+	public function e_start_time($tm_format = NULL) {
384
+		$this->_show_datetime('T', 'start', NULL, $tm_format, TRUE);
385 385
 	}
386 386
 
387 387
 
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
394 394
 	 * @return        mixed        string on success, FALSE on fail
395 395
 	 */
396
-	public function end_time( $tm_format = NULL ) {
397
-		return $this->_show_datetime( 'T', 'end', NULL, $tm_format );
396
+	public function end_time($tm_format = NULL) {
397
+		return $this->_show_datetime('T', 'end', NULL, $tm_format);
398 398
 	}
399 399
 
400 400
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 	/**
403 403
 	 * @param null $tm_format
404 404
 	 */
405
-	public function e_end_time( $tm_format = NULL ) {
406
-		$this->_show_datetime( 'T', 'end', NULL, $tm_format, TRUE );
405
+	public function e_end_time($tm_format = NULL) {
406
+		$this->_show_datetime('T', 'end', NULL, $tm_format, TRUE);
407 407
 	}
408 408
 
409 409
 
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	 * @param        string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
417 417
 	 * @return        mixed        string on success, FALSE on fail
418 418
 	 */
419
-	public function time_range( $tm_format = NULL, $conjunction = ' - ' ) {
420
-		$tm_format = !empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
419
+	public function time_range($tm_format = NULL, $conjunction = ' - ') {
420
+		$tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt;
421 421
 
422
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $tm_format ) );
423
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end',  $tm_format ) );
424
-		return $start != $end ? $start . $conjunction . $end : $start;
422
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $tm_format));
423
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $tm_format));
424
+		return $start != $end ? $start.$conjunction.$end : $start;
425 425
 	}
426 426
 
427 427
 
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 	 * @param null   $tm_format
431 431
 	 * @param string $conjunction
432 432
 	 */
433
-	public function e_time_range( $tm_format = NULL, $conjunction = ' - ' ) {
434
-		echo $this->time_range( $tm_format, $conjunction );
433
+	public function e_time_range($tm_format = NULL, $conjunction = ' - ') {
434
+		echo $this->time_range($tm_format, $conjunction);
435 435
 	}
436 436
 
437 437
 
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 	 * @param 	string 	$tm_format - string representation of time format defaults to 'g:i a'
445 445
 	 * @return 	mixed 	string on success, FALSE on fail
446 446
 	 */
447
-	public function start_date_and_time( $dt_format = NULL, $tm_format = NULL ) {
448
-		return $this->_show_datetime( '', 'start', $dt_format, $tm_format );
447
+	public function start_date_and_time($dt_format = NULL, $tm_format = NULL) {
448
+		return $this->_show_datetime('', 'start', $dt_format, $tm_format);
449 449
 	}
450 450
 
451 451
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 * @param null $dt_frmt
455 455
 	 * @param null $tm_format
456 456
 	 */
457
-	public function e_start_date_and_time( $dt_frmt = NULL, $tm_format = NULL ) {
458
-		$this->_show_datetime( '', 'start', $dt_frmt, $tm_format, TRUE );
457
+	public function e_start_date_and_time($dt_frmt = NULL, $tm_format = NULL) {
458
+		$this->_show_datetime('', 'start', $dt_frmt, $tm_format, TRUE);
459 459
 	}
460 460
 
461 461
 
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 	 * @param bool   $round_up
470 470
 	 * @return float|int|mixed
471 471
 	 */
472
-	public function length( $units = 'seconds', $round_up = FALSE ) {
473
-		$start = $this->get_raw( 'DTT_EVT_start' );
474
-		$end = $this->get_raw( 'DTT_EVT_end' );
472
+	public function length($units = 'seconds', $round_up = FALSE) {
473
+		$start = $this->get_raw('DTT_EVT_start');
474
+		$end = $this->get_raw('DTT_EVT_end');
475 475
 		$length_in_units = $end - $start;
476
-		switch ( $units ) {
476
+		switch ($units) {
477 477
 			//NOTE: We purposefully don't use "break;" in order to chain the divisions
478 478
 			/** @noinspection PhpMissingBreakStatementInspection */
479 479
 			case 'days':
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
 				$length_in_units /= 60;
487 487
 			case 'seconds':
488 488
 			default:
489
-				$length_in_units = ceil( $length_in_units );
489
+				$length_in_units = ceil($length_in_units);
490 490
 		}
491
-		if ( $round_up ) {
492
-			$length_in_units = max( $length_in_units, 1 );
491
+		if ($round_up) {
492
+			$length_in_units = max($length_in_units, 1);
493 493
 		}
494 494
 		return $length_in_units;
495 495
 	}
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
 	 * @param bool | string 	$tm_format - string representation of time format defaults to 'g:i a'
505 505
 	 * @return 	mixed        		string on success, FALSE on fail
506 506
 	 */
507
-	public function end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
508
-		return $this->_show_datetime( '', 'end', $dt_frmt, $tm_format );
507
+	public function end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
508
+		return $this->_show_datetime('', 'end', $dt_frmt, $tm_format);
509 509
 	}
510 510
 
511 511
 
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 	 * @param bool $dt_frmt
515 515
 	 * @param bool $tm_format
516 516
 	 */
517
-	public function e_end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
518
-		$this->_show_datetime( '', 'end', $dt_frmt, $tm_format, TRUE );
517
+	public function e_end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
518
+		$this->_show_datetime('', 'end', $dt_frmt, $tm_format, TRUE);
519 519
 	}
520 520
 
521 521
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 * @return        int
528 528
 	 */
529 529
 	public function start() {
530
-		return $this->get_raw( 'DTT_EVT_start' );
530
+		return $this->get_raw('DTT_EVT_start');
531 531
 	}
532 532
 
533 533
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	 * @return        int
540 540
 	 */
541 541
 	public function end() {
542
-		return $this->get_raw( 'DTT_EVT_end' );
542
+		return $this->get_raw('DTT_EVT_end');
543 543
 	}
544 544
 
545 545
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 * @return        mixed        int on success, FALSE on fail
552 552
 	 */
553 553
 	public function reg_limit() {
554
-		return $this->get_raw( 'DTT_reg_limit' );
554
+		return $this->get_raw('DTT_reg_limit');
555 555
 	}
556 556
 
557 557
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	 * @return        mixed        int on success, FALSE on fail
564 564
 	 */
565 565
 	public function sold() {
566
-		return $this->get_raw( 'DTT_sold' );
566
+		return $this->get_raw('DTT_sold');
567 567
 	}
568 568
 
569 569
 
@@ -592,15 +592,15 @@  discard block
 block discarded – undo
592 592
 	 * 																	the spaces remaining for this particular datetime, hence the flag.
593 593
 	 * @return 	int
594 594
 	 */
595
-	public function spaces_remaining( $consider_tickets = FALSE ) {
595
+	public function spaces_remaining($consider_tickets = FALSE) {
596 596
 		// tickets remaining available for purchase
597 597
 		//no need for special checks for infinite, because if DTT_reg_limit == EE_INF, then EE_INF - x = EE_INF
598 598
 		$dtt_remaining = $this->reg_limit() - $this->sold();
599
-		if ( ! $consider_tickets ) {
599
+		if ( ! $consider_tickets) {
600 600
 			return $dtt_remaining;
601 601
 		}
602 602
 		$tickets_remaining = $this->tickets_remaining();
603
-		return min( $dtt_remaining, $tickets_remaining );
603
+		return min($dtt_remaining, $tickets_remaining);
604 604
 	}
605 605
 
606 606
 
@@ -611,19 +611,19 @@  discard block
 block discarded – undo
611 611
 	 * @param array $query_params like EEM_Base::get_all's
612 612
 	 * @return int
613 613
 	 */
614
-	public function tickets_remaining( $query_params = array() ) {
614
+	public function tickets_remaining($query_params = array()) {
615 615
 		$sum = 0;
616
-		$tickets = $this->tickets( $query_params );
617
-		if ( ! empty( $tickets ) ) {
618
-			foreach ( $tickets as $ticket ) {
619
-				if ( $ticket instanceof EE_Ticket ) {
616
+		$tickets = $this->tickets($query_params);
617
+		if ( ! empty($tickets)) {
618
+			foreach ($tickets as $ticket) {
619
+				if ($ticket instanceof EE_Ticket) {
620 620
 					// get the actual amount of tickets that can be sold
621
-					$qty = $ticket->qty( 'saleable' );
622
-					if ( $qty === EE_INF ) {
621
+					$qty = $ticket->qty('saleable');
622
+					if ($qty === EE_INF) {
623 623
 						return EE_INF;
624 624
 					}
625 625
 					// no negative ticket quantities plz
626
-					if ( $qty > 0 ) {
626
+					if ($qty > 0) {
627 627
 						$sum += $qty;
628 628
 					}
629 629
 				}
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 	 * @param array $query_params like EEM_Base::get_all's
641 641
 	 * @return int
642 642
 	 */
643
-	public function sum_tickets_initially_available( $query_params = array() ) {
644
-		return $this->sum_related( 'Ticket', $query_params, 'TKT_qty' );
643
+	public function sum_tickets_initially_available($query_params = array()) {
644
+		return $this->sum_related('Ticket', $query_params, 'TKT_qty');
645 645
 	}
646 646
 
647 647
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * @return int
654 654
 	 */
655 655
 	public function total_tickets_available_at_this_datetime() {
656
-		return $this->spaces_remaining( true );
656
+		return $this->spaces_remaining(true);
657 657
 	}
658 658
 
659 659
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	 * @return boolean
665 665
 	 */
666 666
 	public function is_upcoming() {
667
-		return ( $this->get_raw( 'DTT_EVT_start' ) > time() );
667
+		return ($this->get_raw('DTT_EVT_start') > time());
668 668
 	}
669 669
 
670 670
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 * @return boolean
675 675
 	 */
676 676
 	public function is_active() {
677
-		return ( $this->get_raw( 'DTT_EVT_start' ) < time() && $this->get_raw( 'DTT_EVT_end' ) > time() );
677
+		return ($this->get_raw('DTT_EVT_start') < time() && $this->get_raw('DTT_EVT_end') > time());
678 678
 	}
679 679
 
680 680
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 	 * @return boolean
685 685
 	 */
686 686
 	public function is_expired() {
687
-		return ( $this->get_raw( 'DTT_EVT_end' ) < time() );
687
+		return ($this->get_raw('DTT_EVT_end') < time());
688 688
 	}
689 689
 
690 690
 
@@ -695,16 +695,16 @@  discard block
 block discarded – undo
695 695
 	 */
696 696
 	public function get_active_status() {
697 697
 		$total_tickets_for_this_dtt = $this->total_tickets_available_at_this_datetime();
698
-		if ( $total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1 ) {
698
+		if ($total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1) {
699 699
 			return EE_Datetime::sold_out;
700 700
 		}
701
-		if ( $this->is_expired() ) {
701
+		if ($this->is_expired()) {
702 702
 			return EE_Datetime::expired;
703 703
 		}
704
-		if ( $this->is_upcoming() ) {
704
+		if ($this->is_upcoming()) {
705 705
 			return EE_Datetime::upcoming;
706 706
 		}
707
-		if ( $this->is_active() ) {
707
+		if ($this->is_active()) {
708 708
 			return EE_Datetime::active;
709 709
 		}
710 710
 		return NULL;
@@ -718,24 +718,24 @@  discard block
 block discarded – undo
718 718
 	 * @param  boolean $use_dtt_name if TRUE then we'll use DTT->name() if its not empty.
719 719
 	 * @return string
720 720
 	 */
721
-	public function get_dtt_display_name( $use_dtt_name = FALSE ) {
722
-		if ( $use_dtt_name ) {
721
+	public function get_dtt_display_name($use_dtt_name = FALSE) {
722
+		if ($use_dtt_name) {
723 723
 			$dtt_name = $this->name();
724
-			if ( !empty( $dtt_name ) ) {
724
+			if ( ! empty($dtt_name)) {
725 725
 				return $dtt_name;
726 726
 			}
727 727
 		}
728 728
 		//first condition is to see if the months are different
729
-		if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) ) {
730
-			$display_date = $this->start_date( 'M j\, Y g:i a' ) . ' - ' . $this->end_date( 'M j\, Y g:i a' );
729
+		if (date('m', $this->get_raw('DTT_EVT_start')) != date('m', $this->get_raw('DTT_EVT_end'))) {
730
+			$display_date = $this->start_date('M j\, Y g:i a').' - '.$this->end_date('M j\, Y g:i a');
731 731
 			//next condition is if its the same month but different day
732 732
 		}
733 733
 		else {
734
-			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' ) ) ) {
735
-				$display_date = $this->start_date( 'M j\, g:i a' ) . ' - ' . $this->end_date( 'M j\, g:i a Y' );
734
+			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'))) {
735
+				$display_date = $this->start_date('M j\, g:i a').' - '.$this->end_date('M j\, g:i a Y');
736 736
 			}
737 737
 			else {
738
-				$display_date = $this->start_date( 'F j\, Y' ) . ' @ ' . $this->start_date( 'g:i a' ) . ' - ' . $this->end_date( 'g:i a' );
738
+				$display_date = $this->start_date('F j\, Y').' @ '.$this->start_date('g:i a').' - '.$this->end_date('g:i a');
739 739
 			}
740 740
 		}
741 741
 		return $display_date;
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 *@param array $query_params see EEM_Base::get_all()
750 750
 	 * @return EE_Ticket[]
751 751
 	 */
752
-	public function tickets( $query_params = array() ) {
753
-		return $this->get_many_related( 'Ticket', $query_params );
752
+	public function tickets($query_params = array()) {
753
+		return $this->get_many_related('Ticket', $query_params);
754 754
 	}
755 755
 
756 756
 
@@ -760,21 +760,21 @@  discard block
 block discarded – undo
760 760
 	 * @param array $query_params like EEM_Base::get_all's
761 761
 	 * @return EE_Ticket[]
762 762
 	 */
763
-	public function ticket_types_available_for_purchase( $query_params = array() ) {
763
+	public function ticket_types_available_for_purchase($query_params = array()) {
764 764
 		// first check if datetime is valid
765
-		if ( !( $this->is_upcoming() || $this->is_active() ) || $this->sold_out() ) {
765
+		if ( ! ($this->is_upcoming() || $this->is_active()) || $this->sold_out()) {
766 766
 			return array();
767 767
 		}
768
-		if ( empty( $query_params ) ) {
768
+		if (empty($query_params)) {
769 769
 			$query_params = array(
770 770
 				array(
771
-					'TKT_start_date' => array( '<=', EEM_Ticket::instance()->current_time_for_query( 'TKT_start_date' ) ),
772
-					'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
771
+					'TKT_start_date' => array('<=', EEM_Ticket::instance()->current_time_for_query('TKT_start_date')),
772
+					'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
773 773
 					'TKT_deleted'    => false
774 774
 				)
775 775
 			);
776 776
 		}
777
-		return $this->tickets( $query_params );
777
+		return $this->tickets($query_params);
778 778
 	}
779 779
 
780 780
 
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 	 * @return EE_Event
785 785
 	 */
786 786
 	public function event() {
787
-		return $this->get_first_related( 'Event' );
787
+		return $this->get_first_related('Event');
788 788
 	}
789 789
 
790 790
 
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	public function update_sold() {
798 798
 		$count_regs_for_this_datetime = EEM_Registration::instance()->count(
799
-			array( array(
799
+			array(array(
800 800
 				'STS_ID' 					=> EEM_Registration::status_id_approved,
801 801
 				'REG_deleted' 				=> 0,
802 802
 				'Ticket.Datetime.DTT_ID' 	=> $this->ID(),
803
-			) )
803
+			))
804 804
 		);
805
-		$this->set( 'DTT_sold', $count_regs_for_this_datetime );
805
+		$this->set('DTT_sold', $count_regs_for_this_datetime);
806 806
 		$this->save();
807 807
 		return $count_regs_for_this_datetime;
808 808
 	}
Please login to merge, or discard this patch.
core/db_classes/EE_Ticket.class.php 1 patch
Spacing   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 *                             		    date_format and the second value is the time format
67 67
 	 * @return EE_Ticket
68 68
 	 */
69
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
70
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
71
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
69
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
70
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
71
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
72 72
 	}
73 73
 
74 74
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 *                          		the website will be used.
80 80
 	 * @return EE_Ticket
81 81
 	 */
82
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
83
-		return new self( $props_n_values, TRUE, $timezone );
82
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
83
+		return new self($props_n_values, TRUE, $timezone);
84 84
 	}
85 85
 
86 86
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return bool
90 90
 	 */
91 91
 	public function parent() {
92
-		return $this->get( 'TKT_parent' );
92
+		return $this->get('TKT_parent');
93 93
 	}
94 94
 
95 95
 
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 	 * @param  int $DTT_ID the primary key for a particular datetime
100 100
 	 * @return boolean
101 101
 	 */
102
-	public function available( $DTT_ID = 0 ) {
102
+	public function available($DTT_ID = 0) {
103 103
 		// are we checking availability for a particular datetime ?
104
-		if ( $DTT_ID ) {
104
+		if ($DTT_ID) {
105 105
 			// get that datetime object
106
-			$datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) );
106
+			$datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID)));
107 107
 			// if  ticket sales for this datetime have exceeded the reg limit...
108
-			if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) {
108
+			if ($datetime instanceof EE_Datetime && $datetime->sold_out()) {
109 109
 				return FALSE;
110 110
 			}
111 111
 		}
@@ -120,21 +120,21 @@  discard block
 block discarded – undo
120 120
 	 * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const
121 121
 	 * @return mixed(int|string) status int if the display string isn't requested
122 122
 	 */
123
-	public function ticket_status( $display = FALSE ) {
124
-		if ( ! $this->is_remaining() ) {
125
-			return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out;
123
+	public function ticket_status($display = FALSE) {
124
+		if ( ! $this->is_remaining()) {
125
+			return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out;
126 126
 		}
127
-		if ( $this->get( 'TKT_deleted' ) ) {
128
-			return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived;
127
+		if ($this->get('TKT_deleted')) {
128
+			return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived;
129 129
 		}
130
-		if ( $this->is_expired() ) {
131
-			return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired;
130
+		if ($this->is_expired()) {
131
+			return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired;
132 132
 		}
133
-		if ( $this->is_pending() ) {
134
-			return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending;
133
+		if ($this->is_pending()) {
134
+			return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending;
135 135
 		}
136
-		if ( $this->is_on_sale() ) {
137
-			return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale;
136
+		if ($this->is_on_sale()) {
137
+			return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale;
138 138
 		}
139 139
 		return '';
140 140
 	}
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
 	 * @param  int $DTT_ID if an int above 0 is included here then we get a specific dtt.
149 149
 	 * @return boolean         true = tickets remaining, false not.
150 150
 	 */
151
-	public function is_remaining( $DTT_ID = 0 ) {
152
-		$num_remaining = $this->remaining( $DTT_ID );
153
-		if ( $num_remaining === 0 ) {
151
+	public function is_remaining($DTT_ID = 0) {
152
+		$num_remaining = $this->remaining($DTT_ID);
153
+		if ($num_remaining === 0) {
154 154
 			return FALSE;
155 155
 		}
156
-		if ( $num_remaining > 0 && $num_remaining < $this->min() ) {
156
+		if ($num_remaining > 0 && $num_remaining < $this->min()) {
157 157
 			return FALSE;
158 158
 		}
159 159
 		return TRUE;
@@ -167,25 +167,25 @@  discard block
 block discarded – undo
167 167
 	 *                     all related datetimes
168 168
 	 * @return int
169 169
 	 */
170
-	public function remaining( $DTT_ID = 0 ) {
170
+	public function remaining($DTT_ID = 0) {
171 171
 		// are we checking availability for a particular datetime ?
172
-		if ( $DTT_ID ) {
172
+		if ($DTT_ID) {
173 173
 			// get array with the one requested datetime
174
-			$datetimes = $this->get_many_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) );
174
+			$datetimes = $this->get_many_related('Datetime', array(array('DTT_ID' => $DTT_ID)));
175 175
 		} else {
176 176
 			// we need to check availability of ALL datetimes
177
-			$datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) );
177
+			$datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC')));
178 178
 		}
179 179
 		//		d( $datetimes );
180 180
 		// if datetime reg limit is not unlimited
181
-		if ( ! empty( $datetimes ) ) {
181
+		if ( ! empty($datetimes)) {
182 182
 			// although TKT_qty and $datetime->spaces_remaining() could both be EE_INF
183 183
 			// we only need to check for EE_INF explicitly if we want to optimize.
184 184
 			// because EE_INF - x = EE_INF; and min(x,EE_INF) = x;
185 185
 			$tickets_remaining = $this->qty() - $this->sold();
186
-			foreach ( $datetimes as $datetime ) {
187
-				if ( $datetime instanceof EE_Datetime ) {
188
-					$tickets_remaining = min( $tickets_remaining, $datetime->spaces_remaining() );
186
+			foreach ($datetimes as $datetime) {
187
+				if ($datetime instanceof EE_Datetime) {
188
+					$tickets_remaining = min($tickets_remaining, $datetime->spaces_remaining());
189 189
 				}
190 190
 			}
191 191
 			return $tickets_remaining;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @return int
201 201
 	 */
202 202
 	function min() {
203
-		return $this->get( 'TKT_min' );
203
+		return $this->get('TKT_min');
204 204
 	}
205 205
 
206 206
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @return boolean
211 211
 	 */
212 212
 	public function is_expired() {
213
-		return ( $this->get_raw( 'TKT_end_date' ) < time() );
213
+		return ($this->get_raw('TKT_end_date') < time());
214 214
 	}
215 215
 
216 216
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 * @return boolean
221 221
 	 */
222 222
 	public function is_pending() {
223
-		return ( $this->get_raw( 'TKT_start_date' ) > time() );
223
+		return ($this->get_raw('TKT_start_date') > time());
224 224
 	}
225 225
 
226 226
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 * @return boolean
231 231
 	 */
232 232
 	public function is_on_sale() {
233
-		return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() );
233
+		return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time());
234 234
 	}
235 235
 
236 236
 
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 	 * @param string 	$conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
242 242
 	 * @return array
243 243
 	 */
244
-	public function date_range( $dt_frmt = '', $conjunction = ' - ' ) {
245
-		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : '';
246
-		$last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : '';
244
+	public function date_range($dt_frmt = '', $conjunction = ' - ') {
245
+		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : '';
246
+		$last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : '';
247 247
 
248
-		return $first_date && $last_date ? $first_date . $conjunction  . $last_date : '';
248
+		return $first_date && $last_date ? $first_date.$conjunction.$last_date : '';
249 249
 	}
250 250
 
251 251
 
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
 	 * @return EE_Datetime
256 256
 	 */
257 257
 	public function first_datetime() {
258
-		$datetimes = $this->datetimes( array( 'limit' => 1 ) );
259
-		return reset( $datetimes );
258
+		$datetimes = $this->datetimes(array('limit' => 1));
259
+		return reset($datetimes);
260 260
 	}
261 261
 
262 262
 
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
 	 * @param array $query_params see EEM_Base::get_all()
268 268
 	 * @return EE_Datetime[]
269 269
 	 */
270
-	public function datetimes( $query_params = array() ) {
271
-		if ( ! isset( $query_params[ 'order_by' ] ) ) {
272
-			$query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC';
270
+	public function datetimes($query_params = array()) {
271
+		if ( ! isset($query_params['order_by'])) {
272
+			$query_params['order_by']['DTT_order'] = 'ASC';
273 273
 		}
274
-		return $this->get_many_related( 'Datetime', $query_params );
274
+		return $this->get_many_related('Datetime', $query_params);
275 275
 	}
276 276
 
277 277
 
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 	 * @return EE_Datetime
282 282
 	 */
283 283
 	public function last_datetime() {
284
-		$datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) );
285
-		return end( $datetimes );
284
+		$datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC')));
285
+		return end($datetimes);
286 286
 	}
287 287
 
288 288
 
@@ -296,22 +296,22 @@  discard block
 block discarded – undo
296 296
 	 * @param  int    $dtt_id [optional] include the dtt_id with $what = 'datetime'.
297 297
 	 * @return mixed (array|int)          how many tickets have sold
298 298
 	 */
299
-	public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) {
299
+	public function tickets_sold($what = 'ticket', $dtt_id = NULL) {
300 300
 		$total = 0;
301 301
 		$tickets_sold = $this->_all_tickets_sold();
302
-		switch ( $what ) {
302
+		switch ($what) {
303 303
 			case 'ticket' :
304
-				return $tickets_sold[ 'ticket' ];
304
+				return $tickets_sold['ticket'];
305 305
 				break;
306 306
 			case 'datetime' :
307
-				if ( empty( $tickets_sold[ 'datetime' ] ) ) {
307
+				if (empty($tickets_sold['datetime'])) {
308 308
 					return $total;
309 309
 				}
310
-				if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) {
311
-					EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
310
+				if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) {
311
+					EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
312 312
 					return $total;
313 313
 				}
314
-				return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ];
314
+				return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id];
315 315
 				break;
316 316
 			default:
317 317
 				return $total;
@@ -325,15 +325,15 @@  discard block
 block discarded – undo
325 325
 	 * @return EE_Ticket[]
326 326
 	 */
327 327
 	protected function _all_tickets_sold() {
328
-		$datetimes = $this->get_many_related( 'Datetime' );
328
+		$datetimes = $this->get_many_related('Datetime');
329 329
 		$tickets_sold = array();
330
-		if ( ! empty( $datetimes ) ) {
331
-			foreach ( $datetimes as $datetime ) {
332
-				$tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' );
330
+		if ( ! empty($datetimes)) {
331
+			foreach ($datetimes as $datetime) {
332
+				$tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold');
333 333
 			}
334 334
 		}
335 335
 		//Tickets sold
336
-		$tickets_sold[ 'ticket' ] = $this->sold();
336
+		$tickets_sold['ticket'] = $this->sold();
337 337
 		return $tickets_sold;
338 338
 	}
339 339
 
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 	 * @param  bool $return_array whether to return as an array indexed by price id or just the object.
347 347
 	 * @return EE_Price
348 348
 	 */
349
-	public function base_price( $return_array = FALSE ) {
350
-		$_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price );
351
-		return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) );
349
+	public function base_price($return_array = FALSE) {
350
+		$_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price);
351
+		return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where));
352 352
 	}
353 353
 
354 354
 
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 	 * @return EE_Price[]
361 361
 	 */
362 362
 	public function price_modifiers() {
363
-		$query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) );
364
-		return $this->prices( $query_params );
363
+		$query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax))));
364
+		return $this->prices($query_params);
365 365
 	}
366 366
 
367 367
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 * @param array $query_params like EEM_Base::get_all
372 372
 	 * @return EE_Price[]
373 373
 	 */
374
-	public function prices( $query_params = array() ) {
375
-		return $this->get_many_related( 'Price', $query_params );
374
+	public function prices($query_params = array()) {
375
+		return $this->get_many_related('Price', $query_params);
376 376
 	}
377 377
 
378 378
 
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 	 * @param array $query_params see EEM_Base::get_all()
383 383
 	 * @return EE_Datetime_Ticket
384 384
 	 */
385
-	public function datetime_tickets( $query_params = array() ) {
386
-		return $this->get_many_related( 'Datetime_Ticket', $query_params );
385
+	public function datetime_tickets($query_params = array()) {
386
+		return $this->get_many_related('Datetime_Ticket', $query_params);
387 387
 	}
388 388
 
389 389
 
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
 	 * @param boolean $show_deleted
395 395
 	 * @return EE_Datetime[]
396 396
 	 */
397
-	public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) {
398
-		return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted );
397
+	public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) {
398
+		return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted);
399 399
 	}
400 400
 
401 401
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 * @return string
406 406
 	 */
407 407
 	function ID() {
408
-		return $this->get( 'TKT_ID' );
408
+		return $this->get('TKT_ID');
409 409
 	}
410 410
 
411 411
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 	 * @return EE_Ticket_Template
430 430
 	 */
431 431
 	public function template() {
432
-		return $this->get_first_related( 'Ticket_Template' );
432
+		return $this->get_first_related('Ticket_Template');
433 433
 	}
434 434
 
435 435
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 * @return bool
449 449
 	 */
450 450
 	public function ticket_price() {
451
-		return $this->get( 'TKT_price' );
451
+		return $this->get('TKT_price');
452 452
 	}
453 453
 
454 454
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 * @return mixed
458 458
 	 */
459 459
 	public function pretty_price() {
460
-		return $this->get_pretty( 'TKT_price' );
460
+		return $this->get_pretty('TKT_price');
461 461
 	}
462 462
 
463 463
 
@@ -476,17 +476,17 @@  discard block
 block discarded – undo
476 476
 	 * @param bool $no_cache
477 477
 	 * @return float
478 478
 	 */
479
-	public function get_ticket_total_with_taxes( $no_cache = FALSE ) {
480
-		if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) {
479
+	public function get_ticket_total_with_taxes($no_cache = FALSE) {
480
+		if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) {
481 481
 			$this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin();
482 482
 		}
483
-		return (float)$this->_ticket_total_with_taxes;
483
+		return (float) $this->_ticket_total_with_taxes;
484 484
 	}
485 485
 
486 486
 
487 487
 
488 488
 	public function ensure_TKT_Price_correct() {
489
-		$this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) );
489
+		$this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this));
490 490
 		$this->save();
491 491
 	}
492 492
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 * @return float
497 497
 	 */
498 498
 	public function get_ticket_subtotal() {
499
-		return EE_Taxes::get_subtotal_for_admin( $this );
499
+		return EE_Taxes::get_subtotal_for_admin($this);
500 500
 	}
501 501
 
502 502
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	 * @return float
507 507
 	 */
508 508
 	public function get_ticket_taxes_total_for_admin() {
509
-		return EE_Taxes::get_total_taxes_for_admin( $this );
509
+		return EE_Taxes::get_total_taxes_for_admin($this);
510 510
 	}
511 511
 
512 512
 
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
 	 * @param string $name
517 517
 	 * @return boolean
518 518
 	 */
519
-	function set_name( $name ) {
520
-		$this->set( 'TKT_name', $name );
519
+	function set_name($name) {
520
+		$this->set('TKT_name', $name);
521 521
 	}
522 522
 
523 523
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 * @return string
528 528
 	 */
529 529
 	function description() {
530
-		return $this->get( 'TKT_description' );
530
+		return $this->get('TKT_description');
531 531
 	}
532 532
 
533 533
 
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
 	 * @param string $description
538 538
 	 * @return boolean
539 539
 	 */
540
-	function set_description( $description ) {
541
-		$this->set( 'TKT_description', $description );
540
+	function set_description($description) {
541
+		$this->set('TKT_description', $description);
542 542
 	}
543 543
 
544 544
 
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
 	 * @param string $tm_frmt
550 550
 	 * @return string
551 551
 	 */
552
-	function start_date( $dt_frmt = '', $tm_frmt = '' ) {
553
-		return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt );
552
+	function start_date($dt_frmt = '', $tm_frmt = '') {
553
+		return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt);
554 554
 	}
555 555
 
556 556
 
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
 	 * @param string $start_date
561 561
 	 * @return void
562 562
 	 */
563
-	function set_start_date( $start_date ) {
564
-		$this->_set_date_time( 'B', $start_date, 'TKT_start_date' );
563
+	function set_start_date($start_date) {
564
+		$this->_set_date_time('B', $start_date, 'TKT_start_date');
565 565
 	}
566 566
 
567 567
 
@@ -572,8 +572,8 @@  discard block
 block discarded – undo
572 572
 	 * @param string $tm_frmt
573 573
 	 * @return string
574 574
 	 */
575
-	function end_date( $dt_frmt = '', $tm_frmt = '' ) {
576
-		return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt );
575
+	function end_date($dt_frmt = '', $tm_frmt = '') {
576
+		return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt);
577 577
 	}
578 578
 
579 579
 
@@ -583,8 +583,8 @@  discard block
 block discarded – undo
583 583
 	 * @param string $end_date
584 584
 	 * @return void
585 585
 	 */
586
-	function set_end_date( $end_date ) {
587
-		$this->_set_date_time( 'B', $end_date, 'TKT_end_date' );
586
+	function set_end_date($end_date) {
587
+		$this->_set_date_time('B', $end_date, 'TKT_end_date');
588 588
 	}
589 589
 
590 590
 
@@ -596,8 +596,8 @@  discard block
 block discarded – undo
596 596
 	 *
597 597
 	 * @param string $time a string representation of the sell until time (ex 9am or 7:30pm)
598 598
 	 */
599
-	function set_end_time( $time ) {
600
-		$this->_set_time_for( $time, 'TKT_end_date' );
599
+	function set_end_time($time) {
600
+		$this->_set_time_for($time, 'TKT_end_date');
601 601
 	}
602 602
 
603 603
 
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 	 * @param int $min
608 608
 	 * @return boolean
609 609
 	 */
610
-	function set_min( $min ) {
611
-		$this->set( 'TKT_min', $min );
610
+	function set_min($min) {
611
+		$this->set('TKT_min', $min);
612 612
 	}
613 613
 
614 614
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 	 * @return int
619 619
 	 */
620 620
 	function max() {
621
-		return $this->get( 'TKT_max' );
621
+		return $this->get('TKT_max');
622 622
 	}
623 623
 
624 624
 
@@ -628,8 +628,8 @@  discard block
 block discarded – undo
628 628
 	 * @param int $max
629 629
 	 * @return boolean
630 630
 	 */
631
-	function set_max( $max ) {
632
-		$this->set( 'TKT_max', $max );
631
+	function set_max($max) {
632
+		$this->set('TKT_max', $max);
633 633
 	}
634 634
 
635 635
 
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
 	 * @param float $price
640 640
 	 * @return boolean
641 641
 	 */
642
-	function set_price( $price ) {
643
-		$this->set( 'TKT_price', $price );
642
+	function set_price($price) {
643
+		$this->set('TKT_price', $price);
644 644
 	}
645 645
 
646 646
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 * @return int
651 651
 	 */
652 652
 	function sold() {
653
-		return $this->get_raw( 'TKT_sold' );
653
+		return $this->get_raw('TKT_sold');
654 654
 	}
655 655
 
656 656
 
@@ -660,10 +660,10 @@  discard block
 block discarded – undo
660 660
 	 * @param int $qty
661 661
 	 * @return boolean
662 662
 	 */
663
-	function increase_sold( $qty = 1 ) {
663
+	function increase_sold($qty = 1) {
664 664
 		$sold = $this->sold() + $qty;
665
-		$this->_increase_sold_for_datetimes( $qty );
666
-		return $this->set_sold( $sold );
665
+		$this->_increase_sold_for_datetimes($qty);
666
+		return $this->set_sold($sold);
667 667
 	}
668 668
 
669 669
 
@@ -673,12 +673,12 @@  discard block
 block discarded – undo
673 673
 	 * @param int $qty
674 674
 	 * @return boolean
675 675
 	 */
676
-	protected function _increase_sold_for_datetimes( $qty = 1 ) {
676
+	protected function _increase_sold_for_datetimes($qty = 1) {
677 677
 		$datetimes = $this->datetimes();
678
-		if ( is_array( $datetimes ) ) {
679
-			foreach ( $datetimes as $datetime ) {
680
-				if ( $datetime instanceof EE_Datetime ) {
681
-					$datetime->increase_sold( $qty );
678
+		if (is_array($datetimes)) {
679
+			foreach ($datetimes as $datetime) {
680
+				if ($datetime instanceof EE_Datetime) {
681
+					$datetime->increase_sold($qty);
682 682
 					$datetime->save();
683 683
 				}
684 684
 			}
@@ -692,10 +692,10 @@  discard block
 block discarded – undo
692 692
 	 * @param int $sold
693 693
 	 * @return boolean
694 694
 	 */
695
-	function set_sold( $sold ) {
695
+	function set_sold($sold) {
696 696
 		// sold can not go below zero
697
-		$sold = max( 0, $sold );
698
-		$this->set( 'TKT_sold', $sold );
697
+		$sold = max(0, $sold);
698
+		$this->set('TKT_sold', $sold);
699 699
 	}
700 700
 
701 701
 
@@ -705,10 +705,10 @@  discard block
 block discarded – undo
705 705
 	 * @param int $qty
706 706
 	 * @return boolean
707 707
 	 */
708
-	function decrease_sold( $qty = 1 ) {
708
+	function decrease_sold($qty = 1) {
709 709
 		$sold = $this->sold() - $qty;
710
-		$this->_decrease_sold_for_datetimes( $qty );
711
-		return $this->set_sold( $sold );
710
+		$this->_decrease_sold_for_datetimes($qty);
711
+		return $this->set_sold($sold);
712 712
 	}
713 713
 
714 714
 
@@ -719,12 +719,12 @@  discard block
 block discarded – undo
719 719
 	* @param int $qty
720 720
 	* @return boolean
721 721
 	*/
722
-	protected function _decrease_sold_for_datetimes( $qty = 1 ) {
722
+	protected function _decrease_sold_for_datetimes($qty = 1) {
723 723
 		$datetimes = $this->datetimes();
724
-		if ( is_array( $datetimes ) ) {
725
-			foreach ( $datetimes as $datetime ) {
726
-				if ( $datetime instanceof EE_Datetime ) {
727
-					$datetime->decrease_sold( $qty );
724
+		if (is_array($datetimes)) {
725
+			foreach ($datetimes as $datetime) {
726
+				if ($datetime instanceof EE_Datetime) {
727
+					$datetime->decrease_sold($qty);
728 728
 					$datetime->save();
729 729
 				}
730 730
 			}
@@ -745,14 +745,14 @@  discard block
 block discarded – undo
745 745
 	 *
746 746
 	 * @return int
747 747
 	 */
748
-	function qty( $context = '' ) {
749
-		switch ( $context ) {
748
+	function qty($context = '') {
749
+		switch ($context) {
750 750
 			case 'reg_limit' :
751 751
 				return $this->real_quantity_on_ticket();
752 752
 			case 'saleable' :
753
-				return $this->real_quantity_on_ticket( 'saleable' );
753
+				return $this->real_quantity_on_ticket('saleable');
754 754
 			default:
755
-				return $this->get_raw( 'TKT_qty' );
755
+				return $this->get_raw('TKT_qty');
756 756
 		}
757 757
 	}
758 758
 
@@ -769,38 +769,38 @@  discard block
 block discarded – undo
769 769
 	 *
770 770
 	 * @return int
771 771
 	 */
772
-	function real_quantity_on_ticket( $context = 'reg_limit' ) {
772
+	function real_quantity_on_ticket($context = 'reg_limit') {
773 773
 		// start with the original db value for ticket quantity
774
-		$raw = $this->get_raw( 'TKT_qty' );
774
+		$raw = $this->get_raw('TKT_qty');
775 775
 		// return immediately if it's zero
776
-		if ( $raw === 0 ) {
776
+		if ($raw === 0) {
777 777
 			return $raw;
778 778
 		}
779 779
 		// ensure qty doesn't exceed raw value for THIS ticket
780
-		$qty = min( EE_INF, $raw );
780
+		$qty = min(EE_INF, $raw);
781 781
 		// NOW that we know the  maximum number of tickets available for the ticket
782 782
 		// we need to calculate the maximum number of tickets available for the datetime
783 783
 		// without really factoring this ticket into the calculations
784 784
 		$datetimes = $this->datetimes();
785
-		foreach ( $datetimes as $datetime ) {
786
-			if ( $datetime instanceof EE_Datetime ) {
785
+		foreach ($datetimes as $datetime) {
786
+			if ($datetime instanceof EE_Datetime) {
787 787
 				// initialize with no restrictions for each datetime
788 788
 				// but adjust datetime qty based on datetime reg limit
789
-				$datetime_qty = min( EE_INF, $datetime->reg_limit() );
789
+				$datetime_qty = min(EE_INF, $datetime->reg_limit());
790 790
 				// if we want the actual saleable amount, then we need to consider OTHER ticket sales
791 791
 				// for this datetime, that do NOT include sales for this ticket (so we add THIS ticket's sales back in)
792
-				if ( $context == 'saleable' ) {
793
-					$datetime_qty = max( $datetime_qty - $datetime->sold() + $this->sold(), 0 );
792
+				if ($context == 'saleable') {
793
+					$datetime_qty = max($datetime_qty - $datetime->sold() + $this->sold(), 0);
794 794
 					$datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0;
795 795
 				}
796
-				$qty = min( $datetime_qty, $qty );
796
+				$qty = min($datetime_qty, $qty);
797 797
 			}
798 798
 
799 799
 		}
800 800
 		// we need to factor in the details for this specific ticket
801
-		if ( $qty > 0 && $context == 'saleable' ) {
801
+		if ($qty > 0 && $context == 'saleable') {
802 802
 			// and subtract the sales for THIS ticket
803
-			$qty = max( $qty - $this->sold(), 0 );
803
+			$qty = max($qty - $this->sold(), 0);
804 804
 			//echo '&nbsp; $qty: ' . $qty . "<br />";
805 805
 		}
806 806
 		//echo '$qty: ' . $qty . "<br />";
@@ -816,14 +816,14 @@  discard block
 block discarded – undo
816 816
 	 * @return bool
817 817
 	 * @throws \EE_Error
818 818
 	 */
819
-	function set_qty( $qty ) {
819
+	function set_qty($qty) {
820 820
 		$datetimes = $this->datetimes();
821
-		foreach ( $datetimes as $datetime ) {
822
-			if ( $datetime instanceof EE_Datetime ) {
823
-				$qty = min( $qty, $datetime->reg_limit() );
821
+		foreach ($datetimes as $datetime) {
822
+			if ($datetime instanceof EE_Datetime) {
823
+				$qty = min($qty, $datetime->reg_limit());
824 824
 			}
825 825
 		}
826
-		$this->set( 'TKT_qty', $qty );
826
+		$this->set('TKT_qty', $qty);
827 827
 	}
828 828
 
829 829
 
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 	 * @return int
834 834
 	 */
835 835
 	function uses() {
836
-		return $this->get( 'TKT_uses' );
836
+		return $this->get('TKT_uses');
837 837
 	}
838 838
 
839 839
 
@@ -843,8 +843,8 @@  discard block
 block discarded – undo
843 843
 	 * @param int $uses
844 844
 	 * @return boolean
845 845
 	 */
846
-	function set_uses( $uses ) {
847
-		$this->set( 'TKT_uses', $uses );
846
+	function set_uses($uses) {
847
+		$this->set('TKT_uses', $uses);
848 848
 	}
849 849
 
850 850
 
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 	 * @return boolean
855 855
 	 */
856 856
 	public function required() {
857
-		return $this->get( 'TKT_required' );
857
+		return $this->get('TKT_required');
858 858
 	}
859 859
 
860 860
 
@@ -864,8 +864,8 @@  discard block
 block discarded – undo
864 864
 	 * @param boolean $required
865 865
 	 * @return boolean
866 866
 	 */
867
-	public function set_required( $required ) {
868
-		$this->set( 'TKT_required', $required );
867
+	public function set_required($required) {
868
+		$this->set('TKT_required', $required);
869 869
 	}
870 870
 
871 871
 
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 	 * @return boolean
876 876
 	 */
877 877
 	function taxable() {
878
-		return $this->get( 'TKT_taxable' );
878
+		return $this->get('TKT_taxable');
879 879
 	}
880 880
 
881 881
 
@@ -885,8 +885,8 @@  discard block
 block discarded – undo
885 885
 	 * @param boolean $taxable
886 886
 	 * @return boolean
887 887
 	 */
888
-	function set_taxable( $taxable ) {
889
-		$this->set( 'TKT_taxable', $taxable );
888
+	function set_taxable($taxable) {
889
+		$this->set('TKT_taxable', $taxable);
890 890
 	}
891 891
 
892 892
 
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 	 * @return boolean
897 897
 	 */
898 898
 	function is_default() {
899
-		return $this->get( 'TKT_is_default' );
899
+		return $this->get('TKT_is_default');
900 900
 	}
901 901
 
902 902
 
@@ -906,8 +906,8 @@  discard block
 block discarded – undo
906 906
 	 * @param boolean $is_default
907 907
 	 * @return boolean
908 908
 	 */
909
-	function set_is_default( $is_default ) {
910
-		$this->set( 'TKT_is_default', $is_default );
909
+	function set_is_default($is_default) {
910
+		$this->set('TKT_is_default', $is_default);
911 911
 	}
912 912
 
913 913
 
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 	 * @return int
918 918
 	 */
919 919
 	function order() {
920
-		return $this->get( 'TKT_order' );
920
+		return $this->get('TKT_order');
921 921
 	}
922 922
 
923 923
 
@@ -927,8 +927,8 @@  discard block
 block discarded – undo
927 927
 	 * @param int $order
928 928
 	 * @return boolean
929 929
 	 */
930
-	function set_order( $order ) {
931
-		$this->set( 'TKT_order', $order );
930
+	function set_order($order) {
931
+		$this->set('TKT_order', $order);
932 932
 	}
933 933
 
934 934
 
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 	 * @return int
939 939
 	 */
940 940
 	function row() {
941
-		return $this->get( 'TKT_row' );
941
+		return $this->get('TKT_row');
942 942
 	}
943 943
 
944 944
 
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
 	 * @param int $row
949 949
 	 * @return boolean
950 950
 	 */
951
-	function set_row( $row ) {
952
-		$this->set( 'TKT_row', $row );
951
+	function set_row($row) {
952
+		$this->set('TKT_row', $row);
953 953
 	}
954 954
 
955 955
 
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 	 * @return boolean
960 960
 	 */
961 961
 	function deleted() {
962
-		return $this->get( 'TKT_deleted' );
962
+		return $this->get('TKT_deleted');
963 963
 	}
964 964
 
965 965
 
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
 	 * @param boolean $deleted
970 970
 	 * @return boolean
971 971
 	 */
972
-	function set_deleted( $deleted ) {
973
-		$this->set( 'TKT_deleted', $deleted );
972
+	function set_deleted($deleted) {
973
+		$this->set('TKT_deleted', $deleted);
974 974
 	}
975 975
 
976 976
 
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 	 * @return int
981 981
 	 */
982 982
 	function parent_ID() {
983
-		return $this->get( 'TKT_parent' );
983
+		return $this->get('TKT_parent');
984 984
 	}
985 985
 
986 986
 
@@ -990,8 +990,8 @@  discard block
 block discarded – undo
990 990
 	 * @param int $parent
991 991
 	 * @return boolean
992 992
 	 */
993
-	function set_parent_ID( $parent ) {
994
-		$this->set( 'TKT_parent', $parent );
993
+	function set_parent_ID($parent) {
994
+		$this->set('TKT_parent', $parent);
995 995
 	}
996 996
 
997 997
 
@@ -1002,10 +1002,10 @@  discard block
 block discarded – undo
1002 1002
 	 */
1003 1003
 	function name_and_info() {
1004 1004
 		$times = array();
1005
-		foreach ( $this->datetimes() as $datetime ) {
1005
+		foreach ($this->datetimes() as $datetime) {
1006 1006
 			$times[] = $datetime->start_date_and_time();
1007 1007
 		}
1008
-		return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->price();
1008
+		return $this->name()." @ ".implode(", ", $times)." for ".$this->price();
1009 1009
 	}
1010 1010
 
1011 1011
 
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 	 * @return string
1016 1016
 	 */
1017 1017
 	function name() {
1018
-		return $this->get( 'TKT_name' );
1018
+		return $this->get('TKT_name');
1019 1019
 	}
1020 1020
 
1021 1021
 
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 	 * @return float
1026 1026
 	 */
1027 1027
 	function price() {
1028
-		return $this->get( 'TKT_price' );
1028
+		return $this->get('TKT_price');
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1035,8 +1035,8 @@  discard block
 block discarded – undo
1035 1035
 	 * @param array $query_params like EEM_Base::get_all's
1036 1036
 	 * @return EE_Registration[]
1037 1037
 	 */
1038
-	public function registrations( $query_params = array() ) {
1039
-		return $this->get_many_related( 'Registration', $query_params );
1038
+	public function registrations($query_params = array()) {
1039
+		return $this->get_many_related('Registration', $query_params);
1040 1040
 	}
1041 1041
 
1042 1042
 
@@ -1047,8 +1047,8 @@  discard block
 block discarded – undo
1047 1047
 	 * @return int
1048 1048
 	 */
1049 1049
 	public function update_tickets_sold() {
1050
-		$count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) );
1051
-		$this->set_sold( $count_regs_for_this_ticket );
1050
+		$count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0)));
1051
+		$this->set_sold($count_regs_for_this_ticket);
1052 1052
 		$this->save();
1053 1053
 		return $count_regs_for_this_ticket;
1054 1054
 	}
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 	 * @param array $query_params like EEM_Base::get_all's
1061 1061
 	 * @return int
1062 1062
 	 */
1063
-	public function count_registrations( $query_params = array() ) {
1063
+	public function count_registrations($query_params = array()) {
1064 1064
 		return $this->count_related('Registration', $query_params);
1065 1065
 	}
1066 1066
 
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 	public function get_related_event() {
1086 1086
 		//get one datetime to use for getting the event
1087 1087
 		$datetime = $this->first_datetime();
1088
-		if ( $datetime instanceof EE_Datetime ) {
1088
+		if ($datetime instanceof EE_Datetime) {
1089 1089
 			return $datetime->event();
1090 1090
 		}
1091 1091
 		return null;
Please login to merge, or discard this patch.
core/db_models/EEM_Ticket.model.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Ticket.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Ticket.class.php');
26 26
 
27 27
 class EEM_Ticket extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,35 +35,35 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Ticket','event_espresso');
40
-		$this->plural_item = __('Tickets','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Ticket', 'event_espresso');
40
+		$this->plural_item = __('Tickets', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Ticket'=>array(
47
-				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')),
48
-				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'),
47
+				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')),
48
+				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'),
49 49
 				'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''),
50
-				'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ),
51
-				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, time(), $timezone ),
52
-				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, time(), $timezone ),
53
-				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ),
54
-				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ),
50
+				'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''),
51
+				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, time(), $timezone),
52
+				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, time(), $timezone),
53
+				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0),
54
+				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF),
55 55
 				'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0),
56 56
 				'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0),
57
-				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF),
58
-				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ),
59
-				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ),
60
-				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false),
61
-				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ),
57
+				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF),
58
+				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF),
59
+				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false),
60
+				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false),
61
+				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false),
62 62
 				'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0),
63
-				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ),
63
+				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0),
64 64
 				'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false),
65
-				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ),
66
-				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 )
65
+				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE),
66
+				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0)
67 67
 			));
68 68
 		$this->_model_relations = array(
69 69
 			'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		);
76 76
 
77 77
 		//this model is generally available for reading
78
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
78
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
79 79
 		//account for default tickets in the caps
80
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
81
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
82
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
83
-		parent::__construct( $timezone );
80
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
81
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
82
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
83
+		parent::__construct($timezone);
84 84
 	}
85 85
 
86 86
 
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function get_all_default_tickets() {
93 93
 		/** @type EE_Ticket[] $tickets */
94
-		$tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC')) );
94
+		$tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC')));
95 95
 		//we need to set the start date and end date to today's date and the start of the default dtt
96
-		return $this->_set_default_dates( $tickets );
96
+		return $this->_set_default_dates($tickets);
97 97
 	}
98 98
 
99 99
 
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	 * @param EE_Ticket[] $tickets
104 104
 	 * @return EE_Ticket[]
105 105
 	 */
106
-	private function _set_default_dates( $tickets ) {
107
-		foreach ( $tickets as $ticket ) {
108
-			$ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true) );
109
-			$ticket->set('TKT_end_date', $this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) );
110
-			$ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) );
106
+	private function _set_default_dates($tickets) {
107
+		foreach ($tickets as $ticket) {
108
+			$ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true));
109
+			$ticket->set('TKT_end_date', $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30));
110
+			$ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone));
111 111
 		}
112 112
 
113 113
 		return $tickets;
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @param array $query_params
123 123
 	 * @return int
124 124
 	 */
125
-	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){
126
-		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params );
125
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
126
+		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params);
127 127
 	}
128 128
 
129 129
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @param EE_Ticket[] $tickets
134 134
 	 * @return void
135 135
 	 */
136
-	public function update_tickets_sold($tickets){
137
-		foreach($tickets as $ticket){
136
+	public function update_tickets_sold($tickets) {
137
+		foreach ($tickets as $ticket) {
138 138
 			/* @var  $ticket EE_Ticket */
139 139
 			$ticket->update_tickets_sold();
140 140
 		}
Please login to merge, or discard this patch.
modules/ticket_selector/templates/ticket_selector_chart.template.php 1 patch
Spacing   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -8,32 +8,32 @@  discard block
 block discarded – undo
8 8
 
9 9
 $row = 1;
10 10
 $max = 1;
11
-$ticket_count = count( $tickets );
11
+$ticket_count = count($tickets);
12 12
 
13
-if ( ! $ticket_count ) {
13
+if ( ! $ticket_count) {
14 14
 	return;
15 15
 }
16 16
 
17 17
 $required_ticket_sold_out = FALSE;
18
-$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config();
18
+$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config();
19 19
 ob_start();
20 20
 
21
-foreach ( $tickets as $TKT_ID => $ticket ) {
22
-	if ( $ticket instanceof EE_Ticket ) {
21
+foreach ($tickets as $TKT_ID => $ticket) {
22
+	if ($ticket instanceof EE_Ticket) {
23 23
 		//	d( $ticket );
24
-		$max =$ticket->max();
24
+		$max = $ticket->max();
25 25
 		$min = 0;
26 26
 		$remaining = $ticket->remaining();
27
-		if ( $ticket->is_on_sale() && $ticket->is_remaining() ) {
27
+		if ($ticket->is_on_sale() && $ticket->is_remaining()) {
28 28
 			// offer the number of $tickets_remaining or $max_atndz, whichever is smaller
29
-			$max = min( $remaining, $max_atndz );
29
+			$max = min($remaining, $max_atndz);
30 30
 			// but... we also want to restrict the number of tickets by the ticket max setting,
31 31
 			// however, the max still can't be higher than what was just set above
32
-			$max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max;
32
+			$max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max;
33 33
 			// and we also want to restrict the minimum number of tickets by the ticket min setting
34 34
 			$min = $ticket->min() > 0 ? $ticket->min() : 0;
35 35
 			// and if the ticket is required, then make sure that min qty is at least 1
36
-			$min = $ticket->required() ? max( $min, 1 ) : $min;
36
+			$min = $ticket->required() ? max($min, 1) : $min;
37 37
 		} else {
38 38
 			// set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
39 39
 			$required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out;
@@ -42,40 +42,40 @@  discard block
 block discarded – undo
42 42
 		$ticket_price = $ticket->get_ticket_total_with_taxes();
43 43
 		$ticket_bundle = FALSE;
44 44
 		// for ticket bundles, set min and max qty the same
45
-		if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) {
45
+		if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) {
46 46
 			$ticket_price = $ticket_price * $ticket->min();
47 47
 			$ticket_bundle = TRUE;
48 48
 		}
49
-		$ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket );
49
+		$ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket);
50 50
 		// if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well.
51 51
 		// tickets that go on sale at a later date than the required ticket  will NOT be affected
52 52
 		$tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status();
53 53
 		$tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status;
54 54
 		// check ticket status
55
-		switch ( $tkt_status ) {
55
+		switch ($tkt_status) {
56 56
 			// sold_out
57 57
 			case EE_Ticket::sold_out :
58
-				$ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>';
58
+				$ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>';
59 59
 				$status_class = 'ticket-sales-sold-out lt-grey-text';
60 60
 			break;
61 61
 			// expired
62 62
 			case EE_Ticket::expired :
63
-				$ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>';
63
+				$ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>';
64 64
 				$status_class = 'ticket-sales-expired lt-grey-text';
65 65
 			break;
66 66
 			// archived
67 67
 			case EE_Ticket::archived :
68
-				$ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>';
68
+				$ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>';
69 69
 				$status_class = 'archived-ticket hidden';
70 70
 			break;
71 71
 			// pending
72 72
 			case EE_Ticket::pending :
73
-				$ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>';
73
+				$ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>';
74 74
 				$status_class = 'ticket-pending';
75 75
 			break;
76 76
 			// onsale
77 77
 			case EE_Ticket::onsale :
78
-				$ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>';
78
+				$ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>';
79 79
 				$status_class = 'ticket-on-sale';
80 80
 			break;
81 81
 		}
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 		 *
91 91
 		 * @var string|bool
92 92
 		 */
93
-		if ( false !== ( $new_row_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) {
93
+		if (false !== ($new_row_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_entire_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) {
94 94
 			echo $new_row_content;
95 95
 			continue;
96 96
 		}
97 97
 	?>
98
-				<tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>">
98
+				<tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>">
99 99
 		<?php
100 100
 		/**
101 101
 		 * Allow plugins to hook in and abort the generation and display of the contents of this
@@ -107,24 +107,24 @@  discard block
 block discarded – undo
107 107
 		 *
108 108
 		 * @var string|bool
109 109
 		 */
110
-		if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) {
110
+		if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) {
111 111
 			echo $new_row_cells_content;
112 112
 			echo '</tr>';
113 113
 			continue;
114 114
 		}
115 115
 		?>
116 116
 					<td class="tckt-slctr-tbl-td-name">
117
-						<b><?php echo $ticket->get_pretty('TKT_name');?></b>
118
-						<?php if ( $template_settings->show_ticket_details ) : ?>
119
-							<a id="display-tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>">
120
-								<?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), '&nbsp;' ); ?>
117
+						<b><?php echo $ticket->get_pretty('TKT_name'); ?></b>
118
+						<?php if ($template_settings->show_ticket_details) : ?>
119
+							<a id="display-tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>">
120
+								<?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), '&nbsp;'); ?>
121 121
 							</a>
122
-							<a id="hide-tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;">
123
-								<?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), '&nbsp;' ); ?>
122
+							<a id="hide-tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;">
123
+								<?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), '&nbsp;'); ?>
124 124
 							</a>
125 125
 						<?php endif; //end show details check ?>
126
-					<?php if ( $ticket->required() ) { ?>
127
-						<p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p>
126
+					<?php if ($ticket->required()) { ?>
127
+						<p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p>
128 128
 					<?php } ?>
129 129
 					<?php
130 130
 //	echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>';
@@ -138,63 +138,63 @@  discard block
 block discarded – undo
138 138
 //	echo '<br/><b> $ticket->required() : ' .  $ticket->uses() . '</b>';
139 139
 					?>
140 140
 					</td>
141
-					<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
142
-					<td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?>&nbsp;<span class="smaller-text no-bold"><?php
143
-						if ( $ticket_bundle ) {
144
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' ));
141
+					<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
142
+					<td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?>&nbsp;<span class="smaller-text no-bold"><?php
143
+						if ($ticket_bundle) {
144
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso'));
145 145
 						} else {
146
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' ));
146
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso'));
147 147
 						}?></span>&nbsp;</td>
148 148
 					<?php } ?>
149 149
 					<td class="tckt-slctr-tbl-td-qty cntr">
150 150
 					<?php
151 151
 					$hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE;
152 152
 					// sold out or other status ?
153
-					if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) {
153
+					if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) {
154 154
 					?>
155
-						<span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold&nbsp;Out', 'event_espresso' ));?></span>
155
+						<span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold&nbsp;Out', 'event_espresso')); ?></span>
156 156
 					<?php
157
-					} else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) {
157
+					} else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) {
158 158
 						echo $ticket_status;
159
-					} else if ( $tkt_status == EE_Ticket::pending ) {
159
+					} else if ($tkt_status == EE_Ticket::pending) {
160 160
 					?>
161 161
 					<div class="ticket-pending-pg">
162
-						<span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes&nbsp;On&nbsp;Sale', 'event_espresso' )); ?></span><br/>
163
-						<span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span>
162
+						<span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes&nbsp;On&nbsp;Sale', 'event_espresso')); ?></span><br/>
163
+						<span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span>
164 164
 					</div>
165 165
 					<?php
166 166
 					// min qty purchasable is less than tickets available
167
-					} else if ( $ticket->min() > $remaining ) {
167
+					} else if ($ticket->min() > $remaining) {
168 168
 					?>
169 169
 					<div class="archived-ticket-pg">
170
-						<span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/>
170
+						<span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/>
171 171
 					</div>
172 172
 					<?php
173 173
 					// if only one attendee is allowed to register at a time
174
-					} else if ( $max_atndz  == 1 ) {
174
+					} else if ($max_atndz == 1) {
175 175
 						// display submit button since we have tickets available
176
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
176
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
177 177
 				?>
178
-					<input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?>  title=""/>
178
+					<input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?>  title=""/>
179 179
 			<?php
180 180
 						$hidden_input_qty = FALSE;
181 181
 
182
-					} else if ( $max_atndz  == 0 ) {
183
-						echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>';
184
-					} elseif ( $max > 0 ) {
182
+					} else if ($max_atndz == 0) {
183
+						echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>';
184
+					} elseif ($max > 0) {
185 185
 						// display submit button since we have tickets available
186
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
186
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
187 187
 
188 188
 				?>
189
-					<select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title="">
189
+					<select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title="">
190 190
 					<?php
191 191
 						// this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
192
-						if ( ! $ticket->required() && $min !== 0 ) {
192
+						if ( ! $ticket->required() && $min !== 0) {
193 193
 					?>
194 194
 						<option value="0">&nbsp;0&nbsp;</option>
195 195
 					<?php }
196 196
 						// offer ticket quantities from the min to the max
197
-						for ( $i = $min; $i <= $max; $i++) {
197
+						for ($i = $min; $i <= $max; $i++) {
198 198
 					?>
199 199
 						<option value="<?php echo $i; ?>">&nbsp;<?php echo $i; ?>&nbsp;</option>
200 200
 					<?php } ?>
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 
205 205
 					}
206 206
 					// depending on group reg we need to change the format for qty
207
-					if ( $hidden_input_qty ) {
207
+					if ($hidden_input_qty) {
208 208
 					?>
209 209
 					<input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" />
210 210
 					<?php
@@ -214,33 +214,33 @@  discard block
 block discarded – undo
214 214
 
215 215
 					</td>
216 216
 				</tr>
217
-				<?php if ( $template_settings->show_ticket_details ) : ?>
218
-					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>">
217
+				<?php if ($template_settings->show_ticket_details) : ?>
218
+					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>">
219 219
 						<td class="tckt-slctr-tkt-details-td" colspan="3" >
220
-							<div id="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;">
220
+							<div id="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;">
221 221
 
222 222
 								<section class="tckt-slctr-tkt-details-sctn">
223
-									<h3><?php _e( 'Details', 'event_espresso' ); ?></h3>
223
+									<h3><?php _e('Details', 'event_espresso'); ?></h3>
224 224
 									<p><?php echo $ticket->description(); ?></p>
225 225
 
226
-									<?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
226
+									<?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
227 227
 									<section class="tckt-slctr-tkt-price-sctn">
228
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5>
228
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5>
229 229
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
230 230
 											<table class="tckt-slctr-tkt-details-tbl">
231 231
 												<thead>
232 232
 													<tr>
233
-														<th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th>
234
-														<th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th>
235
-														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th>
233
+														<th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th>
234
+														<th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th>
235
+														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th>
236 236
 													</tr>
237 237
 												</thead>
238 238
 												<tbody>
239
-										<?php if ( $ticket->base_price() instanceof EE_Price ) { ?>
239
+										<?php if ($ticket->base_price() instanceof EE_Price) { ?>
240 240
 													<tr>
241
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
242
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
243
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
241
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
242
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
243
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
244 244
 													</tr>
245 245
 													<?php
246 246
 															$running_total = $ticket->base_price()->amount();
@@ -248,44 +248,44 @@  discard block
 block discarded – undo
248 248
 															$running_total = 0;
249 249
 														}
250 250
 														// now add price modifiers
251
-														foreach ( $ticket->price_modifiers() as $price_mod ) { ?>
251
+														foreach ($ticket->price_modifiers() as $price_mod) { ?>
252 252
 													<tr>
253
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
254
-													<?php if ( $price_mod->is_percent() ) { ?>
255
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
253
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
254
+													<?php if ($price_mod->is_percent()) { ?>
255
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
256 256
 														<?php
257
-															$new_sub_total = $running_total * ( $price_mod->amount() / 100 );
257
+															$new_sub_total = $running_total * ($price_mod->amount() / 100);
258 258
 															$new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total;
259 259
 														?>
260 260
 													<?php } else { ?>
261 261
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
262
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
262
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
263 263
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
264 264
 													<?php } ?>
265
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td>
265
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td>
266 266
 														<?php $running_total += $new_sub_total; ?>
267 267
 													</tr>
268 268
 												<?php } ?>
269
-												<?php if ( $ticket->taxable() ) { ?>
269
+												<?php if ($ticket->taxable()) { ?>
270 270
 													<?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?>
271 271
 													<tr>
272
-														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td>
273
-														<td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency( $running_total ); ?></b></td>
272
+														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td>
273
+														<td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency($running_total); ?></b></td>
274 274
 													</tr>
275 275
 
276
-													<?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?>
276
+													<?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?>
277 277
 													<tr>
278
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
279
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
280
-														<?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?>
281
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td>
278
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
279
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
280
+														<?php $tax_amount = $running_total * ($tax->amount() / 100); ?>
281
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td>
282 282
 														<?php $running_total += $tax_amount; ?>
283 283
 													</tr>
284 284
 													<?php } ?>
285 285
 												<?php } ?>
286 286
 													<tr>
287
-														<td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td>
288
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td>
287
+														<td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td>
288
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td>
289 289
 													</tr>
290 290
 												</tbody>
291 291
 											</table>
@@ -295,106 +295,106 @@  discard block
 block discarded – undo
295 295
 									<?php } ?>
296 296
 
297 297
 									<section class="tckt-slctr-tkt-sale-dates-sctn">
298
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5>
299
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/>
300
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date',  $time_format ) ; ?><br/>
301
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/>
298
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5>
299
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/>
300
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/>
301
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/>
302 302
 									</section>
303 303
 									<br/>
304 304
 
305
-									<?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?>
305
+									<?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?>
306 306
 
307
-									<?php if ( $ticket->min() &&$ticket->max() ) { ?>
307
+									<?php if ($ticket->min() && $ticket->max()) { ?>
308 308
 									<section class="tckt-slctr-tkt-quantities-sctn">
309
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5>
310
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/>
311
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
312
-										<?php if ( $ticket->min() > $remaining ) { ?> &nbsp; <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/>
309
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5>
310
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/>
311
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
312
+										<?php if ($ticket->min() > $remaining) { ?> &nbsp; <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/>
313 313
 										<?php //$max = min( $max, $max_atndz );?>
314
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/>
314
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/>
315 315
 									</section>
316 316
 									<br/>
317 317
 									<?php } ?>
318 318
 
319
-									<?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?>
319
+									<?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?>
320 320
 									<section class="tckt-slctr-tkt-uses-sctn">
321
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5>
321
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5>
322 322
 										<span class="drk-grey-text small-text no-bold"> - <?php
323 323
 											echo apply_filters(
324 324
 												'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message',
325 325
 												sprintf(
326
-													__( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ),
326
+													__('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'),
327 327
 													'<br/>',
328 328
 													'<strong>',
329 329
 													'</strong>'
330 330
 												)
331 331
 											);
332 332
 											?></span><br/>
333
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php  echo $ticket->uses();?><br/>
333
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php  echo $ticket->uses(); ?><br/>
334 334
 									</section>
335 335
 									<?php } ?>
336 336
 
337 337
 									<?php
338
-									$datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE );
338
+									$datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE);
339 339
 									$chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width';
340
-									if ( ! empty( $datetimes )) { ?>
340
+									if ( ! empty($datetimes)) { ?>
341 341
 									<section class="tckt-slctr-tkt-datetimes-sctn">
342
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5>
343
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span>
342
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5>
343
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span>
344 344
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
345 345
 											<table class="tckt-slctr-tkt-details-tbl">
346 346
 												<thead>
347 347
 													<tr>
348 348
 														<th class="tckt-slctr-tkt-details-date-th">
349
-															<span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span>
349
+															<span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span>
350 350
 														</th>
351 351
 														<th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>">
352
-															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span>
352
+															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span>
353 353
 														</th>
354
-														<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
354
+														<?php if ($template_settings->show_ticket_sale_columns) : ?>
355 355
 															<th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr">
356
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span>
356
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span>
357 357
 															</th>
358 358
 															<th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr">
359
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span>
359
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span>
360 360
 															</th>
361 361
 															<th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr">
362
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span>
362
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span>
363 363
 															</th>
364 364
 															<th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr">
365
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span>
365
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span>
366 366
 															</th>
367 367
 														<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
368 368
 													</tr>
369 369
 												</thead>
370 370
 												<tbody>
371 371
 											<?php
372
-												foreach ( $datetimes as $datetime ) {
373
-													if ( $datetime instanceof EE_Datetime ) {
372
+												foreach ($datetimes as $datetime) {
373
+													if ($datetime instanceof EE_Datetime) {
374 374
 											?>
375 375
 
376 376
 												<tr>
377
-													<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text">
377
+													<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text">
378 378
 														<?php $datetime_name = $datetime->name(); ?>
379
-														<?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?>
380
-														<?php echo $datetime->date_range( $date_format, __( ' to  ', 'event_espresso' )); ?>
379
+														<?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?>
380
+														<?php echo $datetime->date_range($date_format, __(' to  ', 'event_espresso')); ?>
381 381
 													</td>
382
-													<td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text">
383
-														<?php echo $datetime->time_range( $time_format, __( ' to  ', 'event_espresso' )); ?>
382
+													<td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text">
383
+														<?php echo $datetime->time_range($time_format, __(' to  ', 'event_espresso')); ?>
384 384
 													</td>
385
-													<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
386
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text">
385
+													<?php if ($template_settings->show_ticket_sale_columns) : ?>
386
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text">
387 387
 															<?php echo $ticket->sold(); ?>
388 388
 														</td>
389
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text">
390
-															<?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?>
389
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text">
390
+															<?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?>
391 391
 														</td>
392
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text">
392
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text">
393 393
 															<?php echo $datetime->sold(); ?>
394 394
 														</td>
395
-												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold&nbsp;Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?>
396
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text">
397
-															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?>
395
+												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold&nbsp;Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?>
396
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text">
397
+															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?>
398 398
 														</td>
399 399
 													<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
400 400
 												</tr>
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 							</div>
413 413
 						</td>
414 414
 					</tr>
415
-				<?php endif;  //end template_settings->show_ticket_details check?>
415
+				<?php endif; //end template_settings->show_ticket_details check?>
416 416
 	<?php
417 417
 			$row++;
418 418
 		}
@@ -421,32 +421,32 @@  discard block
 block discarded – undo
421 421
 $ticket_row_html = ob_get_clean();
422 422
 // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector
423 423
 $hide_ticket_selector = $ticket_count == 1 && $max == 1 && $ticket->is_free() ? true : false;
424
-$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID );
424
+$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID);
425 425
 //EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ );
426 426
 //EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ );
427 427
 //EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ );
428 428
 //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ );
429 429
 remove_filter(
430 430
 	'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
431
-	array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
431
+	array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
432 432
 );
433 433
 remove_filter(
434 434
 	'FHEE__EE_Ticket_Selector__after_view_details_btn',
435
-	array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
435
+	array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
436 436
 );
437
-if ( ! $hide_ticket_selector ) {
437
+if ( ! $hide_ticket_selector) {
438 438
 ?>
439 439
 <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv">
440 440
 
441
-	<?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?>
441
+	<?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?>
442 442
 
443 443
 	<table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl">
444 444
 		<thead>
445 445
 			<tr>
446 446
 				<th scope="col" class="ee-ticket-selector-ticket-details-th">
447
-					<?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?>
447
+					<?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?>
448 448
 				</th>
449
-				<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
449
+				<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
450 450
 				<th scope="col" class="ee-ticket-selector-ticket-price-th cntr">
451 451
 					<?php
452 452
 						/**
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 						 * @param string 'Price' The translatable text to display in the table header for price
458 458
 						 * @param int $EVT_ID The Event ID
459 459
 						 */
460
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) );
460
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID));
461 461
 					?>
462 462
 				</th>
463 463
 				<?php } ?>
@@ -471,24 +471,24 @@  discard block
 block discarded – undo
471 471
 						* @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets
472 472
 						* @param int $EVT_ID The Event ID
473 473
 						*/
474
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) );
474
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID));
475 475
 					?>
476 476
 				</th>
477 477
 			</tr>
478 478
 		</thead>
479 479
 		<tbody>
480
-			<?php echo $ticket_row_html;?>
480
+			<?php echo $ticket_row_html; ?>
481 481
 		</tbody>
482 482
 	</table>
483 483
 
484 484
 	<input type="hidden" name="noheader" value="true" />
485
-	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" />
485
+	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" />
486 486
 	<input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" />
487 487
 	<input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" />
488 488
 	<input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" />
489 489
 
490 490
 <?php
491
-if ( $max_atndz > 0 && ! $hide_ticket_selector ) {
491
+if ($max_atndz > 0 && ! $hide_ticket_selector) {
492 492
 	echo apply_filters(
493 493
 		'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote',
494 494
 		''
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 }
497 497
 ?>
498 498
 
499
-	<?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?>
499
+	<?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?>
500 500
 
501 501
 </div>
502
-<?php } else if ( isset( $TKT_ID ) ) { ?>
502
+<?php } else if (isset($TKT_ID)) { ?>
503 503
 <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/>
504 504
 <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/>
505 505
 <input type="hidden" name="noheader" value="true"/>
@@ -508,27 +508,27 @@  discard block
 block discarded – undo
508 508
 <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/>
509 509
 <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/>
510 510
 <?php
511
-	if ( $ticket instanceof EE_Ticket ) {
512
-		do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event );
511
+	if ($ticket instanceof EE_Ticket) {
512
+		do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event);
513 513
 		$ticket_description = $ticket->description();
514 514
 ?>
515 515
 <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv">
516 516
 	<div class="no-tkt-slctr-ticket-content-dv">
517 517
 		<h5><?php echo $ticket->name(); ?></h5>
518
-		<?php if ( ! empty( $ticket_description ) ) { ?>
518
+		<?php if ( ! empty($ticket_description)) { ?>
519 519
 		<p><?php echo $ticket_description; ?></p>
520 520
 		<?php } ?>
521 521
 	</div>
522 522
 <?php
523 523
 		add_filter(
524 524
 			'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
525
-			array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
525
+			array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
526 526
 		);
527 527
 		add_filter(
528 528
 			'FHEE__EE_Ticket_Selector__after_view_details_btn',
529
-			array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
529
+			array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
530 530
 		);
531
-		do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event );
531
+		do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event);
532 532
 	}
533 533
 }
534 534
 ?>
Please login to merge, or discard this patch.
core/helpers/EEH_File.helper.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -595,8 +595,6 @@
 block discarded – undo
595 595
 	 * converts it into a "remote" filepath (the filepath the currently-in-use 
596 596
 	 * $wp_filesystem needs to use access the folder or file).
597 597
 	 * See http://wordpress.stackexchange.com/questions/124900/using-wp-filesystem-in-plugins
598
-	 * @param WP_Filesystem_Base $wp_filesystem we aren't initially sure which one
599
-	 * is in use, so you need to provide it
600 598
 	 * @param string $local_filepath the filepath to the folder/file locally
601 599
 	 * @return string the remote filepath (eg the filepath the filesystem method, eg 
602 600
 	 * ftp or ssh, will use to access the folder
Please login to merge, or discard this patch.
Spacing   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -27,30 +27,30 @@  discard block
 block discarded – undo
27 27
 	 * @throws EE_Error
28 28
 	 * @return WP_Filesystem_Base
29 29
 	 */
30
-	private static function _get_wp_filesystem( $filepath = null) {
31
-		if( apply_filters( 
30
+	private static function _get_wp_filesystem($filepath = null) {
31
+		if (apply_filters( 
32 32
 				'FHEE__EEH_File___get_wp_filesystem__allow_using_filesystem_direct', 
33
-				$filepath && EEH_File::is_in_uploads_folder( $filepath ), 
34
-				$filepath ) ) {
35
-			if( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct ) {
36
-				require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
33
+				$filepath && EEH_File::is_in_uploads_folder($filepath), 
34
+				$filepath )) {
35
+			if ( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct) {
36
+				require_once(ABSPATH.'wp-admin/includes/class-wp-filesystem-base.php');
37 37
 				$method = 'direct';
38
-				$wp_filesystem_direct_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method );
38
+				$wp_filesystem_direct_file = apply_filters('filesystem_method_file', ABSPATH.'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method);
39 39
 				//check constants defined, just like in wp-admin/includes/file.php's WP_Filesystem()
40
-				if ( ! defined('FS_CHMOD_DIR') ) {
41
-					define('FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) );
40
+				if ( ! defined('FS_CHMOD_DIR')) {
41
+					define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0777 | 0755));
42 42
 				}
43
-				if ( ! defined('FS_CHMOD_FILE') ) {
44
-					define('FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
43
+				if ( ! defined('FS_CHMOD_FILE')) {
44
+					define('FS_CHMOD_FILE', (fileperms(ABSPATH.'index.php') & 0777 | 0644));
45 45
 				}
46
-				require_once( $wp_filesystem_direct_file );
47
-				EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct( array() );
46
+				require_once($wp_filesystem_direct_file);
47
+				EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct(array());
48 48
 			}
49 49
 			return EEH_File::$_wp_filesystem_direct;
50 50
 		}
51 51
 		global $wp_filesystem;
52 52
 		// no filesystem setup ???
53
-		if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
53
+		if ( ! $wp_filesystem instanceof WP_Filesystem_Base) {
54 54
 			// if some eager beaver's just trying to get in there too early...
55 55
 			// let them do it, because we are one of those eager beavers! :P
56 56
 			/**
@@ -63,34 +63,34 @@  discard block
 block discarded – undo
63 63
 			 * and there may be troubles if the WP files are owned by a different user
64 64
 			 * than the server user. But both of these issues should exist in 4.4 and earlier too
65 65
 			 */
66
-			if ( FALSE && ! did_action( 'wp_loaded' )) {
66
+			if (FALSE && ! did_action('wp_loaded')) {
67 67
 				$msg = __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso');
68
-				if ( WP_DEBUG ) {
69
-					$msg .= '<br />' .  __('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso');
68
+				if (WP_DEBUG) {
69
+					$msg .= '<br />'.__('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso');
70 70
 				}
71
-				throw new EE_Error( $msg );
71
+				throw new EE_Error($msg);
72 72
 			} else {
73 73
 				// should be loaded if we are past the wp_loaded hook...
74
-				if ( ! function_exists( 'WP_Filesystem' )) {
75
-					require_once( ABSPATH . 'wp-admin/includes/file.php' );
76
-					require_once( ABSPATH . 'wp-admin/includes/template.php' );
74
+				if ( ! function_exists('WP_Filesystem')) {
75
+					require_once(ABSPATH.'wp-admin/includes/file.php');
76
+					require_once(ABSPATH.'wp-admin/includes/template.php');
77 77
 				}
78 78
 				// turn on output buffering so that we can capture the credentials form
79 79
 				ob_start();
80
-				$credentials = request_filesystem_credentials( '' );
80
+				$credentials = request_filesystem_credentials('');
81 81
 				// store credentials form for the time being
82 82
 				EEH_File::$_credentials_form = ob_get_clean();
83 83
 				// basically check for direct or previously configured access
84
-				if ( ! WP_Filesystem( $credentials ) ) {
84
+				if ( ! WP_Filesystem($credentials)) {
85 85
 					// if credentials do NOT exist
86
-					if ( $credentials === FALSE ) {
87
-						add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 );
88
-						throw new EE_Error( __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'));
89
-					} elseif( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {						
90
-						add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 );
86
+					if ($credentials === FALSE) {
87
+						add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999);
88
+						throw new EE_Error(__('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'));
89
+					} elseif (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {						
90
+						add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999);
91 91
 						throw new EE_Error( 
92 92
 								sprintf( 
93
-										__( 'WP Filesystem Error: $1%s', 'event_espresso' ), 
93
+										__('WP Filesystem Error: $1%s', 'event_espresso'), 
94 94
 										$wp_filesystem->errors->get_error_message() ) );
95 95
 					}
96 96
 				}
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	 * display_request_filesystem_credentials_form
104 104
 	 */
105 105
 	public static function display_request_filesystem_credentials_form() {
106
-		if ( ! empty( EEH_File::$_credentials_form )) {
107
-			echo '<div class="updated espresso-notices-attention"><p>' . EEH_File::$_credentials_form . '</p></div>';
106
+		if ( ! empty(EEH_File::$_credentials_form)) {
107
+			echo '<div class="updated espresso-notices-attention"><p>'.EEH_File::$_credentials_form.'</p></div>';
108 108
 		}
109 109
 	}
110 110
 
@@ -122,29 +122,29 @@  discard block
 block discarded – undo
122 122
 	 * @throws EE_Error
123 123
 	 * @return bool
124 124
 	 */
125
-	public static function verify_filepath_and_permissions( $full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '' ) {
125
+	public static function verify_filepath_and_permissions($full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '') {
126 126
 		// load WP_Filesystem and set file permissions
127
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
128
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
129
-		if ( ! $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) )) {
130
-			$file_name = ! empty( $type_of_file ) ? $file_name . ' ' . $type_of_file : $file_name;
131
-			$file_name .= ! empty( $file_ext ) ? ' file' : ' folder';
127
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
128
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
129
+		if ( ! $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
130
+			$file_name = ! empty($type_of_file) ? $file_name.' '.$type_of_file : $file_name;
131
+			$file_name .= ! empty($file_ext) ? ' file' : ' folder';
132 132
 			$msg = sprintf(
133
-				__( 'The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso' ),
133
+				__('The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso'),
134 134
 				$file_name,
135 135
 				'<br />'
136 136
 			);
137
-			if ( EEH_File::exists( $full_file_path )) {
138
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, $type_of_file );
137
+			if (EEH_File::exists($full_file_path)) {
138
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, $type_of_file);
139 139
 			} else {
140 140
 				// no file permissions means the file was not found
141 141
 				$msg .= sprintf(
142
-					__( 'Please ensure the following path is correct: "%s".', 'event_espresso' ),
142
+					__('Please ensure the following path is correct: "%s".', 'event_espresso'),
143 143
 					$full_file_path
144 144
 				);
145 145
 			}
146
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
147
-				throw new EE_Error( $msg . '||' . $msg );
146
+			if (defined('WP_DEBUG') && WP_DEBUG) {
147
+				throw new EE_Error($msg.'||'.$msg);
148 148
 			}
149 149
 			return FALSE;
150 150
 		}
@@ -161,24 +161,24 @@  discard block
 block discarded – undo
161 161
 	 * @param string $type_of_file - general type of file (ie: "module"), this is only used to improve error messages
162 162
 	 * @return string
163 163
 	 */
164
-	private static function _permissions_error_for_unreadable_filepath( $full_file_path = '', $type_of_file = '' ){
164
+	private static function _permissions_error_for_unreadable_filepath($full_file_path = '', $type_of_file = '') {
165 165
 		// load WP_Filesystem and set file permissions
166
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
166
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
167 167
 		// check file permissions
168
-		$perms = $wp_filesystem->getchmod( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) );
169
-		if ( $perms ) {
168
+		$perms = $wp_filesystem->getchmod(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path));
169
+		if ($perms) {
170 170
 			// file permissions exist, but way be set incorrectly
171
-			$type_of_file = ! empty( $type_of_file ) ? $type_of_file . ' ' : '';
172
-			$type_of_file .= ! empty( $type_of_file ) ? 'file' : 'folder';
171
+			$type_of_file = ! empty($type_of_file) ? $type_of_file.' ' : '';
172
+			$type_of_file .= ! empty($type_of_file) ? 'file' : 'folder';
173 173
 			return sprintf(
174
-				__( 'File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso' ),
174
+				__('File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso'),
175 175
 				$type_of_file,
176 176
 				$perms
177 177
 			);
178 178
 		} else {
179 179
 			// file exists but file permissions could not be read ?!?!
180 180
 			return sprintf(
181
-				__( 'Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso' ),
181
+				__('Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso'),
182 182
 				$full_file_path
183 183
 			);
184 184
 		}
@@ -196,35 +196,35 @@  discard block
 block discarded – undo
196 196
 	 * can't write to it
197 197
 	 * @return bool false if folder isn't writable; true if it exists and is writeable,
198 198
 	 */
199
-	public static function ensure_folder_exists_and_is_writable( $folder = '' ){
200
-		if ( empty( $folder )) {
199
+	public static function ensure_folder_exists_and_is_writable($folder = '') {
200
+		if (empty($folder)) {
201 201
 			return false;
202 202
 		}
203 203
 		// remove ending DS
204
-		$folder = EEH_File::standardise_directory_separators( rtrim( $folder, '/\\' ));
205
-		$parent_folder = EEH_File::get_parent_folder( $folder );
204
+		$folder = EEH_File::standardise_directory_separators(rtrim($folder, '/\\'));
205
+		$parent_folder = EEH_File::get_parent_folder($folder);
206 206
 		// add DS to folder
207
-		$folder = EEH_File::end_with_directory_separator( $folder );
208
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $folder );
209
-		if ( ! $wp_filesystem->is_dir( EEH_File::convert_local_filepath_to_remote_filepath( $folder ) ) ) {
207
+		$folder = EEH_File::end_with_directory_separator($folder);
208
+		$wp_filesystem = EEH_File::_get_wp_filesystem($folder);
209
+		if ( ! $wp_filesystem->is_dir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) {
210 210
 			//ok so it doesn't exist. Does its parent? Can we write to it?
211
-			if(	! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) {
211
+			if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) {
212 212
 				return false;
213 213
 			}
214
-			if ( ! EEH_File::verify_is_writable( $parent_folder, 'folder' )) {
214
+			if ( ! EEH_File::verify_is_writable($parent_folder, 'folder')) {
215 215
 				return false;
216 216
 			} else {
217
-				if ( ! $wp_filesystem->mkdir( EEH_File::convert_local_filepath_to_remote_filepath(  $folder ) ) ) {
218
-					if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
219
-						$msg = sprintf( __( '"%s" could not be created.', 'event_espresso' ), $folder );
220
-						$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $folder );
221
-						throw new EE_Error( $msg );
217
+				if ( ! $wp_filesystem->mkdir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) {
218
+					if (defined('WP_DEBUG') && WP_DEBUG) {
219
+						$msg = sprintf(__('"%s" could not be created.', 'event_espresso'), $folder);
220
+						$msg .= EEH_File::_permissions_error_for_unreadable_filepath($folder);
221
+						throw new EE_Error($msg);
222 222
 					}
223 223
 					return false;
224 224
 				}
225
-				EEH_File::add_htaccess_deny_from_all( $folder );
225
+				EEH_File::add_htaccess_deny_from_all($folder);
226 226
 			}
227
-		} elseif ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
227
+		} elseif ( ! EEH_File::verify_is_writable($folder, 'folder')) {
228 228
 			return false;
229 229
 		}
230 230
 		return true;
@@ -239,15 +239,15 @@  discard block
 block discarded – undo
239 239
 	 * @throws EE_Error
240 240
 	 * @return bool
241 241
 	 */
242
-	public static function verify_is_writable( $full_path = '', $file_or_folder = 'folder' ){
242
+	public static function verify_is_writable($full_path = '', $file_or_folder = 'folder') {
243 243
 		// load WP_Filesystem and set file permissions
244
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_path );
245
-		$full_path = EEH_File::standardise_directory_separators( $full_path );
246
-		if ( ! $wp_filesystem->is_writable( EEH_File::convert_local_filepath_to_remote_filepath( $full_path ) ) ) {
247
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
248
-				$msg = sprintf( __( 'The "%1$s" %2$s is not writable.', 'event_espresso' ), $full_path, $file_or_folder );
249
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_path );
250
-				throw new EE_Error( $msg );
244
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_path);
245
+		$full_path = EEH_File::standardise_directory_separators($full_path);
246
+		if ( ! $wp_filesystem->is_writable(EEH_File::convert_local_filepath_to_remote_filepath($full_path))) {
247
+			if (defined('WP_DEBUG') && WP_DEBUG) {
248
+				$msg = sprintf(__('The "%1$s" %2$s is not writable.', 'event_espresso'), $full_path, $file_or_folder);
249
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_path);
250
+				throw new EE_Error($msg);
251 251
 			}
252 252
 			return FALSE;
253 253
 		}
@@ -264,25 +264,25 @@  discard block
 block discarded – undo
264 264
 	 * @throws EE_Error
265 265
 	 * @return bool
266 266
 	 */
267
-	public static function ensure_file_exists_and_is_writable( $full_file_path = '' ) {
267
+	public static function ensure_file_exists_and_is_writable($full_file_path = '') {
268 268
 		// load WP_Filesystem and set file permissions
269
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
270
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
271
-		$parent_folder = EEH_File::get_parent_folder( $full_file_path );
272
-		if ( ! EEH_File::exists( $full_file_path )) {
273
-			if( ! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) {
269
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
270
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
271
+		$parent_folder = EEH_File::get_parent_folder($full_file_path);
272
+		if ( ! EEH_File::exists($full_file_path)) {
273
+			if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) {
274 274
 				return false;
275 275
 			}
276
-			if ( ! $wp_filesystem->touch( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ) {
277
-				if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
278
-					$msg = sprintf( __( 'The "%s" file could not be created.', 'event_espresso' ), $full_file_path );
279
-					$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path );
280
-					throw new EE_Error( $msg );
276
+			if ( ! $wp_filesystem->touch(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
277
+				if (defined('WP_DEBUG') && WP_DEBUG) {
278
+					$msg = sprintf(__('The "%s" file could not be created.', 'event_espresso'), $full_file_path);
279
+					$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path);
280
+					throw new EE_Error($msg);
281 281
 				}
282 282
 				return false;
283 283
 			}
284 284
 		}
285
-		if ( ! EEH_File::verify_is_writable( $full_file_path, 'file' )) {
285
+		if ( ! EEH_File::verify_is_writable($full_file_path, 'file')) {
286 286
 			return false;
287 287
 		}
288 288
 		return true;
@@ -294,15 +294,15 @@  discard block
 block discarded – undo
294 294
 	 * @param string $file_or_folder_path
295 295
 	 * @return string parent folder, ENDING with a directory separator
296 296
 	 */
297
-	public static function get_parent_folder( $file_or_folder_path ) {
297
+	public static function get_parent_folder($file_or_folder_path) {
298 298
 		//find the last DS, ignoring a DS on the very end
299 299
 		//eg if given "/var/something/somewhere/", we want to get "somewhere"'s
300 300
 		//parent folder, "/var/something/"
301
-		$ds = strrpos( $file_or_folder_path, DS, -2 );
302
-		return substr( $file_or_folder_path, 0, $ds + 1 );
301
+		$ds = strrpos($file_or_folder_path, DS, -2);
302
+		return substr($file_or_folder_path, 0, $ds + 1);
303 303
 	}
304 304
 	
305
-	public static function ensure_folder_exists_recursively( $folder ) {
305
+	public static function ensure_folder_exists_recursively($folder) {
306 306
 		
307 307
 	}
308 308
 
@@ -313,12 +313,12 @@  discard block
 block discarded – undo
313 313
 	 * @param string $full_file_path
314 314
 	 * @return string
315 315
 	 */
316
-	public static function get_file_contents( $full_file_path = '' ){
317
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
318
-		if ( EEH_File::verify_filepath_and_permissions( $full_file_path, EEH_File::get_filename_from_filepath( $full_file_path ) , EEH_File::get_file_extension( $full_file_path ))) {
316
+	public static function get_file_contents($full_file_path = '') {
317
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
318
+		if (EEH_File::verify_filepath_and_permissions($full_file_path, EEH_File::get_filename_from_filepath($full_file_path), EEH_File::get_file_extension($full_file_path))) {
319 319
 			// load WP_Filesystem and set file permissions
320
-			$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
321
-			return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) );
320
+			$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
321
+			return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path));
322 322
 		}
323 323
 		return '';
324 324
 	}
@@ -333,26 +333,26 @@  discard block
 block discarded – undo
333 333
 	 * @throws EE_Error
334 334
 	 * @return bool
335 335
 	 */
336
-	public static function write_to_file( $full_file_path = '', $file_contents = '', $file_type = '' ){
337
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
338
-		$file_type = ! empty( $file_type ) ? rtrim( $file_type, ' ' ) . ' ' : '';
339
-		$folder = EEH_File::remove_filename_from_filepath( $full_file_path );
340
-		if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
341
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
342
-				$msg = sprintf( __( 'The %1$sfile located at "%2$s" is not writable.', 'event_espresso' ), $file_type, $full_file_path );
343
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path );
344
-				throw new EE_Error( $msg );
336
+	public static function write_to_file($full_file_path = '', $file_contents = '', $file_type = '') {
337
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
338
+		$file_type = ! empty($file_type) ? rtrim($file_type, ' ').' ' : '';
339
+		$folder = EEH_File::remove_filename_from_filepath($full_file_path);
340
+		if ( ! EEH_File::verify_is_writable($folder, 'folder')) {
341
+			if (defined('WP_DEBUG') && WP_DEBUG) {
342
+				$msg = sprintf(__('The %1$sfile located at "%2$s" is not writable.', 'event_espresso'), $file_type, $full_file_path);
343
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path);
344
+				throw new EE_Error($msg);
345 345
 			}
346 346
 			return FALSE;
347 347
 		}
348 348
 		// load WP_Filesystem and set file permissions
349
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
349
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
350 350
 		// write the file
351
-		if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ), $file_contents )) {
352
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
353
-				$msg = sprintf( __( 'The %1$sfile located at "%2$s" could not be written to.', 'event_espresso' ), $file_type, $full_file_path );
354
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, 'f' );
355
-				throw new EE_Error( $msg );
351
+		if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path), $file_contents)) {
352
+			if (defined('WP_DEBUG') && WP_DEBUG) {
353
+				$msg = sprintf(__('The %1$sfile located at "%2$s" could not be written to.', 'event_espresso'), $file_type, $full_file_path);
354
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, 'f');
355
+				throw new EE_Error($msg);
356 356
 			}
357 357
 			return FALSE;
358 358
 		}
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
 	 * @param string $full_file_path
369 369
 	 * @return bool
370 370
 	 */
371
-	public static function exists( $full_file_path = '' ) {
372
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
373
-		return $wp_filesystem->exists( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ? TRUE : FALSE;
371
+	public static function exists($full_file_path = '') {
372
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
373
+		return $wp_filesystem->exists(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)) ? TRUE : FALSE;
374 374
 	}
375 375
 
376 376
 
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
 	 * @param string $full_file_path
383 383
 	 * @return bool
384 384
 	 */
385
-	public static function is_readable( $full_file_path = '' ) {
386
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
387
-		if( $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath(  $full_file_path ) ) ) {
385
+	public static function is_readable($full_file_path = '') {
386
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
387
+		if ($wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
388 388
 			return true;
389 389
 		} else {
390 390
 			return false;
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
 	 * @param string $full_file_path
401 401
 	 * @return string
402 402
 	 */
403
-	public static function remove_filename_from_filepath( $full_file_path = '' ) {
404
-		return pathinfo( $full_file_path, PATHINFO_DIRNAME );
403
+	public static function remove_filename_from_filepath($full_file_path = '') {
404
+		return pathinfo($full_file_path, PATHINFO_DIRNAME);
405 405
 	}
406 406
 
407 407
 
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
 	 * @param string $full_file_path
412 412
 	 * @return string
413 413
 	 */
414
-	public static function get_filename_from_filepath( $full_file_path = '' ) {
415
-		return pathinfo( $full_file_path, PATHINFO_BASENAME );
414
+	public static function get_filename_from_filepath($full_file_path = '') {
415
+		return pathinfo($full_file_path, PATHINFO_BASENAME);
416 416
 	}
417 417
 
418 418
 
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 	 * @param string $full_file_path
423 423
 	 * @return string
424 424
 	 */
425
-	public static function get_file_extension( $full_file_path = '' ) {
426
-		return pathinfo( $full_file_path, PATHINFO_EXTENSION );
425
+	public static function get_file_extension($full_file_path = '') {
426
+		return pathinfo($full_file_path, PATHINFO_EXTENSION);
427 427
 	}
428 428
 
429 429
 
@@ -434,15 +434,15 @@  discard block
 block discarded – undo
434 434
 	 * @param string $folder
435 435
 	 * @return bool
436 436
 	 */
437
-	public static function add_htaccess_deny_from_all( $folder = '' ) {
438
-		$folder = EEH_File::standardise_and_end_with_directory_separator( $folder );
439
-		if ( ! EEH_File::exists( $folder . '.htaccess' ) ) {
440
-			if ( ! EEH_File::write_to_file( $folder . '.htaccess', 'deny from all', '.htaccess' )) {
437
+	public static function add_htaccess_deny_from_all($folder = '') {
438
+		$folder = EEH_File::standardise_and_end_with_directory_separator($folder);
439
+		if ( ! EEH_File::exists($folder.'.htaccess')) {
440
+			if ( ! EEH_File::write_to_file($folder.'.htaccess', 'deny from all', '.htaccess')) {
441 441
 				return FALSE;
442 442
 			}
443 443
 		}
444
-		if ( ! EEH_File::exists( $folder . 'index.html' ) ) {
445
-			if ( ! EEH_File::write_to_file( $folder . 'index.html', 'cheating huh?', '.html' )) {
444
+		if ( ! EEH_File::exists($folder.'index.html')) {
445
+			if ( ! EEH_File::write_to_file($folder.'index.html', 'cheating huh?', '.html')) {
446 446
 				return FALSE;
447 447
 			}
448 448
 		}
@@ -457,11 +457,11 @@  discard block
 block discarded – undo
457 457
 	 * @param string $file_path
458 458
 	 * @return string
459 459
 	 */
460
-	public static function get_classname_from_filepath_with_standard_filename( $file_path ){
460
+	public static function get_classname_from_filepath_with_standard_filename($file_path) {
461 461
 		//extract file from path
462
-		$filename = basename( $file_path );
462
+		$filename = basename($file_path);
463 463
 		//now remove the first period and everything after
464
-		$pos_of_first_period = strpos( $filename,'.' );
464
+		$pos_of_first_period = strpos($filename, '.');
465 465
 		return substr($filename, 0, $pos_of_first_period);
466 466
 	}
467 467
 
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
 	 * @param string $file_path
474 474
 	 * @return string
475 475
 	 */
476
-	public static function standardise_directory_separators( $file_path ){
477
-		return str_replace( array( '\\', '/' ), DS, $file_path );
476
+	public static function standardise_directory_separators($file_path) {
477
+		return str_replace(array('\\', '/'), DS, $file_path);
478 478
 	}
479 479
 
480 480
 
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
 	 * @param string $file_path
486 486
 	 * @return string
487 487
 	 */
488
-	public static function end_with_directory_separator( $file_path ){
489
-		return rtrim( $file_path, '/\\' ) . DS;
488
+	public static function end_with_directory_separator($file_path) {
489
+		return rtrim($file_path, '/\\').DS;
490 490
 	}
491 491
 
492 492
 
@@ -496,8 +496,8 @@  discard block
 block discarded – undo
496 496
 	 * @param $file_path
497 497
 	 * @return string
498 498
 	 */
499
-	public static function standardise_and_end_with_directory_separator( $file_path ){
500
-		return self::end_with_directory_separator( self::standardise_directory_separators( $file_path ));
499
+	public static function standardise_and_end_with_directory_separator($file_path) {
500
+		return self::end_with_directory_separator(self::standardise_directory_separators($file_path));
501 501
 	}
502 502
 
503 503
 
@@ -514,21 +514,21 @@  discard block
 block discarded – undo
514 514
 	 *		if $index_numerically == FALSE (Default) keys are what the class names SHOULD be;
515 515
 	 *		 and values are their filepaths
516 516
 	 */
517
-	public static function get_contents_of_folders( $folder_paths = array(), $index_numerically = FALSE ){
517
+	public static function get_contents_of_folders($folder_paths = array(), $index_numerically = FALSE) {
518 518
 		$class_to_folder_path = array();
519
-		foreach( $folder_paths as $folder_path ){
520
-			$folder_path = self::standardise_and_end_with_directory_separator( $folder_path );
519
+		foreach ($folder_paths as $folder_path) {
520
+			$folder_path = self::standardise_and_end_with_directory_separator($folder_path);
521 521
 			// load WP_Filesystem and set file permissions
522
-			$files_in_folder = glob( $folder_path . '*' );
522
+			$files_in_folder = glob($folder_path.'*');
523 523
 			$class_to_folder_path = array();
524
-			if ( $files_in_folder ) {
525
-				foreach( $files_in_folder as $file_path ){
524
+			if ($files_in_folder) {
525
+				foreach ($files_in_folder as $file_path) {
526 526
 					//only add files, not folders
527
-					if ( ! is_dir( $file_path )) {
528
-						if ( $index_numerically ) {
527
+					if ( ! is_dir($file_path)) {
528
+						if ($index_numerically) {
529 529
 							$class_to_folder_path[] = $file_path;
530 530
 						} else {
531
-							$classname = self::get_classname_from_filepath_with_standard_filename( $file_path );
531
+							$classname = self::get_classname_from_filepath_with_standard_filename($file_path);
532 532
 							$class_to_folder_path[$classname] = $file_path;
533 533
 						}
534 534
 					}
@@ -548,39 +548,39 @@  discard block
 block discarded – undo
548 548
 	 * @return boolean success
549 549
 	 * @throws EE_Error
550 550
 	 */
551
-	public static function copy( $source_file, $destination_file, $overwrite = FALSE ){
552
-		$full_source_path = EEH_File::standardise_directory_separators( $source_file );
553
-		if( ! EEH_File::exists( $full_source_path ) ){
554
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
555
-				$msg = sprintf( __( 'The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso' ), $full_source_path );
556
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path );
557
-				throw new EE_Error( $msg );
551
+	public static function copy($source_file, $destination_file, $overwrite = FALSE) {
552
+		$full_source_path = EEH_File::standardise_directory_separators($source_file);
553
+		if ( ! EEH_File::exists($full_source_path)) {
554
+			if (defined('WP_DEBUG') && WP_DEBUG) {
555
+				$msg = sprintf(__('The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso'), $full_source_path);
556
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path);
557
+				throw new EE_Error($msg);
558 558
 			}
559 559
 			return FALSE;
560 560
 		}
561 561
 
562
-		$full_dest_path = EEH_File::standardise_directory_separators( $destination_file );
563
-		$folder = EEH_File::remove_filename_from_filepath( $full_dest_path );
564
-		if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
565
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
566
-				$msg = sprintf( __( 'The file located at "%2$s" is not writable.', 'event_espresso' ), $full_dest_path );
567
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_dest_path );
568
-				throw new EE_Error( $msg );
562
+		$full_dest_path = EEH_File::standardise_directory_separators($destination_file);
563
+		$folder = EEH_File::remove_filename_from_filepath($full_dest_path);
564
+		if ( ! EEH_File::verify_is_writable($folder, 'folder')) {
565
+			if (defined('WP_DEBUG') && WP_DEBUG) {
566
+				$msg = sprintf(__('The file located at "%2$s" is not writable.', 'event_espresso'), $full_dest_path);
567
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_dest_path);
568
+				throw new EE_Error($msg);
569 569
 			}
570 570
 			return FALSE;
571 571
 		}
572 572
 
573 573
 		// load WP_Filesystem and set file permissions
574
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $destination_file );
574
+		$wp_filesystem = EEH_File::_get_wp_filesystem($destination_file);
575 575
 		// write the file
576 576
 		if ( ! $wp_filesystem->copy( 
577
-						EEH_File::convert_local_filepath_to_remote_filepath( $full_source_path ), 
578
-						EEH_File::convert_local_filepath_to_remote_filepath( $full_dest_path ), 
577
+						EEH_File::convert_local_filepath_to_remote_filepath($full_source_path), 
578
+						EEH_File::convert_local_filepath_to_remote_filepath($full_dest_path), 
579 579
 						$overwrite )) {
580
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
581
-				$msg = sprintf( __( 'Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso' ), $full_source_path );
582
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path, 'f' );
583
-				throw new EE_Error( $msg );
580
+			if (defined('WP_DEBUG') && WP_DEBUG) {
581
+				$msg = sprintf(__('Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso'), $full_source_path);
582
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path, 'f');
583
+				throw new EE_Error($msg);
584 584
 			}
585 585
 			return FALSE;
586 586
 		}
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 	 * @param string $filepath
593 593
 	 * @return boolean
594 594
 	 */
595
-	public static function is_in_uploads_folder( $filepath ) {
595
+	public static function is_in_uploads_folder($filepath) {
596 596
 		$uploads = wp_upload_dir();
597
-		return strpos( $filepath, $uploads[ 'basedir' ] ) === 0 ? true : false;
597
+		return strpos($filepath, $uploads['basedir']) === 0 ? true : false;
598 598
 	}
599 599
 	
600 600
 	/**
@@ -608,9 +608,9 @@  discard block
 block discarded – undo
608 608
 	 * @return string the remote filepath (eg the filepath the filesystem method, eg 
609 609
 	 * ftp or ssh, will use to access the folder
610 610
 	 */
611
-	public static function convert_local_filepath_to_remote_filepath( $local_filepath ) {
612
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $local_filepath );
613
-		return str_replace( WP_CONTENT_DIR . DS, $wp_filesystem->wp_content_dir(), $local_filepath );
611
+	public static function convert_local_filepath_to_remote_filepath($local_filepath) {
612
+		$wp_filesystem = EEH_File::_get_wp_filesystem($local_filepath);
613
+		return str_replace(WP_CONTENT_DIR.DS, $wp_filesystem->wp_content_dir(), $local_filepath);
614 614
 	}
615 615
 }
616 616
 // End of file EEH_File.helper.php
Please login to merge, or discard this patch.
admin/extend/general_settings/Extend_General_Settings_Admin_Page.core.php 1 patch
Spacing   +23 added lines, -23 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
 /**
@@ -32,30 +32,30 @@  discard block
 block discarded – undo
32 32
 
33 33
 
34 34
 
35
-	public function __construct( $routing = TRUE ) {
36
-		parent::__construct( $routing );
37
-		define( 'GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/' );
35
+	public function __construct($routing = TRUE) {
36
+		parent::__construct($routing);
37
+		define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'general_settings/templates/');
38 38
 	}
39 39
 
40 40
 
41 41
 
42 42
 	protected function _extend_page_config() {
43 43
 
44
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings';
44
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'general_settings';
45 45
 
46 46
 		//filters and action hooks here
47
-		add_action('AHEE__admin_option_settings__template__before', array( $this, 'use_venue_and_staff_manager_settings'), 10 );
48
-		add_action( 'AHEE__admin_option_settings__template__before', array( $this, 'debug_logging_options' ), 9 );
49
-		add_filter( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array( $this, 'update_debug_logging_options' ), 10, 1 );
47
+		add_action('AHEE__admin_option_settings__template__before', array($this, 'use_venue_and_staff_manager_settings'), 10);
48
+		add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9);
49
+		add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array($this, 'update_debug_logging_options'), 10, 1);
50 50
 
51 51
 	}
52 52
 
53 53
 
54 54
 
55
-	public function use_venue_and_staff_manager_settings( $template_args ) {
56
-		$_args['use_personnel_manager_select'] = EEH_Form_Fields::select_input('use_personnel_manager', $template_args['values'], $template_args['use_personnel_manager'] );
57
-		$template = GEN_SET_CAF_TEMPLATE_PATH . 'use_venue_and_staff_manager_settings.template.php';
58
-		EEH_Template::display_template( $template, $_args );
55
+	public function use_venue_and_staff_manager_settings($template_args) {
56
+		$_args['use_personnel_manager_select'] = EEH_Form_Fields::select_input('use_personnel_manager', $template_args['values'], $template_args['use_personnel_manager']);
57
+		$template = GEN_SET_CAF_TEMPLATE_PATH.'use_venue_and_staff_manager_settings.template.php';
58
+		EEH_Template::display_template($template, $_args);
59 59
 	}
60 60
 
61 61
 
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
 	 * @param array $template_args
69 69
 	 * @return void
70 70
 	 */
71
-	public function debug_logging_options( $template_args = array() ) {
71
+	public function debug_logging_options($template_args = array()) {
72 72
 		$template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging;
73
-		$template_args['use_remote_logging'] = isset( EE_Registry::instance()->CFG->admin->use_remote_logging ) ? absint( EE_Registry::instance()->CFG->admin->use_remote_logging ) : FALSE;
74
-		$template_args['remote_logging_url'] = isset( EE_Registry::instance()->CFG->admin->remote_logging_url ) && ! empty( EE_Registry::instance()->CFG->admin->remote_logging_url ) ? stripslashes( EE_Registry::instance()->CFG->admin->remote_logging_url ) : '';
75
-		$template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php';
76
-		EEH_Template::display_template( $template, $template_args );
73
+		$template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : FALSE;
74
+		$template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : '';
75
+		$template = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php';
76
+		EEH_Template::display_template($template, $template_args);
77 77
 	}
78 78
 
79 79
 
@@ -84,17 +84,17 @@  discard block
 block discarded – undo
84 84
 	 * @param array $admin_options
85 85
 	 * @return array
86 86
 	 */
87
-	public function update_debug_logging_options( $admin_options = array() ) {
88
-		$use_full_logging = isset( $this->_req_data['use_full_logging'] ) ? (bool)absint( $this->_req_data['use_full_logging'] ) : $admin_options->use_full_logging;
87
+	public function update_debug_logging_options($admin_options = array()) {
88
+		$use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging;
89 89
 		$admin_options->use_full_logging = $use_full_logging;
90 90
 		
91
-		if ( $use_full_logging === FALSE ) {
92
-			EE_Error::get_notices( FALSE );
91
+		if ($use_full_logging === FALSE) {
92
+			EE_Error::get_notices(FALSE);
93 93
 			EE_Error::reset_notices();
94 94
 		}
95 95
 
96
-		$admin_options->use_remote_logging = isset( $this->_req_data['use_remote_logging'] ) ? absint( $this->_req_data['use_remote_logging'] ) : $admin_options->use_remote_logging;
97
-		$admin_options->remote_logging_url = isset( $this->_req_data['remote_logging_url'] ) ? esc_url_raw( $this->_req_data['remote_logging_url'] ) : $admin_options->remote_logging_url;
96
+		$admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging;
97
+		$admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url;
98 98
 		return $admin_options;
99 99
 	}
100 100
 
Please login to merge, or discard this patch.
core/EE_Error.core.php 1 patch
Spacing   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE );
3
-if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) {
4
-	set_error_handler( array( 'EE_Error', 'error_handler' ));
5
-	register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' ));
3
+if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) {
4
+	set_error_handler(array('EE_Error', 'error_handler'));
5
+	register_shutdown_function(array('EE_Error', 'fatal_error_handler'));
6 6
 }
7 7
 /**
8 8
  *
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	* 	@access	private
65 65
     *	@var boolean
66 66
 	*/
67
-	private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE );
67
+	private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE);
68 68
 
69 69
 
70 70
 
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 	*	@access public
76 76
 	*	@echo string
77 77
 	*/
78
-	function __construct( $message, $code = 0, Exception $previous = NULL ) {
79
-		if ( version_compare( phpversion(), '5.3.0', '<' )) {
80
-			parent::__construct( $message, $code );
78
+	function __construct($message, $code = 0, Exception $previous = NULL) {
79
+		if (version_compare(phpversion(), '5.3.0', '<')) {
80
+			parent::__construct($message, $code);
81 81
 		} else {
82
-			parent::__construct( $message, $code, $previous );
82
+			parent::__construct($message, $code, $previous);
83 83
 		}
84 84
 	}
85 85
 
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 	 * @param $line
95 95
 	 * @return void
96 96
 	 */
97
-	public static function error_handler( $code, $message, $file, $line ) {
98
-		$type = EE_Error::error_type( $code );
97
+	public static function error_handler($code, $message, $file, $line) {
98
+		$type = EE_Error::error_type($code);
99 99
 		$site = site_url();
100
-		switch ( $site ) {
100
+		switch ($site) {
101 101
 			case 'http://ee4.eventespresso.com/' :
102 102
 			case 'http://ee4decaf.eventespresso.com/' :
103 103
 			case 'http://ee4hf.eventespresso.com/' :
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 				$to = '[email protected]';
111 111
 				break;
112 112
 			default :
113
-				$to = get_option( 'admin_email' );
113
+				$to = get_option('admin_email');
114 114
 		}
115
-		$subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url();
116
-		$msg = EE_Error::_format_error( $type, $message, $file, $line );
117
-		if ( function_exists( 'wp_mail' )) {
118
-			add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));
119
-			wp_mail( $to, $subject, $msg );
115
+		$subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url();
116
+		$msg = EE_Error::_format_error($type, $message, $file, $line);
117
+		if (function_exists('wp_mail')) {
118
+			add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type'));
119
+			wp_mail($to, $subject, $msg);
120 120
 		}
121 121
 		echo '<div id="message" class="espresso-notices error"><p>';
122
-		echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line;
122
+		echo $type.': '.$message.'<br />'.$file.' line '.$line;
123 123
 		echo '<br /></p></div>';
124 124
 	}
125 125
 
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param $code
133 133
 	 * @return string
134 134
 	 */
135
-	public static function error_type( $code ) {
136
-		switch( $code ) {
135
+	public static function error_type($code) {
136
+		switch ($code) {
137 137
 			case E_ERROR: // 1 //
138 138
 			return 'E_ERROR';
139 139
 			case E_WARNING: // 2 //
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	*/
180 180
 	public static function fatal_error_handler() {
181 181
 		$last_error = error_get_last();
182
-		if ( $last_error['type'] === E_ERROR ) {
183
-			EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] );
182
+		if ($last_error['type'] === E_ERROR) {
183
+			EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
184 184
 		}
185 185
 	}
186 186
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @param $line
196 196
 	 * @return string
197 197
 	 */
198
-	private static function _format_error( $code, $message, $file, $line ) {
198
+	private static function _format_error($code, $message, $file, $line) {
199 199
 		$html  = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>";
200 200
 		$html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>";
201 201
 		$html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>";
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @param $content_type
214 214
 	 * @return string
215 215
 	 */
216
-	public static function set_content_type( $content_type ) {
216
+	public static function set_content_type($content_type) {
217 217
 		return 'text/html';
218 218
 	}
219 219
 
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	*/
228 228
     public function get_error() {
229 229
 
230
-		if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){
230
+		if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) {
231 231
 			throw $this;
232 232
 		}
233 233
 		// get separate user and developer messages if they exist
234
-		$msg = explode( '||', $this->getMessage() );
234
+		$msg = explode('||', $this->getMessage());
235 235
 		$user_msg = $msg[0];
236
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
236
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
237 237
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
238 238
 
239 239
 		// add details to _all_exceptions array
240 240
 		$x_time = time();
241
-		self::$_all_exceptions[ $x_time ]['name'] 	= get_class( $this );
242
-		self::$_all_exceptions[ $x_time ]['file'] 		= $this->getFile();
243
-		self::$_all_exceptions[ $x_time ]['line'] 		= $this->getLine();
244
-		self::$_all_exceptions[ $x_time ]['msg'] 	= $msg;
245
-		self::$_all_exceptions[ $x_time ]['code'] 	= $this->getCode();
246
-		self::$_all_exceptions[ $x_time ]['trace'] 	= $this->getTrace();
247
-		self::$_all_exceptions[ $x_time ]['string'] 	= $this->getTraceAsString();
241
+		self::$_all_exceptions[$x_time]['name'] = get_class($this);
242
+		self::$_all_exceptions[$x_time]['file'] 		= $this->getFile();
243
+		self::$_all_exceptions[$x_time]['line'] 		= $this->getLine();
244
+		self::$_all_exceptions[$x_time]['msg'] = $msg;
245
+		self::$_all_exceptions[$x_time]['code'] = $this->getCode();
246
+		self::$_all_exceptions[$x_time]['trace'] 	= $this->getTrace();
247
+		self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString();
248 248
 		self::$_error_count++;
249 249
 
250 250
 		//add_action( 'shutdown', array( $this, 'display_errors' ));
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	*	@access public
260 260
 	*	@return boolean
261 261
 	*/
262
-    public static function has_error(){
262
+    public static function has_error() {
263 263
 		return self::$_error_count ? TRUE : FALSE;
264 264
 	}
265 265
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	*	@access public
271 271
 	*	@echo string
272 272
 	*/
273
-    public function display_errors(){
273
+    public function display_errors() {
274 274
 
275 275
 		$trace_details = '';
276 276
 
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
 </style>
332 332
 <div id="ee-error-message" class="error">';
333 333
 
334
-		if ( ! WP_DEBUG ) {
334
+		if ( ! WP_DEBUG) {
335 335
 			$output .= '
336 336
 	<p>';
337 337
 		}
338 338
 
339 339
 		// cycle thru errors
340
-		foreach ( self::$_all_exceptions as $time => $ex ) {
340
+		foreach (self::$_all_exceptions as $time => $ex) {
341 341
 
342 342
 			// process trace info
343
-			if ( empty( $ex['trace'] )) {
343
+			if (empty($ex['trace'])) {
344 344
 
345
-	            $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
345
+	            $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso');
346 346
 
347 347
 			} else {
348 348
 
@@ -357,50 +357,50 @@  discard block
 block discarded – undo
357 357
 					<th scope="col" align="left">Method( arguments )</th>
358 358
 				</tr>';
359 359
 
360
-				$last_on_stack = count( $ex['trace'] ) - 1;
360
+				$last_on_stack = count($ex['trace']) - 1;
361 361
 				// reverse array so that stack is in proper chronological order
362
-				$sorted_trace = array_reverse( $ex['trace'] );
362
+				$sorted_trace = array_reverse($ex['trace']);
363 363
 
364
-				foreach ( $sorted_trace as $nmbr => $trace ) {
364
+				foreach ($sorted_trace as $nmbr => $trace) {
365 365
 
366
-					$file = isset( $trace['file'] ) ? $trace['file'] : '' ;
367
-					$class = isset( $trace['class'] ) ? $trace['class'] : '';
368
-					$type = isset( $trace['type'] ) ? $trace['type'] : '';
369
-					$function = isset( $trace['function'] ) ? $trace['function'] : '';
370
-					$args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : '';
371
-					$line = isset( $trace['line'] ) ? $trace['line'] : '';
366
+					$file = isset($trace['file']) ? $trace['file'] : '';
367
+					$class = isset($trace['class']) ? $trace['class'] : '';
368
+					$type = isset($trace['type']) ? $trace['type'] : '';
369
+					$function = isset($trace['function']) ? $trace['function'] : '';
370
+					$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
371
+					$line = isset($trace['line']) ? $trace['line'] : '';
372 372
 					$zebra = $nmbr % 2 ? ' odd' : '';
373 373
 
374
-					if ( empty( $file ) && ! empty( $class )) {
375
-						$a = new ReflectionClass( $class );
374
+					if (empty($file) && ! empty($class)) {
375
+						$a = new ReflectionClass($class);
376 376
 						$file = $a->getFileName();
377
-						if ( empty( $line ) && ! empty( $function )) {
378
-							$b = new ReflectionMethod( $class, $function );
377
+						if (empty($line) && ! empty($function)) {
378
+							$b = new ReflectionMethod($class, $function);
379 379
 							$line = $b->getStartLine();
380 380
 						}
381 381
 					}
382 382
 
383
-					if ( $nmbr == $last_on_stack ) {
383
+					if ($nmbr == $last_on_stack) {
384 384
 						$file = $ex['file'] != '' ? $ex['file'] : $file;
385 385
 						$line = $ex['line'] != '' ? $ex['line'] : $line;
386
-						$error_code = self::generate_error_code ( $file, $trace['function'], $line );
386
+						$error_code = self::generate_error_code($file, $trace['function'], $line);
387 387
 					}
388 388
 
389
-					$nmbr_dsply = ! empty( $nmbr ) ? $nmbr : '&nbsp;';
390
-					$line_dsply = ! empty( $line ) ? $line : '&nbsp;';
391
-					$file_dsply = ! empty( $file ) ? $file : '&nbsp;';
392
-					$class_dsply = ! empty( $class ) ? $class : '&nbsp;';
393
-					$type_dsply = ! empty( $type ) ? $type : '&nbsp;';
394
-					$function_dsply = ! empty( $function ) ? $function : '&nbsp;';
395
-					$args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : '';
389
+					$nmbr_dsply = ! empty($nmbr) ? $nmbr : '&nbsp;';
390
+					$line_dsply = ! empty($line) ? $line : '&nbsp;';
391
+					$file_dsply = ! empty($file) ? $file : '&nbsp;';
392
+					$class_dsply = ! empty($class) ? $class : '&nbsp;';
393
+					$type_dsply = ! empty($type) ? $type : '&nbsp;';
394
+					$function_dsply = ! empty($function) ? $function : '&nbsp;';
395
+					$args_dsply = ! empty($args) ? '( '.$args.' )' : '';
396 396
 
397 397
 		              $trace_details .= '
398 398
 					<tr>
399
-						<td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td>
400
-						<td align="right" class="' . $zebra . '">' . $line_dsply . '</td>
401
-						<td align="left" class="' . $zebra . '">' . $file_dsply . '</td>
402
-						<td align="left" class="' . $zebra . '">' . $class_dsply . '</td>
403
-						<td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td>
399
+						<td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td>
400
+						<td align="right" class="' . $zebra.'">'.$line_dsply.'</td>
401
+						<td align="left" class="' . $zebra.'">'.$file_dsply.'</td>
402
+						<td align="left" class="' . $zebra.'">'.$class_dsply.'</td>
403
+						<td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td>
404 404
 					</tr>';
405 405
 
406 406
 
@@ -415,9 +415,9 @@  discard block
 block discarded – undo
415 415
 			$ex['code'] = $ex['code'] ? $ex['code'] : $error_code;
416 416
 
417 417
 			// add generic non-identifying messages for non-privileged uesrs
418
-			if ( ! WP_DEBUG ) {
418
+			if ( ! WP_DEBUG) {
419 419
 
420
-				$output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] )  . '</span> &nbsp; <sup>' . $ex['code'] . '</sup><br />';
420
+				$output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> &nbsp; <sup>'.$ex['code'].'</sup><br />';
421 421
 
422 422
 			} else {
423 423
 
@@ -425,24 +425,24 @@  discard block
 block discarded – undo
425 425
 				$output .= '
426 426
 		<div class="ee-error-dev-msg-dv">
427 427
 			<p class="ee-error-dev-msg-pg">
428
-				<strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong>  &nbsp; <span>code: ' . $ex['code'] . '</span><br />
429
-				<span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/>
430
-				<a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '">
431
-					' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . '
428
+				<strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong>  &nbsp; <span>code: '.$ex['code'].'</span><br />
429
+				<span class="big-text">"' . trim($ex['msg']).'"</span><br/>
430
+				<a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'">
431
+					' . __('click to view backtrace and class/method details', 'event_espresso').'
432 432
 				</a><br />
433 433
 				<span class="small-text lt-grey-text">'.$ex['file'].' &nbsp; ( line no: '.$ex['line'].' )</span>
434 434
 			</p>
435
-			<div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;">
435
+			<div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;">
436 436
 				' . $trace_details;
437 437
 
438
-				if ( ! empty( $class )) {
438
+				if ( ! empty($class)) {
439 439
 					$output .= '
440 440
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;">
441 441
 					<div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;">
442 442
 						<h3>Class Details</h3>';
443
-						$a = new ReflectionClass( $class );
443
+						$a = new ReflectionClass($class);
444 444
 						$output .= '
445
-						<pre>' . $a . '</pre>
445
+						<pre>' . $a.'</pre>
446 446
 					</div>
447 447
 				</div>';
448 448
 				}
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 
455 455
 			}
456 456
 
457
-			$this->write_to_error_log( $time, $ex );
457
+			$this->write_to_error_log($time, $ex);
458 458
 
459 459
 		}
460 460
 
461 461
 		// remove last linebreak
462
-		$output = substr( $output, 0, ( count( $output ) - 7 ));
462
+		$output = substr($output, 0, (count($output) - 7));
463 463
 
464
-		if ( ! WP_DEBUG ) {
464
+		if ( ! WP_DEBUG) {
465 465
 			$output .= '
466 466
 	</p>';
467 467
 		}
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 		$output .= '
470 470
 </div>';
471 471
 
472
-		$output .= self::_print_scripts( TRUE );
472
+		$output .= self::_print_scripts(TRUE);
473 473
 
474
-		if ( defined( 'DOING_AJAX' )) {
475
-			echo json_encode( array( 'error' => $output ));
474
+		if (defined('DOING_AJAX')) {
475
+			echo json_encode(array('error' => $output));
476 476
 			exit();
477 477
 		}
478 478
 
@@ -492,29 +492,29 @@  discard block
 block discarded – undo
492 492
 	*	@ param array $arguments
493 493
 	*	@ return string
494 494
 	*/
495
-	private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) {
495
+	private function _convert_args_to_string($arguments = array(), $array = FALSE) {
496 496
 
497 497
 		$arg_string = '';
498
-		if ( ! empty( $arguments )) {
498
+		if ( ! empty($arguments)) {
499 499
 
500 500
 			$args = array();
501 501
 
502
-			foreach ( $arguments as $arg ) {
502
+			foreach ($arguments as $arg) {
503 503
 
504
-				if ( ! empty( $arg )) {
504
+				if ( ! empty($arg)) {
505 505
 
506
-					if ( is_string( $arg )) {
507
-						$args[] = " '" . $arg . "'";
508
-					} elseif ( is_array( $arg )) {
509
-						$args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE );
510
-					} elseif ( is_null( $arg )) {
506
+					if (is_string($arg)) {
507
+						$args[] = " '".$arg."'";
508
+					} elseif (is_array($arg)) {
509
+						$args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE);
510
+					} elseif (is_null($arg)) {
511 511
 						$args[] = ' NULL';
512
-					} elseif ( is_bool( $arg )) {
513
-						$args[] = ( $arg ) ? ' TRUE' : ' FALSE';
514
-					} elseif ( is_object( $arg )) {
515
-						$args[] = ' OBJECT ' . get_class( $arg );
516
-					} elseif ( is_resource( $arg )) {
517
-						$args[] = get_resource_type( $arg );
512
+					} elseif (is_bool($arg)) {
513
+						$args[] = ($arg) ? ' TRUE' : ' FALSE';
514
+					} elseif (is_object($arg)) {
515
+						$args[] = ' OBJECT '.get_class($arg);
516
+					} elseif (is_resource($arg)) {
517
+						$args[] = get_resource_type($arg);
518 518
 					} else {
519 519
 						$args[] = $arg;
520 520
 					}
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 				}
523 523
 
524 524
 			}
525
-			$arg_string = implode( ', ', $args );
525
+			$arg_string = implode(', ', $args);
526 526
 		}
527
-		if ( $array ) {
527
+		if ($array) {
528 528
 			$arg_string .= ' )';
529 529
 		}
530 530
 		return $arg_string;
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
545 545
 	* 	@return 		void
546 546
 	*/
547
-	public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
548
-		self::_add_notice ( 'errors', $msg, $file, $func, $line );
547
+	public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
548
+		self::_add_notice('errors', $msg, $file, $func, $line);
549 549
 		self::$_error_count++;
550 550
 	}
551 551
 
@@ -563,8 +563,8 @@  discard block
 block discarded – undo
563 563
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
564 564
 	* 	@return 		void
565 565
 	*/
566
-	public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
567
-		self::_add_notice ( 'success', $msg, $file, $func, $line );
566
+	public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
567
+		self::_add_notice('success', $msg, $file, $func, $line);
568 568
 	}
569 569
 
570 570
 
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
582 582
 	* 	@return 		void
583 583
 	*/
584
-	public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
585
-		self::_add_notice ( 'attention', $msg, $file, $func, $line );
584
+	public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
585
+		self::_add_notice('attention', $msg, $file, $func, $line);
586 586
 	}
587 587
 
588 588
 
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
601 601
 	* 	@return 		void
602 602
 	*/
603
-	private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
604
-		if ( empty( $msg )) {
603
+	private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
604
+		if (empty($msg)) {
605 605
 			EE_Error::doing_it_wrong(
606
-				'EE_Error::add_' . $type . '()',
606
+				'EE_Error::add_'.$type.'()',
607 607
 				sprintf(
608
-					__( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ),
608
+					__('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'),
609 609
 					$type,
610 610
 					$file,
611 611
 					$line
@@ -613,27 +613,27 @@  discard block
 block discarded – undo
613 613
 				EVENT_ESPRESSO_VERSION
614 614
 			);
615 615
 		}
616
-		if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) {
616
+		if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) {
617 617
 			EE_Error::doing_it_wrong(
618 618
 				'EE_Error::add_error()',
619
-				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ),
619
+				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'),
620 620
 				EVENT_ESPRESSO_VERSION
621 621
 			);
622 622
 		}
623 623
 		// get separate user and developer messages if they exist
624
-		$msg = explode( '||', $msg );
624
+		$msg = explode('||', $msg);
625 625
 		$user_msg = $msg[0];
626
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
626
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
627 627
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
628 628
 		// add notice if message exists
629
-		if ( ! empty( $msg )) {
629
+		if ( ! empty($msg)) {
630 630
 			// get error code, but only on error
631
-			if ( WP_DEBUG && $type == 'errors' ) {
632
-				$msg .= '<br/><span class="tiny-text">' . EE_Error::generate_error_code( $file, $func, $line ) . '</span>';
631
+			if (WP_DEBUG && $type == 'errors') {
632
+				$msg .= '<br/><span class="tiny-text">'.EE_Error::generate_error_code($file, $func, $line).'</span>';
633 633
 			}
634 634
 			// add notice
635
-			self::$_espresso_notices[ $type ][] = $msg;
636
-			add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 );
635
+			self::$_espresso_notices[$type][] = $msg;
636
+			add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1);
637 637
 		}
638 638
 
639 639
 	}
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 	*	@access private
688 688
 	*	@return void
689 689
 	*/
690
-	public static function reset_notices(){
690
+	public static function reset_notices() {
691 691
     	self::$_espresso_notices['success'] = FALSE;
692 692
     	self::$_espresso_notices['attention'] = FALSE;
693 693
     	self::$_espresso_notices['errors'] = FALSE;
@@ -700,14 +700,14 @@  discard block
 block discarded – undo
700 700
 	*	@access public
701 701
 	*	@return int
702 702
 	*/
703
-    public static function has_notices(){
703
+    public static function has_notices() {
704 704
 		$has_notices = 0;
705 705
 		// check for success messages
706
-		$has_notices = self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] ) ? 3 : $has_notices;
706
+		$has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices;
707 707
 		// check for attention messages
708
-		$has_notices = self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ? 2 : $has_notices;
708
+		$has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices;
709 709
 		// check for error messages
710
-		$has_notices = self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ? 1 : $has_notices;
710
+		$has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices;
711 711
 		return $has_notices;
712 712
 	}
713 713
 
@@ -722,8 +722,8 @@  discard block
 block discarded – undo
722 722
 	* 	@param		boolean		$remove_empty		whether or not to unset empty messages
723 723
 	* 	@return 		array
724 724
 	*/
725
-	public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) {
726
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
725
+	public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) {
726
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
727 727
 
728 728
 		$success_messages = '';
729 729
 		$attention_messages = '';
@@ -733,44 +733,44 @@  discard block
 block discarded – undo
733 733
 		// EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
734 734
 
735 735
 		// either save notices to the db
736
-		if ( $save_to_transient ) {
737
-			update_option( 'ee_notices', self::$_espresso_notices );
736
+		if ($save_to_transient) {
737
+			update_option('ee_notices', self::$_espresso_notices);
738 738
 			return;
739 739
 		}
740 740
 		// grab any notices that have been previously saved
741
-		if ( $notices = get_option( 'ee_notices', FALSE )) {
742
-			foreach ( $notices as $type => $notice ) {
743
-				if ( is_array( $notice ) && ! empty( $notice )) {
741
+		if ($notices = get_option('ee_notices', FALSE)) {
742
+			foreach ($notices as $type => $notice) {
743
+				if (is_array($notice) && ! empty($notice)) {
744 744
 					// make sure that existsing notice type is an array
745
-					self::$_espresso_notices[ $type ] =  is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array();
745
+					self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array();
746 746
 					// merge stored notices with any newly created ones
747
-					self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice );
747
+					self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice);
748 748
 					$print_scripts = TRUE;
749 749
 				}
750 750
 			}
751 751
 			// now clear any stored notices
752
-			update_option( 'ee_notices', FALSE );
752
+			update_option('ee_notices', FALSE);
753 753
 		}
754 754
 
755 755
 		// check for success messages
756
-		if ( self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] )) {
756
+		if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) {
757 757
 			// combine messages
758
-			$success_messages .= implode( self::$_espresso_notices['success'], '<br />' );
758
+			$success_messages .= implode(self::$_espresso_notices['success'], '<br />');
759 759
 			$print_scripts = TRUE;
760 760
 		}
761 761
 
762 762
 		// check for attention messages
763
-		if ( self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ) {
763
+		if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) {
764 764
 			// combine messages
765
-			$attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' );
765
+			$attention_messages .= implode(self::$_espresso_notices['attention'], '<br />');
766 766
 			$print_scripts = TRUE;
767 767
 		}
768 768
 
769 769
 		// check for error messages
770
-		if ( self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ) {
771
-			$error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' );
770
+		if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) {
771
+			$error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso');
772 772
 			// combine messages
773
-			$error_messages .= implode( self::$_espresso_notices['errors'], '<br />' );
773
+			$error_messages .= implode(self::$_espresso_notices['errors'], '<br />');
774 774
 			$print_scripts = TRUE;
775 775
 		}
776 776
 
@@ -784,21 +784,21 @@  discard block
 block discarded – undo
784 784
 				$css_id = is_admin() ? 'message' : 'espresso-notices-success';
785 785
 				$css_class = is_admin() ? 'updated fade' : 'success fade-away';
786 786
 				//showMessage( $success_messages );
787
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>';
787
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>';
788 788
 			}
789 789
 
790 790
 			if ($attention_messages != '') {
791 791
 				$css_id = is_admin() ? 'message' : 'espresso-notices-attention';
792 792
 				$css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away';
793 793
 				//showMessage( $error_messages, TRUE );
794
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>';
794
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>';
795 795
 			}
796 796
 
797 797
 			if ($error_messages != '') {
798 798
 				$css_id = is_admin() ? 'message' : 'espresso-notices-error';
799 799
 				$css_class = is_admin() ? 'error' : 'error fade-away';
800 800
 				//showMessage( $error_messages, TRUE );
801
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>';
801
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>';
802 802
 			}
803 803
 
804 804
 			$notices .= '</div>';
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 					'errors' => $error_messages
812 812
 			);
813 813
 
814
-			if ( $remove_empty ) {
814
+			if ($remove_empty) {
815 815
 				// remove empty notices
816 816
 				foreach ($notices as $type => $notice) {
817 817
 					if (empty($notice)) {
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 			}
822 822
 		}
823 823
 
824
-		if ( $print_scripts ) {
824
+		if ($print_scripts) {
825 825
 			self::_print_scripts();
826 826
 		}
827 827
 
@@ -841,17 +841,17 @@  discard block
 block discarded – undo
841 841
 	* 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
842 842
 	* 	@return 		void
843 843
 	*/
844
-	public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) {
845
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
846
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
844
+	public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) {
845
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
846
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
847 847
 			//maybe initialize persistent_admin_notices
848
-			if ( empty( $persistent_admin_notices )) {
849
-				add_option( 'ee_pers_admin_notices', array(), '', 'no' );
848
+			if (empty($persistent_admin_notices)) {
849
+				add_option('ee_pers_admin_notices', array(), '', 'no');
850 850
 			}
851
-			$pan_name = sanitize_key( $pan_name );
852
-			if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) {
853
-				$persistent_admin_notices[ $pan_name ] = $pan_message;
854
-				update_option( 'ee_pers_admin_notices', $persistent_admin_notices );
851
+			$pan_name = sanitize_key($pan_name);
852
+			if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) {
853
+				$persistent_admin_notices[$pan_name] = $pan_message;
854
+				update_option('ee_pers_admin_notices', $persistent_admin_notices);
855 855
 			}
856 856
 		}
857 857
 	}
@@ -867,34 +867,34 @@  discard block
 block discarded – undo
867 867
 	 * @param bool          $return_immediately
868 868
 	 * @return        void
869 869
 	 */
870
-	public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) {
871
-		$pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name;
872
-		if ( ! empty( $pan_name )) {
873
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
870
+	public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) {
871
+		$pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name;
872
+		if ( ! empty($pan_name)) {
873
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
874 874
 			// check if notice we wish to dismiss is actually in the $persistent_admin_notices array
875
-			if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) {
875
+			if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) {
876 876
 				// completely delete nag notice, or just NULL message so that it can NOT be added again ?
877
-				if ( $purge ) {
878
-					unset( $persistent_admin_notices[ $pan_name ] );
877
+				if ($purge) {
878
+					unset($persistent_admin_notices[$pan_name]);
879 879
 				} else {
880
-					$persistent_admin_notices[ $pan_name ] = NULL;
880
+					$persistent_admin_notices[$pan_name] = NULL;
881 881
 				}
882
-				if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) {
883
-					EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ );
882
+				if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) {
883
+					EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__);
884 884
 				}
885 885
 			}
886 886
 		}
887
-		if ( $return_immediately ) {
887
+		if ($return_immediately) {
888 888
 			return;
889
-		} else if ( EE_Registry::instance()->REQ->ajax ) {
889
+		} else if (EE_Registry::instance()->REQ->ajax) {
890 890
 			// grab any notices and concatenate into string
891
-			echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE ))));
891
+			echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE))));
892 892
 			exit();
893 893
 		} else {
894 894
 			// save errors to a transient to be displayed on next request (after redirect)
895
-			EE_Error::get_notices( FALSE, TRUE );
896
-			$return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : '';
897
-			wp_safe_redirect( urldecode( $return_url ));
895
+			EE_Error::get_notices(FALSE, TRUE);
896
+			$return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : '';
897
+			wp_safe_redirect(urldecode($return_url));
898 898
 		}
899 899
 	}
900 900
 
@@ -909,20 +909,20 @@  discard block
 block discarded – undo
909 909
 	* 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
910 910
 	 *  	@return 		string
911 911
 	 */
912
-	public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) {
913
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
912
+	public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') {
913
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
914 914
 			$args = array(
915 915
 				'nag_notice' => $pan_name,
916
-				'return_url' => urlencode( $return_url ),
916
+				'return_url' => urlencode($return_url),
917 917
 				'ajax_url' => WP_AJAX_URL,
918
-				'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' )
918
+				'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso')
919 919
 			);
920
-			wp_localize_script( 'espresso_core', 'ee_dismiss', $args );
920
+			wp_localize_script('espresso_core', 'ee_dismiss', $args);
921 921
 			return '
922
-			<div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
923
-				<p>' . $pan_message . '</p>
924
-				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '">
925
-					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .'
922
+			<div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
923
+				<p>' . $pan_message.'</p>
924
+				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'">
925
+					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').'
926 926
 				</a>
927 927
 				<div style="clear:both;"></div>
928 928
 			</div>';
@@ -938,17 +938,17 @@  discard block
 block discarded – undo
938 938
 	 * @param string $return_url
939 939
 	 * @return    array
940 940
 	 */
941
-	public static function get_persistent_admin_notices( $return_url = '' ) {
941
+	public static function get_persistent_admin_notices($return_url = '') {
942 942
 		$notices = '';
943 943
 		// check for persistent admin notices
944
-		if ( $persistent_admin_notices = get_option( 'ee_pers_admin_notices', FALSE )) {
944
+		if ($persistent_admin_notices = get_option('ee_pers_admin_notices', FALSE)) {
945 945
 			// load scripts
946
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
947
-			wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE );
948
-			wp_enqueue_script( 'ee_error_js' );
946
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
947
+			wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE);
948
+			wp_enqueue_script('ee_error_js');
949 949
 			// and display notices
950
-			foreach( $persistent_admin_notices as $pan_name => $pan_message ) {
951
-				$notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url );
950
+			foreach ($persistent_admin_notices as $pan_name => $pan_message) {
951
+				$notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url);
952 952
 			}
953 953
 		}
954 954
 		return $notices;
@@ -963,26 +963,26 @@  discard block
 block discarded – undo
963 963
 	 * @param 	bool $force_print
964 964
 	 * @return 	void
965 965
 	 */
966
-	private static function _print_scripts( $force_print = FALSE ) {
967
-		if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) {
968
-			if ( wp_script_is( 'ee_error_js', 'enqueued' )) {
966
+	private static function _print_scripts($force_print = FALSE) {
967
+		if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) {
968
+			if (wp_script_is('ee_error_js', 'enqueued')) {
969 969
 				return;
970
-			} else if ( wp_script_is( 'ee_error_js', 'registered' )) {
971
-				add_filter( 'FHEE_load_css', '__return_true' );
972
-				add_filter( 'FHEE_load_js', '__return_true' );
973
-				wp_enqueue_script( 'ee_error_js' );
974
-				wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG ));
970
+			} else if (wp_script_is('ee_error_js', 'registered')) {
971
+				add_filter('FHEE_load_css', '__return_true');
972
+				add_filter('FHEE_load_js', '__return_true');
973
+				wp_enqueue_script('ee_error_js');
974
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG));
975 975
 			}
976 976
 		} else {
977 977
 			return '
978 978
 <script>
979 979
 /* <![CDATA[ */
980
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
980
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
981 981
 /* ]]> */
982 982
 </script>
983
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
984
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
985
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
983
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
984
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
985
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
986 986
 ';
987 987
 
988 988
 		}
@@ -1016,11 +1016,11 @@  discard block
 block discarded – undo
1016 1016
 	*	@ param string $line
1017 1017
 	*	@ return string
1018 1018
 	*/
1019
-	public static function generate_error_code ( $file = '', $func = '', $line = '' ) {
1020
-		$file = explode( '.', basename( $file ));
1021
-		$error_code = ! empty( $file[0] ) ? $file[0] : '';
1022
-		$error_code .= ! empty( $func ) ? ' - ' . $func : '';
1023
-		$error_code .= ! empty( $line ) ? ' - ' . $line : '';
1019
+	public static function generate_error_code($file = '', $func = '', $line = '') {
1020
+		$file = explode('.', basename($file));
1021
+		$error_code = ! empty($file[0]) ? $file[0] : '';
1022
+		$error_code .= ! empty($func) ? ' - '.$func : '';
1023
+		$error_code .= ! empty($line) ? ' - '.$line : '';
1024 1024
 		return $error_code;
1025 1025
 	}
1026 1026
 
@@ -1036,36 +1036,36 @@  discard block
 block discarded – undo
1036 1036
 	*	@ param object $ex
1037 1037
 	*	@ return void
1038 1038
 	*/
1039
-	public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) {
1039
+	public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) {
1040 1040
 
1041
-		if ( ! $ex ) {
1041
+		if ( ! $ex) {
1042 1042
 			return;
1043 1043
 		}
1044 1044
 
1045
-		if ( ! $time ) {
1045
+		if ( ! $time) {
1046 1046
 			$time = time();
1047 1047
 		}
1048 1048
 
1049
-		$exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL;
1050
-		$exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . ']  Exception Details' . PHP_EOL;
1051
-		$exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL;
1052
-		$exception_log .= 'Code: '. $ex['code'] . PHP_EOL;
1053
-		$exception_log .= 'File: '. $ex['file'] . PHP_EOL;
1054
-		$exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL;
1055
-		$exception_log .= 'Stack trace: ' . PHP_EOL;
1056
-		$exception_log .= $ex['string'] . PHP_EOL;
1057
-		$exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL;
1058
-
1059
-		EE_Registry::instance()->load_helper( 'File' );
1049
+		$exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL;
1050
+		$exception_log .= '['.date('Y-m-d H:i:s', $time).']  Exception Details'.PHP_EOL;
1051
+		$exception_log .= 'Message: '.$ex['msg'].PHP_EOL;
1052
+		$exception_log .= 'Code: '.$ex['code'].PHP_EOL;
1053
+		$exception_log .= 'File: '.$ex['file'].PHP_EOL;
1054
+		$exception_log .= 'Line No: '.$ex['line'].PHP_EOL;
1055
+		$exception_log .= 'Stack trace: '.PHP_EOL;
1056
+		$exception_log .= $ex['string'].PHP_EOL;
1057
+		$exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL;
1058
+
1059
+		EE_Registry::instance()->load_helper('File');
1060 1060
 		try {
1061
-			EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file );
1062
-			if ( ! $clear ) {
1061
+			EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file);
1062
+			if ( ! $clear) {
1063 1063
 				//get existing log file and append new log info
1064
-				$exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log;
1064
+				$exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log;
1065 1065
 			}
1066
-			EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log );
1067
-		} catch( EE_Error $e ){
1068
-			EE_Error::add_error( sprintf( __(  'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() ));
1066
+			EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log);
1067
+		} catch (EE_Error $e) {
1068
+			EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage()));
1069 1069
 			return;
1070 1070
 		}
1071 1071
 
@@ -1089,10 +1089,10 @@  discard block
 block discarded – undo
1089 1089
 	 * @param int     $error_type
1090 1090
 	 * @return void
1091 1091
 	 */
1092
-	public static function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) {
1093
-		if ( defined('WP_DEBUG') && WP_DEBUG ) {
1092
+	public static function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) {
1093
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1094 1094
 			EE_Registry::instance()->load_helper('Debug_Tools');
1095
-			EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $error_type );
1095
+			EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $error_type);
1096 1096
 		}
1097 1097
 	}
1098 1098
 
@@ -1112,13 +1112,13 @@  discard block
 block discarded – undo
1112 1112
  */
1113 1113
 function espresso_error_enqueue_scripts() {
1114 1114
 	// js for error handling
1115
-	wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE );
1116
-	wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE );
1115
+	wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE);
1116
+	wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE);
1117 1117
 }
1118
-if ( is_admin() ) {
1119
-	add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1118
+if (is_admin()) {
1119
+	add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1120 1120
 } else {
1121
-	add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1121
+	add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1122 1122
 }
1123 1123
 
1124 1124
 
Please login to merge, or discard this patch.
core/EE_Log.core.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3 3
  *
4 4
  * Class EE_Log
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @return EE_Log
63 63
 	 */
64 64
 	public static function instance() {
65
-		if ( ! self::$_instance instanceof EE_Log ) {
65
+		if ( ! self::$_instance instanceof EE_Log) {
66 66
 			self::$_instance = new self();
67 67
 		}
68 68
 		return self::$_instance;
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	private function __construct() {
76 76
 
77
-		if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging ) {
77
+		if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging) {
78 78
 			return;
79 79
 		}
80 80
 
81
-		$this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS;
81
+		$this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS;
82 82
 		$this->_log_file = EE_Registry::instance()->CFG->admin->log_file_name();
83 83
 		$this->_log = '';
84 84
 		$this->_debug_file = EE_Registry::instance()->CFG->admin->debug_file_name();
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 		$this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url;
87 87
 		$this->_remote_log = '';
88 88
 
89
-		add_action( 'admin_init', array( $this, 'verify_filesystem' ), -10 );
90
-		add_action( 'AHEE_log', array( $this, 'log' ), 10, 4 );
91
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
92
-			add_action( 'shutdown', array( $this, 'write_log' ), 9999 );
89
+		add_action('admin_init', array($this, 'verify_filesystem'), -10);
90
+		add_action('AHEE_log', array($this, 'log'), 10, 4);
91
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
92
+			add_action('shutdown', array($this, 'write_log'), 9999);
93 93
 			// if WP_DEBUG
94
-			add_action( 'shutdown', array( $this, 'write_debug' ), 9999 );
94
+			add_action('shutdown', array($this, 'write_debug'), 9999);
95 95
 		}
96
-		if ( EE_Registry::instance()->CFG->admin->use_remote_logging ) {
97
-			add_action( 'shutdown', array( $this, 'send_log' ), 9999 );
96
+		if (EE_Registry::instance()->CFG->admin->use_remote_logging) {
97
+			add_action('shutdown', array($this, 'send_log'), 9999);
98 98
 		}
99 99
 
100 100
 	}
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function verify_filesystem() {
110 110
 		try {
111
-			EE_Registry::instance()->load_helper( 'File' );
112
-			EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_log_file );
113
-			EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_debug_file );
114
-		} catch( EE_Error $e ){
115
-			EE_Error::add_error( sprintf( __(  'Event Espresso logging could not be setup because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
111
+			EE_Registry::instance()->load_helper('File');
112
+			EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_log_file);
113
+			EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_debug_file);
114
+		} catch (EE_Error $e) {
115
+			EE_Error::add_error(sprintf(__('Event Espresso logging could not be setup because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
116 116
 			return;
117 117
 		}
118 118
 	}
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 * @param string $type
130 130
 	 * @return string
131 131
 	 */
132
-	private function _format_message( $file = '', $function = '', $message = '', $type = '' ) {
133
-		$msg = '----------------------------------------------------------------------------------------' . PHP_EOL;
134
-		$msg .= '[' . current_time( 'mysql' ) . '] ';
135
-		$msg .= ! empty( $file ) ? basename( $file ) : '';
136
-		$msg .= ! empty( $file ) && ! empty( $function ) ? ' -> ' : '';
137
-		$msg .= ! empty( $function ) ? $function . '()' : '';
132
+	private function _format_message($file = '', $function = '', $message = '', $type = '') {
133
+		$msg = '----------------------------------------------------------------------------------------'.PHP_EOL;
134
+		$msg .= '['.current_time('mysql').'] ';
135
+		$msg .= ! empty($file) ? basename($file) : '';
136
+		$msg .= ! empty($file) && ! empty($function) ? ' -> ' : '';
137
+		$msg .= ! empty($function) ? $function.'()' : '';
138 138
 		$msg .= PHP_EOL;
139
-		$type = ! empty( $type ) ? $type : 'log message';
140
-		$msg .= ! empty( $message ) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : '';
139
+		$type = ! empty($type) ? $type : 'log message';
140
+		$msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : '';
141 141
 		return $msg;
142 142
 	}
143 143
 
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	 * @param string $message
153 153
 	 * @param string $type
154 154
 	 */
155
-	public function log( $file = '', $function = '', $message = '', $type = '' ) {
156
-		$this->_log .= $this->_format_message( $file, $function, $message, $type );
155
+	public function log($file = '', $function = '', $message = '', $type = '') {
156
+		$this->_log .= $this->_format_message($file, $function, $message, $type);
157 157
 	}
158 158
 
159 159
 
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 	public function write_log() {
166 166
 		try {
167 167
 			//get existing log file and append new log info
168
-			$this->_log = EEH_File::get_file_contents( $this->_logs_folder . $this->_log_file ) . $this->_log;
169
-			EEH_File::write_to_file( $this->_logs_folder . $this->_log_file, $this->_log, 'Event Espresso Log' );
170
-		} catch( EE_Error $e ){
171
-			EE_Error::add_error( sprintf( __(  'Could not write to the Event Espresso log file because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
168
+			$this->_log = EEH_File::get_file_contents($this->_logs_folder.$this->_log_file).$this->_log;
169
+			EEH_File::write_to_file($this->_logs_folder.$this->_log_file, $this->_log, 'Event Espresso Log');
170
+		} catch (EE_Error $e) {
171
+			EE_Error::add_error(sprintf(__('Could not write to the Event Espresso log file because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
172 172
 			return;
173 173
 		}
174 174
 	}
@@ -181,31 +181,31 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function send_log() {
183 183
 
184
-		if ( empty( $this->_remote_logging_url )) {
184
+		if (empty($this->_remote_logging_url)) {
185 185
 			return;
186 186
 		}
187 187
 
188
-		$data = 'domain=' . $_SERVER['HTTP_HOST'];
189
-		$data .= '&ip=' . $_SERVER['SERVER_ADDR'];
190
-		$data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE'];
191
-		$data .= '&time=' . time();
192
-		$data .= '&remote_log=' . $this->_log;
193
-		$data .= '&request_array=' . json_encode( $_REQUEST );
188
+		$data = 'domain='.$_SERVER['HTTP_HOST'];
189
+		$data .= '&ip='.$_SERVER['SERVER_ADDR'];
190
+		$data .= '&server_type='.$_SERVER['SERVER_SOFTWARE'];
191
+		$data .= '&time='.time();
192
+		$data .= '&remote_log='.$this->_log;
193
+		$data .= '&request_array='.json_encode($_REQUEST);
194 194
 		$data .= '&action=save';
195 195
 
196
-		if ( defined( 'EELOGGING_PASS' )) {
197
-			$data .= '&pass=' . EELOGGING_PASS;
196
+		if (defined('EELOGGING_PASS')) {
197
+			$data .= '&pass='.EELOGGING_PASS;
198 198
 		}
199
-		if ( defined( 'EELOGGING_KEY' )) {
200
-			$data .= '&key=' . EELOGGING_KEY;
199
+		if (defined('EELOGGING_KEY')) {
200
+			$data .= '&key='.EELOGGING_KEY;
201 201
 		}
202 202
 
203
-		$c = curl_init( $this->_remote_logging_url );
204
-		curl_setopt( $c, CURLOPT_POST, TRUE );
205
-		curl_setopt( $c, CURLOPT_POSTFIELDS, $data );
206
-		curl_setopt( $c, CURLOPT_RETURNTRANSFER, TRUE );
207
-		curl_exec( $c );
208
-		curl_close( $c );
203
+		$c = curl_init($this->_remote_logging_url);
204
+		curl_setopt($c, CURLOPT_POST, TRUE);
205
+		curl_setopt($c, CURLOPT_POSTFIELDS, $data);
206
+		curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE);
207
+		curl_exec($c);
208
+		curl_close($c);
209 209
 	}
210 210
 
211 211
 
@@ -216,18 +216,18 @@  discard block
 block discarded – undo
216 216
 	 * previous entries are overwritten
217 217
 	 */
218 218
 	public function write_debug() {
219
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
219
+		if (defined('WP_DEBUG') && WP_DEBUG) {
220 220
 			$this->_debug_log = '';
221
-			foreach ( $_GET as $key => $value ) {
222
-				$this->_debug_log .= '$_GET["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL;
221
+			foreach ($_GET as $key => $value) {
222
+				$this->_debug_log .= '$_GET["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL;
223 223
 			}
224
-			foreach ( $_POST as $key => $value ) {
225
-				$this->_debug_log .= '$_POST["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL;
224
+			foreach ($_POST as $key => $value) {
225
+				$this->_debug_log .= '$_POST["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL;
226 226
 			}
227 227
 			try {
228
-				EEH_File::write_to_file( $this->_logs_folder . $this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log' );
229
-			} catch( EE_Error $e ){
230
-				EE_Error::add_error( sprintf( __(  'Could not write to the Event Espresso debug log file because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
228
+				EEH_File::write_to_file($this->_logs_folder.$this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log');
229
+			} catch (EE_Error $e) {
230
+				EE_Error::add_error(sprintf(__('Could not write to the Event Espresso debug log file because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
231 231
 				return;
232 232
 			}
233 233
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * __clone
240 240
 	 */
241 241
 	public function __clone() {
242
-		trigger_error( __( 'Clone is not allowed.', 'event_espresso' ), E_USER_ERROR );
242
+		trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR);
243 243
 	}
244 244
 
245 245
 
Please login to merge, or discard this patch.