Completed
Branch BUG-8698-ticket-sellouts (195489)
by
unknown
117:04 queued 99:55
created
core/db_classes/EE_Venue.class.php 1 patch
Spacing   +82 added lines, -82 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
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 	 *                             		    date_format and the second value is the time format
38 38
 	 * @return EE_Attendee
39 39
 	 */
40
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
41
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
42
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
40
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
41
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
42
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
43 43
 	}
44 44
 
45 45
 
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 	 *                          		the website will be used.
51 51
 	 * @return EE_Attendee
52 52
 	 */
53
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
54
-		return new self( $props_n_values, TRUE, $timezone );
53
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
54
+		return new self($props_n_values, TRUE, $timezone);
55 55
 	}
56 56
 
57 57
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @return string
62 62
 	 */
63 63
 	function name() {
64
-		return $this->get( 'VNU_name' );
64
+		return $this->get('VNU_name');
65 65
 	}
66 66
 
67 67
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @return string
71 71
 	 */
72 72
 	function phone() {
73
-		return $this->get( 'VNU_phone' );
73
+		return $this->get('VNU_phone');
74 74
 	}
75 75
 
76 76
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @return string
81 81
 	 */
82 82
 	function venue_url() {
83
-		return $this->get( 'VNU_url' );
83
+		return $this->get('VNU_url');
84 84
 	}
85 85
 
86 86
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return string
90 90
 	 */
91 91
 	function description() {
92
-		return $this->get( 'VNU_desc' );
92
+		return $this->get('VNU_desc');
93 93
 	}
94 94
 
95 95
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return string
100 100
 	 */
101 101
 	function excerpt() {
102
-		return $this->get( 'VNU_short_desc' );
102
+		return $this->get('VNU_short_desc');
103 103
 	}
104 104
 
105 105
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @return string
110 110
 	 */
111 111
 	function identifier() {
112
-		return $this->get( 'VNU_identifier' );
112
+		return $this->get('VNU_identifier');
113 113
 	}
114 114
 
115 115
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @return string
120 120
 	 */
121 121
 	function address() {
122
-		return $this->get( 'VNU_address' );
122
+		return $this->get('VNU_address');
123 123
 	}
124 124
 
125 125
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @return string
130 130
 	 */
131 131
 	function address2() {
132
-		return $this->get( 'VNU_address2' );
132
+		return $this->get('VNU_address2');
133 133
 	}
134 134
 
135 135
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 * @return string
141 141
 	 */
142 142
 	function city() {
143
-		return $this->get( 'VNU_city' );
143
+		return $this->get('VNU_city');
144 144
 	}
145 145
 
146 146
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @return int
149 149
 	 */
150 150
 	function state_ID() {
151
-		return $this->get( 'STA_ID' );
151
+		return $this->get('STA_ID');
152 152
 	}
153 153
 
154 154
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return string
158 158
 	 */
159 159
 	public function state_abbrev() {
160
-		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' );
160
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso');
161 161
 	}
162 162
 
163 163
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @return string
167 167
 	 */
168 168
 	public function state_name() {
169
-		return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() :  __( 'Unknown', 'event_espresso' );
169
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __('Unknown', 'event_espresso');
170 170
 	}
171 171
 
172 172
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * @return EE_State
177 177
 	 */
178 178
 	function state_obj() {
179
-		return $this->get_first_related( 'State' );
179
+		return $this->get_first_related('State');
180 180
 	}
181 181
 
182 182
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 * @return string
189 189
 	 */
190 190
 	public function state() {
191
-		if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) {
191
+		if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) {
192 192
 			return $this->state_abbrev();
193 193
 		} else {
194 194
 			return $this->state_name();
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @return string
203 203
 	 */
204 204
 	function country_ID() {
205
-		return $this->get( 'CNT_ISO' );
205
+		return $this->get('CNT_ISO');
206 206
 	}
207 207
 
208 208
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	 * @return string
212 212
 	 */
213 213
 	public function country_name() {
214
-		return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() :  __( 'Unknown', 'event_espresso' );
214
+		return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __('Unknown', 'event_espresso');
215 215
 	}
216 216
 
217 217
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @return EE_Country
222 222
 	 */
223 223
 	function country_obj() {
224
-		return $this->get_first_related( 'Country' );
224
+		return $this->get_first_related('Country');
225 225
 	}
226 226
 
227 227
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 * @return string
234 234
 	 */
235 235
 	public function country() {
236
-		if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) {
236
+		if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) {
237 237
 			return $this->country_ID();
238 238
 		} else {
239 239
 			return $this->country_name();
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 * @return string
248 248
 	 */
249 249
 	function zip() {
250
-		return $this->get( 'VNU_zip' );
250
+		return $this->get('VNU_zip');
251 251
 	}
252 252
 
253 253
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 * @return int
258 258
 	 */
259 259
 	function capacity() {
260
-		return $this->get_pretty( 'VNU_capacity', 'symbol' );
260
+		return $this->get_pretty('VNU_capacity', 'symbol');
261 261
 	}
262 262
 
263 263
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 * @return string
268 268
 	 */
269 269
 	function created() {
270
-		return $this->get( 'VNU_created' );
270
+		return $this->get('VNU_created');
271 271
 	}
272 272
 
273 273
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * @return string
278 278
 	 */
279 279
 	function modified() {
280
-		return $this->get( 'VNU_modified' );
280
+		return $this->get('VNU_modified');
281 281
 	}
282 282
 
283 283
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 * @return int
288 288
 	 */
289 289
 	function order() {
290
-		return $this->get( 'VNU_order' );
290
+		return $this->get('VNU_order');
291 291
 	}
292 292
 
293 293
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @return int
298 298
 	 */
299 299
 	function wp_user() {
300
-		return $this->get( 'VNU_wp_user' );
300
+		return $this->get('VNU_wp_user');
301 301
 	}
302 302
 
303 303
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * @return string
307 307
 	 */
308 308
 	function virtual_phone() {
309
-		return $this->get( 'VNU_virtual_phone' );
309
+		return $this->get('VNU_virtual_phone');
310 310
 	}
311 311
 
312 312
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * @return string
316 316
 	 */
317 317
 	function virtual_url() {
318
-		return $this->get( 'VNU_virtual_url' );
318
+		return $this->get('VNU_virtual_url');
319 319
 	}
320 320
 
321 321
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 * @return bool
325 325
 	 */
326 326
 	function enable_for_gmap() {
327
-		return $this->get( 'VNU_enable_for_gmap' );
327
+		return $this->get('VNU_enable_for_gmap');
328 328
 	}
329 329
 
330 330
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 * @return string
334 334
 	 */
335 335
 	function google_map_link() {
336
-		return $this->get( 'VNU_google_map_link' );
336
+		return $this->get('VNU_google_map_link');
337 337
 	}
338 338
 
339 339
 
@@ -345,16 +345,16 @@  discard block
 block discarded – undo
345 345
 	 * @param bool  $upcoming
346 346
 	 * @return EE_Event[]
347 347
 	 */
348
-	function events( $query_params = array(), $upcoming = FALSE ) {
349
-		if ( $upcoming ) {
348
+	function events($query_params = array(), $upcoming = FALSE) {
349
+		if ($upcoming) {
350 350
 			$query_params = array(
351 351
 				array(
352 352
 					'status' => 'publish',
353
-					'Datetime.DTT_EVT_start' => array( '>',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) )
353
+					'Datetime.DTT_EVT_start' => array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'))
354 354
 				)
355 355
 			);
356 356
 		}
357
-		return $this->get_many_related( 'Event', $query_params );
357
+		return $this->get_many_related('Event', $query_params);
358 358
 	}
359 359
 
360 360
 
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
 	/**
373 373
 	 * Sets address
374 374
 	 */
375
-	function set_address( $address = '' ) {
376
-		$this->set( 'VNU_address', $address );
375
+	function set_address($address = '') {
376
+		$this->set('VNU_address', $address);
377 377
 	}
378 378
 
379 379
 
@@ -381,8 +381,8 @@  discard block
 block discarded – undo
381 381
 	/**
382 382
 	 * @param string $address2
383 383
 	 */
384
-	function set_address2( $address2 = '' ) {
385
-		$this->set( 'VNU_address2', $address2 );
384
+	function set_address2($address2 = '') {
385
+		$this->set('VNU_address2', $address2);
386 386
 	}
387 387
 
388 388
 
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 	/**
391 391
 	 * @param string $city
392 392
 	 */
393
-	function set_city( $city = '' ) {
394
-		$this->set( 'VNU_city', $city );
393
+	function set_city($city = '') {
394
+		$this->set('VNU_city', $city);
395 395
 	}
396 396
 
397 397
 
@@ -399,8 +399,8 @@  discard block
 block discarded – undo
399 399
 	/**
400 400
 	 * @param int $state
401 401
 	 */
402
-	function set_state_ID( $state = 0 ) {
403
-		$this->set( 'STA_ID', $state );
402
+	function set_state_ID($state = 0) {
403
+		$this->set('STA_ID', $state);
404 404
 	}
405 405
 
406 406
 
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
 	 * @param EE_State /int $state_id_or_obj
412 412
 	 * @return EE_State
413 413
 	 */
414
-	function set_state_obj( $state_id_or_obj ) {
415
-		return $this->_add_relation_to( $state_id_or_obj, 'State' );
414
+	function set_state_obj($state_id_or_obj) {
415
+		return $this->_add_relation_to($state_id_or_obj, 'State');
416 416
 	}
417 417
 
418 418
 
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 	/**
421 421
 	 * @param int $country_ID
422 422
 	 */
423
-	function set_country_ID( $country_ID = 0 ) {
424
-		$this->set( 'CNT_ISO', $country_ID );
423
+	function set_country_ID($country_ID = 0) {
424
+		$this->set('CNT_ISO', $country_ID);
425 425
 	}
426 426
 
427 427
 
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 	 * @param EE_Country /string $country_id_or_obj
431 431
 	 * @return EE_Country
432 432
 	 */
433
-	function set_country_obj( $country_id_or_obj ) {
433
+	function set_country_obj($country_id_or_obj) {
434 434
 		return $this->_add_relation_to($country_id_or_obj, 'Country');
435 435
 	}
436 436
 
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
 	/**
440 440
 	 * @param string $zip
441 441
 	 */
442
-	function set_zip( $zip = '' ) {
443
-		$this->set( 'VNU_zip', $zip );
442
+	function set_zip($zip = '') {
443
+		$this->set('VNU_zip', $zip);
444 444
 	}
445 445
 
446 446
 
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 	/**
449 449
 	 * @param int $capacity
450 450
 	 */
451
-	function set_capacity( $capacity = 0 ) {
452
-		$this->set( 'VNU_capacity', $capacity );
451
+	function set_capacity($capacity = 0) {
452
+		$this->set('VNU_capacity', $capacity);
453 453
 	}
454 454
 
455 455
 
@@ -457,8 +457,8 @@  discard block
 block discarded – undo
457 457
 	/**
458 458
 	 * @param string $created
459 459
 	 */
460
-	function set_created( $created = '' ) {
461
-		$this->set( 'VNU_created', $created );
460
+	function set_created($created = '') {
461
+		$this->set('VNU_created', $created);
462 462
 	}
463 463
 
464 464
 
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 	/**
467 467
 	 * @param string $desc
468 468
 	 */
469
-	function set_description( $desc = '' ) {
470
-		$this->set( 'VNU_desc', $desc );
469
+	function set_description($desc = '') {
470
+		$this->set('VNU_desc', $desc);
471 471
 	}
472 472
 
473 473
 
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
 	/**
476 476
 	 * @param string $identifier
477 477
 	 */
478
-	function set_identifier( $identifier = '' ) {
479
-		$this->set( 'VNU_identifier', $identifier );
478
+	function set_identifier($identifier = '') {
479
+		$this->set('VNU_identifier', $identifier);
480 480
 	}
481 481
 
482 482
 
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	/**
485 485
 	 * @param string $modified
486 486
 	 */
487
-	function set_modified( $modified = '' ) {
488
-		$this->set( 'VNU_modified', $modified );
487
+	function set_modified($modified = '') {
488
+		$this->set('VNU_modified', $modified);
489 489
 	}
490 490
 
491 491
 
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 	/**
494 494
 	 * @param string $name
495 495
 	 */
496
-	function set_name( $name = '' ) {
497
-		$this->set( 'VNU_name', $name );
496
+	function set_name($name = '') {
497
+		$this->set('VNU_name', $name);
498 498
 	}
499 499
 
500 500
 
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
 	/**
503 503
 	 * @param int $order
504 504
 	 */
505
-	function set_order( $order = 0 ) {
506
-		$this->set( 'VNU_order', $order );
505
+	function set_order($order = 0) {
506
+		$this->set('VNU_order', $order);
507 507
 	}
508 508
 
509 509
 
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
 	/**
512 512
 	 * @param string $phone
513 513
 	 */
514
-	function set_phone( $phone = '' ) {
515
-		$this->set( 'VNU_phone', $phone );
514
+	function set_phone($phone = '') {
515
+		$this->set('VNU_phone', $phone);
516 516
 	}
517 517
 
518 518
 
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
 	/**
521 521
 	 * @param int $wp_user
522 522
 	 */
523
-	function set_wp_user( $wp_user = 1 ) {
524
-		$this->set( 'VNU_wp_user', $wp_user );
523
+	function set_wp_user($wp_user = 1) {
524
+		$this->set('VNU_wp_user', $wp_user);
525 525
 	}
526 526
 
527 527
 
@@ -529,8 +529,8 @@  discard block
 block discarded – undo
529 529
 	/**
530 530
 	 * @param string $url
531 531
 	 */
532
-	function set_venue_url( $url = '' ) {
533
-		$this->set( 'VNU_url', $url );
532
+	function set_venue_url($url = '') {
533
+		$this->set('VNU_url', $url);
534 534
 	}
535 535
 
536 536
 
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
 	/**
539 539
 	 * @param string $phone
540 540
 	 */
541
-	function set_virtual_phone( $phone = '' ) {
542
-		$this->set( 'VNU_virtual_phone', $phone );
541
+	function set_virtual_phone($phone = '') {
542
+		$this->set('VNU_virtual_phone', $phone);
543 543
 	}
544 544
 
545 545
 
@@ -547,8 +547,8 @@  discard block
 block discarded – undo
547 547
 	/**
548 548
 	 * @param string $url
549 549
 	 */
550
-	function set_virtual_url( $url = '' ) {
551
-		$this->set( 'VNU_virtual_url', $url );
550
+	function set_virtual_url($url = '') {
551
+		$this->set('VNU_virtual_url', $url);
552 552
 	}
553 553
 
554 554
 
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
 	/**
557 557
 	 * @param string $enable
558 558
 	 */
559
-	function set_enable_for_gmap( $enable = '' ) {
560
-		$this->set( 'VNU_enable_for_gmap', $enable );
559
+	function set_enable_for_gmap($enable = '') {
560
+		$this->set('VNU_enable_for_gmap', $enable);
561 561
 	}
562 562
 
563 563
 
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 	/**
566 566
 	 * @param string $google_map_link
567 567
 	 */
568
-	function set_google_map_link( $google_map_link = '' ) {
569
-		$this->set( 'VNU_google_map_link', $google_map_link );
568
+	function set_google_map_link($google_map_link = '') {
569
+		$this->set('VNU_google_map_link', $google_map_link);
570 570
 	}
571 571
 
572 572
 
Please login to merge, or discard this patch.
core/helpers/EEH_DTT_Helper.helper.php 1 patch
Spacing   +115 added lines, -116 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
 /**
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	 * @return string
54 54
 	 * @throws \EE_Error
55 55
 	 */
56
-	public static function get_valid_timezone_string( $timezone_string = '' ) {
56
+	public static function get_valid_timezone_string($timezone_string = '') {
57 57
 		// if passed a value, then use that, else get WP option
58
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' );
58
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string');
59 59
 		// value from above exists, use that, else get timezone string from gmt_offset
60
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset();
61
-		EEH_DTT_Helper::validate_timezone( $timezone_string );
60
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset();
61
+		EEH_DTT_Helper::validate_timezone($timezone_string);
62 62
 		return $timezone_string;
63 63
 	}
64 64
 
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
 	 * @return bool
75 75
 	 * @throws \EE_Error
76 76
 	 */
77
-	public static function validate_timezone( $timezone_string, $throw_error = true ) {
77
+	public static function validate_timezone($timezone_string, $throw_error = true) {
78 78
 		// easiest way to test a timezone string is just see if it throws an error when you try to create a DateTimeZone object with it
79 79
 		try {
80
-			new DateTimeZone( $timezone_string );
81
-		} catch ( Exception $e ) {
80
+			new DateTimeZone($timezone_string);
81
+		} catch (Exception $e) {
82 82
 			// sometimes we take exception to exceptions
83
-			if ( ! $throw_error ) {
83
+			if ( ! $throw_error) {
84 84
 				return false;
85 85
 			}
86 86
 			throw new EE_Error(
87 87
 				sprintf(
88
-					__( 'The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ),
88
+					__('The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'),
89 89
 					$timezone_string,
90 90
 					'<a href="http://www.php.net/manual/en/timezones.php">',
91 91
 					'</a>'
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 	 * @param string $gmt_offset
105 105
 	 * @return string
106 106
 	 */
107
-	public static function get_timezone_string_from_gmt_offset( $gmt_offset = '' ) {
107
+	public static function get_timezone_string_from_gmt_offset($gmt_offset = '') {
108 108
 		$timezone_string = 'UTC';
109
-		$gmt_offset = ! empty( $gmt_offset ) ? $gmt_offset : get_option( 'gmt_offset' );
110
-		if ( $gmt_offset !== '' ) {
109
+		$gmt_offset = ! empty($gmt_offset) ? $gmt_offset : get_option('gmt_offset');
110
+		if ($gmt_offset !== '') {
111 111
 			// convert GMT offset to seconds
112 112
 			$gmt_offset = $gmt_offset * HOUR_IN_SECONDS;
113 113
 			// account for WP offsets that aren't valid UTC
114
-			$gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets( $gmt_offset );
114
+			$gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets($gmt_offset);
115 115
 			// although we don't know the TZ abbreviation, we know the UTC offset
116
-			$timezone_string = timezone_name_from_abbr( null, $gmt_offset );
116
+			$timezone_string = timezone_name_from_abbr(null, $gmt_offset);
117 117
 		}
118 118
 		// better have a valid timezone string by now, but if not, sigh... loop thru  the timezone_abbreviations_list()...
119
-		$timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset );
119
+		$timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list($gmt_offset);
120 120
 		return $timezone_string;
121 121
 	}
122 122
 
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 	 * @param int $gmt_offset
130 130
 	 * @return int
131 131
 	 */
132
-	public static function adjust_invalid_gmt_offsets( $gmt_offset = 0 ) {
132
+	public static function adjust_invalid_gmt_offsets($gmt_offset = 0) {
133 133
 		//make sure $gmt_offset is int
134 134
 		$gmt_offset = (int) $gmt_offset;
135
-		switch ( $gmt_offset ) {
135
+		switch ($gmt_offset) {
136 136
 
137 137
 			//			case -30600 :
138 138
 			//				$gmt_offset = -28800;
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
 	 * @return string
185 185
 	 * @throws \EE_Error
186 186
 	 */
187
-	public static function get_timezone_string_from_abbreviations_list( $gmt_offset = 0 ) {
187
+	public static function get_timezone_string_from_abbreviations_list($gmt_offset = 0) {
188 188
 		$abbreviations = timezone_abbreviations_list();
189
-		foreach ( $abbreviations as $abbreviation ) {
190
-			foreach ( $abbreviation as $city ) {
191
-				if ( $city['offset'] === $gmt_offset && $city['dst'] === FALSE ) {
189
+		foreach ($abbreviations as $abbreviation) {
190
+			foreach ($abbreviation as $city) {
191
+				if ($city['offset'] === $gmt_offset && $city['dst'] === FALSE) {
192 192
 					// check if the timezone is valid but don't throw any errors if it isn't
193
-					if ( EEH_DTT_Helper::validate_timezone( $city['timezone_id'], false ) ) {
193
+					if (EEH_DTT_Helper::validate_timezone($city['timezone_id'], false)) {
194 194
 						return $city['timezone_id'];
195 195
 					}
196 196
 				}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		}
199 199
 		throw new EE_Error(
200 200
 			sprintf(
201
-				__( 'The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ),
201
+				__('The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'),
202 202
 				$gmt_offset,
203 203
 				'<a href="http://www.php.net/manual/en/timezones.php">',
204 204
 				'</a>'
@@ -212,23 +212,23 @@  discard block
 block discarded – undo
212 212
 	 * @access public
213 213
 	 * @param string $timezone_string
214 214
 	 */
215
-	public static function timezone_select_input( $timezone_string = '' ) {
215
+	public static function timezone_select_input($timezone_string = '') {
216 216
 		// get WP date time format
217
-		$datetime_format = get_option('date_format') . ' '  . get_option('time_format');
217
+		$datetime_format = get_option('date_format').' '.get_option('time_format');
218 218
 		// if passed a value, then use that, else get WP option
219
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' );
219
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string');
220 220
 		// check if the timezone is valid but don't throw any errors if it isn't
221
-		$timezone_string = EEH_DTT_Helper::validate_timezone( $timezone_string, false );
221
+		$timezone_string = EEH_DTT_Helper::validate_timezone($timezone_string, false);
222 222
 		$gmt_offset = get_option('gmt_offset');
223 223
 
224 224
 		$check_zone_info = true;
225
-		if ( empty( $timezone_string )) {
225
+		if (empty($timezone_string)) {
226 226
 			// Create a UTC+- zone if no timezone string exists
227 227
 			$check_zone_info = false;
228
-			if ( $gmt_offset > 0 ) {
229
-				$timezone_string = 'UTC+' . $gmt_offset;
230
-			} elseif ( $gmt_offset < 0 ) {
231
-				$timezone_string = 'UTC' . $gmt_offset;
228
+			if ($gmt_offset > 0) {
229
+				$timezone_string = 'UTC+'.$gmt_offset;
230
+			} elseif ($gmt_offset < 0) {
231
+				$timezone_string = 'UTC'.$gmt_offset;
232 232
 			} else {
233 233
 				$timezone_string = 'UTC';
234 234
 			}
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 					__('%1$sUTC%2$s time is %3$s'),
251 251
 					'<abbr title="Coordinated Universal Time">',
252 252
 					'</abbr>',
253
-					'<code>' . date_i18n( $datetime_format , false, 'gmt') . '</code>'
253
+					'<code>'.date_i18n($datetime_format, false, 'gmt').'</code>'
254 254
 				);
255 255
 				?></span>
256
-			<?php if ( ! empty( $timezone_string ) || ! empty( $gmt_offset )) : ?>
257
-				<br /><span><?php printf(__('Local time is %1$s'), '<code>' . date_i18n( $datetime_format ) . '</code>' ); ?></span>
256
+			<?php if ( ! empty($timezone_string) || ! empty($gmt_offset)) : ?>
257
+				<br /><span><?php printf(__('Local time is %1$s'), '<code>'.date_i18n($datetime_format).'</code>'); ?></span>
258 258
 		<?php endif; ?>
259 259
 
260 260
 				<?php if ($check_zone_info && $timezone_string) : ?>
@@ -286,10 +286,9 @@  discard block
 block discarded – undo
286 286
 
287 287
 						if ($found) {
288 288
 							$message = $tr['isdst'] ?
289
-											__(' Daylight saving time begins on: %s.' ) :
290
-											__(' Standard time begins  on: %s.');
289
+											__(' Daylight saving time begins on: %s.') : __(' Standard time begins  on: %s.');
291 290
 							// Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n().
292
-							printf( $message, '<code >' . date_i18n( $datetime_format, $tr['ts'] + ( $tz_offset - $tr['offset'] ) ). '</code >' );
291
+							printf($message, '<code >'.date_i18n($datetime_format, $tr['ts'] + ($tz_offset - $tr['offset'])).'</code >');
293 292
 						} else {
294 293
 							_e('This timezone does not observe daylight saving time.');
295 294
 						}
@@ -319,14 +318,14 @@  discard block
 block discarded – undo
319 318
 	 *
320 319
 	 * @return int      $unix_timestamp with the offset applied for the given timezone.
321 320
 	 */
322
-	public static function get_timestamp_with_offset( $unix_timestamp = 0, $timezone_string = '' ) {
321
+	public static function get_timestamp_with_offset($unix_timestamp = 0, $timezone_string = '') {
323 322
 		$unix_timestamp = $unix_timestamp === 0 ? time() : (int) $unix_timestamp;
324
-		$timezone_string = self::get_valid_timezone_string( $timezone_string );
325
-		$TimeZone = new DateTimeZone( $timezone_string );
323
+		$timezone_string = self::get_valid_timezone_string($timezone_string);
324
+		$TimeZone = new DateTimeZone($timezone_string);
326 325
 
327
-		$DateTime = new DateTime( '@' . $unix_timestamp, $TimeZone );
328
-		$offset = timezone_offset_get( $TimeZone, $DateTime );
329
-		return (int)$DateTime->format( 'U' ) + (int)$offset;
326
+		$DateTime = new DateTime('@'.$unix_timestamp, $TimeZone);
327
+		$offset = timezone_offset_get($TimeZone, $DateTime);
328
+		return (int) $DateTime->format('U') + (int) $offset;
330 329
 	}
331 330
 
332 331
 
@@ -341,17 +340,17 @@  discard block
 block discarded – undo
341 340
 	 * @param  string					$datetime_field_name 	the datetime fieldname to be manipulated
342 341
 	 * @return 	EE_Base_Class
343 342
 	 */
344
-	protected static function _set_date_time_field( EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name ) {
343
+	protected static function _set_date_time_field(EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name) {
345 344
 		// grab current datetime format
346 345
 		$current_format = $obj->get_format();
347 346
 		// set new full timestamp format
348
-		$obj->set_date_format( EE_Datetime_Field::mysql_date_format );
349
-		$obj->set_time_format( EE_Datetime_Field::mysql_time_format );
347
+		$obj->set_date_format(EE_Datetime_Field::mysql_date_format);
348
+		$obj->set_time_format(EE_Datetime_Field::mysql_time_format);
350 349
 		// set the new date value using a full timestamp format so that no data is lost
351
-		$obj->set( $datetime_field_name, $DateTime->format( EE_Datetime_Field::mysql_timestamp_format ) );
350
+		$obj->set($datetime_field_name, $DateTime->format(EE_Datetime_Field::mysql_timestamp_format));
352 351
 		// reset datetime formats
353
-		$obj->set_date_format( $current_format[0] );
354
-		$obj->set_time_format( $current_format[1] );
352
+		$obj->set_date_format($current_format[0]);
353
+		$obj->set_time_format($current_format[1]);
355 354
 		return $obj;
356 355
 	}
357 356
 
@@ -368,11 +367,11 @@  discard block
 block discarded – undo
368 367
 	 * @param  integer 	$value    what you want to increment the time by
369 368
 	 * @return EE_Base_Class		   return the EE_Base_Class object so right away you can do something with it (chaining)
370 369
 	 */
371
-	public static function date_time_add( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) {
370
+	public static function date_time_add(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) {
372 371
 		//get the raw UTC date.
373
-		$DateTime = $obj->get_DateTime_object( $datetime_field_name );
374
-		$DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value );
375
-		return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name );
372
+		$DateTime = $obj->get_DateTime_object($datetime_field_name);
373
+		$DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value);
374
+		return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name);
376 375
 	}
377 376
 
378 377
 
@@ -387,11 +386,11 @@  discard block
 block discarded – undo
387 386
 	 * @param int            $value
388 387
 	 * @return \EE_Base_Class
389 388
 	 */
390
-	public static function date_time_subtract( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) {
389
+	public static function date_time_subtract(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) {
391 390
 		//get the raw UTC date
392
-		$DateTime = $obj->get_DateTime_object( $datetime_field_name );
393
-		$DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value, '-' );
394
-		return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name );
391
+		$DateTime = $obj->get_DateTime_object($datetime_field_name);
392
+		$DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value, '-');
393
+		return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name);
395 394
 	}
396 395
 
397 396
 
@@ -404,44 +403,44 @@  discard block
 block discarded – undo
404 403
 	 * @return \DateTime return whatever type came in.
405 404
 	 * @throws \EE_Error
406 405
 	 */
407
-	protected static function _modify_datetime_object( DateTime $DateTime, $period = 'years', $value = 1, $operand = '+' ) {
408
-		if ( ! $DateTime instanceof DateTime ) {
406
+	protected static function _modify_datetime_object(DateTime $DateTime, $period = 'years', $value = 1, $operand = '+') {
407
+		if ( ! $DateTime instanceof DateTime) {
409 408
 			throw new EE_Error(
410 409
 				sprintf(
411
-					__( 'Expected a PHP DateTime object, but instead received %1$s', 'event_espresso' ),
412
-					print_r( $DateTime, true )
410
+					__('Expected a PHP DateTime object, but instead received %1$s', 'event_espresso'),
411
+					print_r($DateTime, true)
413 412
 				)
414 413
 			);
415 414
 		}
416
-		switch ( $period ) {
415
+		switch ($period) {
417 416
 			case 'years' :
418
-				$value = 'P' . $value . 'Y';
417
+				$value = 'P'.$value.'Y';
419 418
 				break;
420 419
 			case 'months' :
421
-				$value = 'P' . $value . 'M';
420
+				$value = 'P'.$value.'M';
422 421
 				break;
423 422
 			case 'weeks' :
424
-				$value = 'P' . $value . 'W';
423
+				$value = 'P'.$value.'W';
425 424
 				break;
426 425
 			case 'days' :
427
-				$value = 'P' . $value . 'D';
426
+				$value = 'P'.$value.'D';
428 427
 				break;
429 428
 			case 'hours' :
430
-				$value = 'PT' . $value . 'H';
429
+				$value = 'PT'.$value.'H';
431 430
 				break;
432 431
 			case 'minutes' :
433
-				$value = 'PT' . $value . 'M';
432
+				$value = 'PT'.$value.'M';
434 433
 				break;
435 434
 			case 'seconds' :
436
-				$value = 'PT' . $value . 'S';
435
+				$value = 'PT'.$value.'S';
437 436
 				break;
438 437
 		}
439
-		switch ( $operand ) {
438
+		switch ($operand) {
440 439
 			case '+':
441
-				$DateTime->add( new DateInterval( $value ) );
440
+				$DateTime->add(new DateInterval($value));
442 441
 				break;
443 442
 			case '-':
444
-				$DateTime->sub( new DateInterval( $value ) );
443
+				$DateTime->sub(new DateInterval($value));
445 444
 				break;
446 445
 		}
447 446
 		return $DateTime;
@@ -457,16 +456,16 @@  discard block
 block discarded – undo
457 456
 	 * @return \DateTime return whatever type came in.
458 457
 	 * @throws \EE_Error
459 458
 	 */
460
-	protected static function _modify_timestamp( $timestamp, $period = 'years', $value = 1, $operand = '+' ) {
461
-		if ( ! preg_match( EE_Datetime_Field::unix_timestamp_regex, $timestamp ) ) {
459
+	protected static function _modify_timestamp($timestamp, $period = 'years', $value = 1, $operand = '+') {
460
+		if ( ! preg_match(EE_Datetime_Field::unix_timestamp_regex, $timestamp)) {
462 461
 			throw new EE_Error(
463 462
 				sprintf(
464
-					__( 'Expected a Unix timestamp, but instead received %1$s', 'event_espresso' ),
465
-					print_r( $timestamp, true )
463
+					__('Expected a Unix timestamp, but instead received %1$s', 'event_espresso'),
464
+					print_r($timestamp, true)
466 465
 				)
467 466
 			);
468 467
 		}
469
-		switch ( $period ) {
468
+		switch ($period) {
470 469
 			case 'years' :
471 470
 				$value = YEAR_IN_SECONDS * $value;
472 471
 				break;
@@ -486,9 +485,9 @@  discard block
 block discarded – undo
486 485
 				$value = MINUTE_IN_SECONDS * $value;
487 486
 				break;
488 487
 		}
489
-		switch ( $operand ) {
488
+		switch ($operand) {
490 489
 			case '+':
491
-				$timestamp  += $value;
490
+				$timestamp += $value;
492 491
 				break;
493 492
 			case '-':
494 493
 				$timestamp -= $value;
@@ -508,11 +507,11 @@  discard block
 block discarded – undo
508 507
 	 * @param  string  $operand What operand you wish to use for the calculation
509 508
 	 * @return mixed string|DateTime          return whatever type came in.
510 509
 	 */
511
-	public static function calc_date( $DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+' ) {
512
-		if ( $DateTime_or_timestamp instanceof DateTime ) {
513
-			return EEH_DTT_Helper::_modify_datetime_object( $DateTime_or_timestamp, $period, $value, $operand );
514
-		} else if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp )) {
515
-			return EEH_DTT_Helper::_modify_timestamp( $DateTime_or_timestamp, $period, $value, $operand );
510
+	public static function calc_date($DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+') {
511
+		if ($DateTime_or_timestamp instanceof DateTime) {
512
+			return EEH_DTT_Helper::_modify_datetime_object($DateTime_or_timestamp, $period, $value, $operand);
513
+		} else if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp)) {
514
+			return EEH_DTT_Helper::_modify_timestamp($DateTime_or_timestamp, $period, $value, $operand);
516 515
 		} else {
517 516
 			//error
518 517
 			return $DateTime_or_timestamp;
@@ -542,24 +541,24 @@  discard block
 block discarded – undo
542 541
 	 * 			'moment' => //date and time format.
543 542
 	 * 		)
544 543
 	 */
545
-	public static function convert_php_to_js_and_moment_date_formats( $date_format_string = null, $time_format_string = null ) {
546
-		if ( $date_format_string === null ) {
547
-			$date_format_string = get_option( 'date_format' );
544
+	public static function convert_php_to_js_and_moment_date_formats($date_format_string = null, $time_format_string = null) {
545
+		if ($date_format_string === null) {
546
+			$date_format_string = get_option('date_format');
548 547
 		}
549 548
 
550
-		if ( $time_format_string === null ) {
551
-			$time_format_string = get_option( 'time_format' );
549
+		if ($time_format_string === null) {
550
+			$time_format_string = get_option('time_format');
552 551
 		}
553 552
 
554
-		$date_format = self::_php_to_js_moment_converter( $date_format_string );
555
-		$time_format = self::_php_to_js_moment_converter( $time_format_string );
553
+		$date_format = self::_php_to_js_moment_converter($date_format_string);
554
+		$time_format = self::_php_to_js_moment_converter($time_format_string);
556 555
 
557 556
 		return array(
558 557
 			'js' => array(
559 558
 				'date' => $date_format['js'],
560 559
 				'time' => $time_format['js']
561 560
 				),
562
-			'moment' => $date_format['moment'] . ' ' . $time_format['moment' ]
561
+			'moment' => $date_format['moment'].' '.$time_format['moment']
563 562
 			);
564 563
 	}
565 564
 
@@ -573,7 +572,7 @@  discard block
 block discarded – undo
573 572
 	 *
574 573
 	 * @return array js and moment formats.
575 574
 	 */
576
-	protected static function _php_to_js_moment_converter( $format_string ) {
575
+	protected static function _php_to_js_moment_converter($format_string) {
577 576
 		/**
578 577
 		 * This is a map of symbols for formats.
579 578
 		 * The index is the php symbol, the equivalent values are in the array.
@@ -730,15 +729,15 @@  discard block
 block discarded – undo
730 729
 		$jquery_ui_format = "";
731 730
 		$moment_format = "";
732 731
 		$escaping = false;
733
-		for ( $i = 0; $i < strlen($format_string); $i++ ) {
732
+		for ($i = 0; $i < strlen($format_string); $i++) {
734 733
 			$char = $format_string[$i];
735
-			if ( $char === '\\' )  { // PHP date format escaping character
734
+			if ($char === '\\') { // PHP date format escaping character
736 735
 				$i++;
737
-				if ( $escaping ) {
736
+				if ($escaping) {
738 737
 					$jquery_ui_format .= $format_string[$i];
739 738
 					$moment_format .= $format_string[$i];
740 739
 				} else {
741
-					$jquery_ui_format .= '\'' . $format_string[$i];
740
+					$jquery_ui_format .= '\''.$format_string[$i];
742 741
 					$moment_format .= $format_string[$i];
743 742
 				}
744 743
 				$escaping = true;
@@ -757,7 +756,7 @@  discard block
 block discarded – undo
757 756
 				}
758 757
 			}
759 758
 		}
760
-		return array( 'js' => $jquery_ui_format, 'moment' => $moment_format );
759
+		return array('js' => $jquery_ui_format, 'moment' => $moment_format);
761 760
 	}
762 761
 
763 762
 
@@ -772,25 +771,25 @@  discard block
 block discarded – undo
772 771
 	 *                           		errors is returned.  So for client code calling, check for is_array() to
773 772
 	 *                           		indicate failed validations.
774 773
 	 */
775
-	public static function validate_format_string( $format_string ) {
774
+	public static function validate_format_string($format_string) {
776 775
 		$error_msg = array();
777 776
 		//time format checks
778
-		switch ( true ) {
779
-			case   strpos( $format_string, 'h' )  !== false  :
780
-			case   strpos( $format_string, 'g' ) !== false :
777
+		switch (true) {
778
+			case   strpos($format_string, 'h') !== false  :
779
+			case   strpos($format_string, 'g') !== false :
781 780
 				/**
782 781
 				 * if the time string has a lowercase 'h' which == 12 hour time format and there
783 782
 				 * is not any ante meridiem format ('a' or 'A').  Then throw an error because its
784 783
 				 * too ambiguous and PHP won't be able to figure out whether 1 = 1pm or 1am.
785 784
 				 */
786
-				if ( strpos( strtoupper( $format_string ), 'A' )  === false ) {
787
-					$error_msg[] = __('There is a  time format for 12 hour time but no  "a" or "A" to indicate am/pm.  Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso' );
785
+				if (strpos(strtoupper($format_string), 'A') === false) {
786
+					$error_msg[] = __('There is a  time format for 12 hour time but no  "a" or "A" to indicate am/pm.  Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso');
788 787
 				}
789 788
 				break;
790 789
 
791 790
 		}
792 791
 
793
-		return empty( $error_msg ) ? true : $error_msg;
792
+		return empty($error_msg) ? true : $error_msg;
794 793
 	}
795 794
 
796 795
 
@@ -812,11 +811,11 @@  discard block
 block discarded – undo
812 811
 	 * @param mixed $date_2
813 812
 	 * @return bool
814 813
 	 */
815
-	public static function dates_represent_one_24_hour_date( $date_1, $date_2 ) {
814
+	public static function dates_represent_one_24_hour_date($date_1, $date_2) {
816 815
 
817 816
 		if (
818
-			( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime ) ||
819
-			( $date_1->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' || $date_2->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' )
817
+			( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime) ||
818
+			($date_1->format(EE_Datetime_Field::mysql_time_format) != '00:00:00' || $date_2->format(EE_Datetime_Field::mysql_time_format) != '00:00:00')
820 819
 		) {
821 820
 			return false;
822 821
 		}
@@ -833,11 +832,11 @@  discard block
 block discarded – undo
833 832
 	 * @param string $field_for_interval  The Database field that is the interval is applied to in the query.
834 833
 	 * @return string
835 834
 	 */
836
-	public static function get_sql_query_interval_for_offset( $timezone_string, $field_for_interval ) {
835
+	public static function get_sql_query_interval_for_offset($timezone_string, $field_for_interval) {
837 836
 		try {
838 837
 			/** need to account for timezone offset on the selects */
839
-			$DateTimeZone = new DateTimeZone( $timezone_string );
840
-		} catch ( Exception $e ) {
838
+			$DateTimeZone = new DateTimeZone($timezone_string);
839
+		} catch (Exception $e) {
841 840
 			$DateTimeZone = null;
842 841
 		}
843 842
 
@@ -845,10 +844,10 @@  discard block
 block discarded – undo
845 844
 		 * Note get_option( 'gmt_offset') returns a value in hours, whereas DateTimeZone::getOffset returns values in seconds.
846 845
 		 * Hence we do the calc for DateTimeZone::getOffset.
847 846
 		 */
848
-		$offset = $DateTimeZone instanceof DateTimeZone ? ( $DateTimeZone->getOffset( new DateTime('now') ) ) / HOUR_IN_SECONDS : get_option( 'gmt_offset' );
847
+		$offset = $DateTimeZone instanceof DateTimeZone ? ($DateTimeZone->getOffset(new DateTime('now'))) / HOUR_IN_SECONDS : get_option('gmt_offset');
849 848
 		$query_interval = $offset < 0
850
-			? 'DATE_SUB(' . $field_for_interval . ', INTERVAL ' . $offset*-1 . ' HOUR)'
851
-			: 'DATE_ADD(' . $field_for_interval .', INTERVAL ' . $offset . ' HOUR)';
849
+			? 'DATE_SUB('.$field_for_interval.', INTERVAL '.$offset * -1.' HOUR)'
850
+			: 'DATE_ADD('.$field_for_interval.', INTERVAL '.$offset.' HOUR)';
852 851
 		return $query_interval;
853 852
 	}
854 853
 
Please login to merge, or discard this patch.
core/helpers/EEH_Form_Fields.helper.php 1 patch
Spacing   +378 added lines, -378 removed lines patch added patch discarded remove patch
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 	 * 	@return string
70 70
 	 * 	@todo: at some point we can break this down into other static methods to abstract it a bit better.
71 71
 	 */
72
-	static public function get_form_fields( $input_vars = array(), $id = FALSE ) {
72
+	static public function get_form_fields($input_vars = array(), $id = FALSE) {
73 73
 		
74
-		if ( empty($input_vars) ) {
75
-			EE_Error::add_error( __('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
74
+		if (empty($input_vars)) {
75
+			EE_Error::add_error(__('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
76 76
 			return FALSE;
77 77
 		}
78 78
 
@@ -98,25 +98,25 @@  discard block
 block discarded – undo
98 98
 				'append_content' => ''
99 99
 				);
100 100
 
101
-			$input_value = wp_parse_args( $input_value, $defaults );
101
+			$input_value = wp_parse_args($input_value, $defaults);
102 102
 
103 103
 			// required fields get a *
104 104
 			$required = isset($input_value['required']) && $input_value['required'] ? ' <span>*</span>: ' : ': ';
105 105
 			// and the css class "required"
106
-			$css_class = isset( $input_value['css_class'] ) ? $input_value['css_class'] : '';
107
-			$styles = $input_value['required'] ? 'required ' . $css_class : $css_class;
106
+			$css_class = isset($input_value['css_class']) ? $input_value['css_class'] : '';
107
+			$styles = $input_value['required'] ? 'required '.$css_class : $css_class;
108 108
 
109
-			$field_id = ($id) ? $id . '-' . $input_key : $input_key;
110
-			$tabindex = !empty($input_value['tabindex']) ? ' tabindex="' . $input_value['tabindex'] . '"' : '';
109
+			$field_id = ($id) ? $id.'-'.$input_key : $input_key;
110
+			$tabindex = ! empty($input_value['tabindex']) ? ' tabindex="'.$input_value['tabindex'].'"' : '';
111 111
 
112 112
 			//rows or cols?
113
-			$rows = isset($input_value['rows'] ) ? $input_value['rows'] : '10';
114
-			$cols = isset($input_value['cols'] ) ? $input_value['cols'] : '80';
113
+			$rows = isset($input_value['rows']) ? $input_value['rows'] : '10';
114
+			$cols = isset($input_value['cols']) ? $input_value['cols'] : '80';
115 115
 
116 116
 			//any content?
117 117
 			$append_content = $input_value['append_content'];
118 118
 
119
-			$output .= (!$close) ? '<ul>' : '';
119
+			$output .= ( ! $close) ? '<ul>' : '';
120 120
 			$output .= '<li>';
121 121
 
122 122
 			// what type of input are we dealing with ?
@@ -124,15 +124,15 @@  discard block
 block discarded – undo
124 124
 
125 125
 				// text inputs
126 126
 				case 'text' :
127
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
128
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" class="' . $styles . '" type="text" value="' . $input_value['value'] . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
127
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
128
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" class="'.$styles.'" type="text" value="'.$input_value['value'].'" name="'.$input_value['name'].'"'.$tabindex.'>';
129 129
 					break;
130 130
 
131 131
 				// dropdowns
132 132
 				case 'select' :
133 133
 
134
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
135
-					$output .= "\n\t\t\t" . '<select id="' . $field_id . '" class="' . $styles . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
134
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
135
+					$output .= "\n\t\t\t".'<select id="'.$field_id.'" class="'.$styles.'" name="'.$input_value['name'].'"'.$tabindex.'>';
136 136
 
137 137
 					if (is_array($input_value['options'])) {
138 138
 						$options = $input_value['options'];
@@ -141,30 +141,30 @@  discard block
 block discarded – undo
141 141
 					}
142 142
 
143 143
 					foreach ($options as $key => $value) {
144
-						$selected = isset( $input_value['value'] ) && $input_value['value'] == $key ? 'selected=selected' : '';
144
+						$selected = isset($input_value['value']) && $input_value['value'] == $key ? 'selected=selected' : '';
145 145
 						//$key = str_replace( ' ', '_', sanitize_key( $value ));
146
-						$output .= "\n\t\t\t\t" . '<option '. $selected . ' value="' . $key . '">' . $value . '</option>';
146
+						$output .= "\n\t\t\t\t".'<option '.$selected.' value="'.$key.'">'.$value.'</option>';
147 147
 					}
148
-					$output .= "\n\t\t\t" . '</select>';
148
+					$output .= "\n\t\t\t".'</select>';
149 149
 
150 150
 					break;
151 151
 
152 152
 				case 'textarea' :
153 153
 
154
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
155
-					$output .= "\n\t\t\t" . '<textarea id="' . $field_id . '" class="' . $styles . '" rows="'.$rows.'" cols="'.$cols.'" name="' . $input_value['name'] . '"' . $tabindex . '>' . $input_value['value'] . '</textarea>';
154
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
155
+					$output .= "\n\t\t\t".'<textarea id="'.$field_id.'" class="'.$styles.'" rows="'.$rows.'" cols="'.$cols.'" name="'.$input_value['name'].'"'.$tabindex.'>'.$input_value['value'].'</textarea>';
156 156
 					break;
157 157
 
158 158
 				case 'hidden' :
159 159
 					$close = false;
160 160
 					$output .= "</li></ul>";
161
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" type="hidden" name="' . $input_value['name'] . '" value="' . $input_value['value'] . '">';
161
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="hidden" name="'.$input_value['name'].'" value="'.$input_value['value'].'">';
162 162
 					break;
163 163
 
164 164
 				case 'checkbox' :
165
-					$checked = ( $input_value['value'] == 1 ) ? 'checked="checked"' : '';
166
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
167
-					$output .= "\n\t\t\t" . '<input id="' . $field_id. '" type="checkbox" name="' . $input_value['name'] . '" value="1"' . $checked . $tabindex . ' />';
165
+					$checked = ($input_value['value'] == 1) ? 'checked="checked"' : '';
166
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
167
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="checkbox" name="'.$input_value['name'].'" value="1"'.$checked.$tabindex.' />';
168 168
 					break;
169 169
 
170 170
 				case 'wp_editor' :
@@ -177,19 +177,19 @@  discard block
 block discarded – undo
177 177
 					);
178 178
 					$output .= '</li>';
179 179
 					$output .= '</ul>';
180
-					$output .= '<h4>' . $input_value['label'] . '</h4>';
181
-					if ( $append_content ) {
180
+					$output .= '<h4>'.$input_value['label'].'</h4>';
181
+					if ($append_content) {
182 182
 						$output .= $append_content;
183 183
 					}
184 184
 					ob_start();
185
-					wp_editor( $input_value['value'], $field_id, $editor_settings);
185
+					wp_editor($input_value['value'], $field_id, $editor_settings);
186 186
 					$editor = ob_get_contents();
187 187
 					ob_end_clean();
188 188
 					$output .= $editor;
189 189
 					break;
190 190
 
191 191
 				}
192
-				if ( $append_content && $input_value['input'] !== 'wp_editor' ) {
192
+				if ($append_content && $input_value['input'] !== 'wp_editor') {
193 193
 					$output .= $append_content;
194 194
 				}
195 195
 				$output .= ($close) ? '</li>' : '';
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		$form_fields = array();
231 231
 		$fields = (array) $fields;
232 232
 
233
-		foreach ( $fields as $field_name => $field_atts ) {
233
+		foreach ($fields as $field_name => $field_atts) {
234 234
 			//defaults:
235 235
 			$defaults = array(
236 236
 				'label' => '',
@@ -248,67 +248,67 @@  discard block
 block discarded – undo
248 248
 				'wpeditor_args' => array()
249 249
 				);
250 250
 			// merge defaults with passed arguments
251
-			$_fields = wp_parse_args( $field_atts, $defaults);
252
-			extract( $_fields );
251
+			$_fields = wp_parse_args($field_atts, $defaults);
252
+			extract($_fields);
253 253
 			// generate label
254
-			$label = empty($label) ? '' : '<label for="' . $id . '">' . $label . '</label>';
254
+			$label = empty($label) ? '' : '<label for="'.$id.'">'.$label.'</label>';
255 255
 			// generate field name
256
-			$f_name = !empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name;
256
+			$f_name = ! empty($unique_id) ? $field_name.'['.$unique_id.']' : $field_name;
257 257
 
258 258
 			//tabindex
259
-			$tabindex_str = !empty( $tabindex ) ? ' tabindex="' . $tabindex . '"' : '';
259
+			$tabindex_str = ! empty($tabindex) ? ' tabindex="'.$tabindex.'"' : '';
260 260
 
261 261
 			//we determine what we're building based on the type
262
-			switch ( $type ) {
262
+			switch ($type) {
263 263
 
264 264
 				case 'textarea' :
265
-						$fld = '<textarea id="' . $id . '" class="' . $class . '" rows="' . $dimensions[1] . '" cols="' . $dimensions[0] . '" name="' . $f_name . '"' . $tabindex_str . '>' . $value . '</textarea>';
265
+						$fld = '<textarea id="'.$id.'" class="'.$class.'" rows="'.$dimensions[1].'" cols="'.$dimensions[0].'" name="'.$f_name.'"'.$tabindex_str.'>'.$value.'</textarea>';
266 266
 						$fld .= $extra_desc;
267 267
 					break;
268 268
 
269 269
 				case 'checkbox' :
270 270
 						$c_input = '';
271
-						if ( is_array($value) ) {
272
-							foreach ( $value as $key => $val ) {
273
-								$c_id = $field_name . '_' . $value;
274
-								$c_class = isset($classes[$key]) ? ' class="' . $classes[$key] . '" ' : '';
275
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
276
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
277
-								$c_input .= '<input name="' . $f_name . '[]" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
271
+						if (is_array($value)) {
272
+							foreach ($value as $key => $val) {
273
+								$c_id = $field_name.'_'.$value;
274
+								$c_class = isset($classes[$key]) ? ' class="'.$classes[$key].'" ' : '';
275
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
276
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
277
+								$c_input .= '<input name="'.$f_name.'[]" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
278 278
 							}
279 279
 							$fld = $c_input;
280 280
 						} else {
281
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
282
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
281
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
282
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
283 283
 						}
284 284
 					break;
285 285
 
286 286
 				case 'radio' :
287 287
 						$c_input = '';
288
-						if ( is_array($value) ) {
289
-							foreach ( $value as $key => $val ) {
290
-								$c_id = $field_name . '_' . $value;
291
-								$c_class = isset($classes[$key]) ? 'class="' . $classes[$key] . '" ' : '';
292
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
293
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
294
-								$c_input .= '<input name="' . $f_name . '" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
288
+						if (is_array($value)) {
289
+							foreach ($value as $key => $val) {
290
+								$c_id = $field_name.'_'.$value;
291
+								$c_class = isset($classes[$key]) ? 'class="'.$classes[$key].'" ' : '';
292
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
293
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
294
+								$c_input .= '<input name="'.$f_name.'" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
295 295
 							}
296 296
 							$fld = $c_input;
297 297
 						} else {
298
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
299
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
298
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
299
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
300 300
 						}
301 301
 					break;
302 302
 
303 303
 				case 'hidden' :
304
-						$fld = '<input name="' . $f_name . '" type="hidden" id="' . $id . '" class="' . $class . '" value="' . $value . '" />' . "\n";
304
+						$fld = '<input name="'.$f_name.'" type="hidden" id="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n";
305 305
 					break;
306 306
 
307 307
 				case 'select' :
308
-						$fld = '<select name="' . $f_name . '" class="' . $class . '" id="' . $id . '"' . $tabindex_str . '>' . "\n";
309
-						foreach ( $value as $key => $val ) {
310
-							$checked = !empty($default) && $default == $val ? ' selected="selected"' : '';
311
-							$fld .= "\t" . '<option value="' . $val . '"' . $checked . '>' . $labels[$key] . '</option>' . "\n";
308
+						$fld = '<select name="'.$f_name.'" class="'.$class.'" id="'.$id.'"'.$tabindex_str.'>'."\n";
309
+						foreach ($value as $key => $val) {
310
+							$checked = ! empty($default) && $default == $val ? ' selected="selected"' : '';
311
+							$fld .= "\t".'<option value="'.$val.'"'.$checked.'>'.$labels[$key].'</option>'."\n";
312 312
 						}
313 313
 						$fld .= '</select>';
314 314
 					break;
@@ -320,21 +320,21 @@  discard block
 block discarded – undo
320 320
 							'editor_class' => $class,
321 321
 							'tabindex' => $tabindex
322 322
 							);
323
-						$editor_settings = array_merge( $wpeditor_args, $editor_settings );
323
+						$editor_settings = array_merge($wpeditor_args, $editor_settings);
324 324
 						ob_start();
325
-						wp_editor( $value, $id, $editor_settings );
325
+						wp_editor($value, $id, $editor_settings);
326 326
 						$editor = ob_get_contents();
327 327
 						ob_end_clean();
328 328
 						$fld = $editor;
329 329
 					break;
330 330
 
331 331
 				default : //'text fields'
332
-						$fld = '<input name="' . $f_name . '" type="text" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $tabindex_str . ' />' . "\n";
332
+						$fld = '<input name="'.$f_name.'" type="text" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$tabindex_str.' />'."\n";
333 333
 						$fld .= $extra_desc;
334 334
 
335 335
 			}
336 336
 
337
-			$form_fields[ $field_name ] = array( 'label' => $label, 'field' => $fld );
337
+			$form_fields[$field_name] = array('label' => $label, 'field' => $fld);
338 338
 		}
339 339
 
340 340
 		return $form_fields;
@@ -363,22 +363,22 @@  discard block
 block discarded – undo
363 363
 	 */
364 364
 	static public function select_input($name, $values, $default = '', $parameters = '', $class = '', $autosize = true) {
365 365
 		//if $values was submitted in the wrong format, convert it over
366
-		if(!empty($values) && (!array_key_exists(0,$values) || !is_array($values[0]))){
367
-			$converted_values=array();
368
-			foreach($values as $id=>$text){
369
-				$converted_values[]=array('id'=>$id,'text'=>$text);
366
+		if ( ! empty($values) && ( ! array_key_exists(0, $values) || ! is_array($values[0]))) {
367
+			$converted_values = array();
368
+			foreach ($values as $id=>$text) {
369
+				$converted_values[] = array('id'=>$id, 'text'=>$text);
370 370
 			}
371
-			$values=$converted_values;
371
+			$values = $converted_values;
372 372
 		}
373 373
 		//load formatter helper
374
-		EE_Registry::instance()->load_helper( 'Formatter' );
374
+		EE_Registry::instance()->load_helper('Formatter');
375 375
 		//EE_Registry::instance()->load_helper( 'Formatter' );
376 376
 
377
-		$field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"';
377
+		$field = '<select id="'.EEH_Formatter::ee_tep_output_string($name).'" name="'.EEH_Formatter::ee_tep_output_string($name).'"';
378 378
 		//Debug
379 379
 		//EEH_Debug_Tools::printr( $values, '$values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
380
-		if ( EEH_Formatter::ee_tep_not_null($parameters))
381
-			$field .= ' ' . $parameters;
380
+		if (EEH_Formatter::ee_tep_not_null($parameters))
381
+			$field .= ' '.$parameters;
382 382
 		if ($autosize) {
383 383
 			$size = 'med';
384 384
 			for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) {
@@ -391,21 +391,21 @@  discard block
 block discarded – undo
391 391
 			$size = '';
392 392
 		}
393 393
 
394
-		$field .= ' class="' . $class . ' ' . $size . '">';
394
+		$field .= ' class="'.$class.' '.$size.'">';
395 395
 
396 396
 		if (empty($default) && isset($GLOBALS[$name]))
397 397
 			$default = stripslashes($GLOBALS[$name]);
398 398
 
399 399
 
400 400
 		for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
401
-			$field .= '<option value="' . $values[$i]['id'] . '"';
401
+			$field .= '<option value="'.$values[$i]['id'].'"';
402 402
 			if ($default == $values[$i]['id']) {
403 403
 				$field .= ' selected = "selected"';
404 404
 			}
405
-			if ( isset( $values[$i]['class'] ) ) {
406
-				$field .= ' class="' . $values[$i]['class'] . '"';
405
+			if (isset($values[$i]['class'])) {
406
+				$field .= ' class="'.$values[$i]['class'].'"';
407 407
 			}
408
-			$field .= '>' . $values[$i]['text'] . '</option>';
408
+			$field .= '>'.$values[$i]['text'].'</option>';
409 409
 		}
410 410
 		$field .= '</select>';
411 411
 
@@ -423,38 +423,38 @@  discard block
 block discarded – undo
423 423
 	 * @param string $question_groups
424 424
 	 * @return string HTML
425 425
 	 */
426
-	static function generate_question_groups_html( $question_groups = array(), $group_wrapper = 'fieldset' ) {
426
+	static function generate_question_groups_html($question_groups = array(), $group_wrapper = 'fieldset') {
427 427
 
428 428
 		$html = '';
429
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
430
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
429
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
430
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
431 431
 
432
-		if ( ! empty( $question_groups )) {
432
+		if ( ! empty($question_groups)) {
433 433
 			//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
434 434
 			// loop thru question groups
435
-			foreach ( $question_groups as $QSG ) {
435
+			foreach ($question_groups as $QSG) {
436 436
 				// check that questions exist
437
-				if ( ! empty( $QSG['QSG_questions'] )) {
437
+				if ( ! empty($QSG['QSG_questions'])) {
438 438
 					// use fieldsets
439
-					$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG['QSG_identifier'] . '">';
439
+					$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG['QSG_identifier'].'">';
440 440
 					// group_name
441
-					$html .= $QSG['QSG_show_group_name'] ? "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . self::prep_answer( $QSG['QSG_name'] ) . '</h5>' : '';
441
+					$html .= $QSG['QSG_show_group_name'] ? "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.self::prep_answer($QSG['QSG_name']).'</h5>' : '';
442 442
 					// group_desc
443
-					$html .= $QSG['QSG_show_group_desc'] && ! empty( $QSG['QSG_desc'] ) ? '<div class="espresso-question-group-desc-pg">' . self::prep_answer( $QSG['QSG_desc'] ) . '</div>' : '';
443
+					$html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc']) ? '<div class="espresso-question-group-desc-pg">'.self::prep_answer($QSG['QSG_desc']).'</div>' : '';
444 444
 
445 445
 					$html .= $before_question_group_questions;
446 446
 					// loop thru questions
447
-					foreach ( $QSG['QSG_questions'] as $question ) {
447
+					foreach ($QSG['QSG_questions'] as $question) {
448 448
 //						EEH_Debug_Tools::printr( $question, '$question  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
449 449
 						$QFI = new EE_Question_Form_Input(
450 450
 							$question['qst_obj'],
451 451
 							$question['ans_obj'],
452 452
 							$question
453 453
 						);
454
-						$html .= self::generate_form_input( $QFI );
454
+						$html .= self::generate_form_input($QFI);
455 455
 					}
456 456
 					$html .= $after_question_group_questions;
457
-					$html .= "\n\t" . '</' . $group_wrapper . '>';
457
+					$html .= "\n\t".'</'.$group_wrapper.'>';
458 458
 				}
459 459
 			}
460 460
 		}
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 	 * @param string       $group_wrapper
475 475
 	 * @return string HTML
476 476
 	 */
477
-	static function generate_question_groups_html2( $question_groups = array(), $q_meta = array(), 	$from_admin = FALSE, $group_wrapper = 'fieldset' ) {
477
+	static function generate_question_groups_html2($question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset') {
478 478
 
479 479
 		$html = '';
480
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
481
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
480
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
481
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
482 482
 
483 483
 		$default_q_meta = array(
484 484
 				'att_nmbr' => 1,
@@ -487,55 +487,55 @@  discard block
 block discarded – undo
487 487
 				'input_id' => '',
488 488
 				'input_class' => ''
489 489
 		);
490
-		$q_meta = array_merge( $default_q_meta, $q_meta );
490
+		$q_meta = array_merge($default_q_meta, $q_meta);
491 491
 		//EEH_Debug_Tools::printr( $q_meta, '$q_meta  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
492 492
 
493
-		if ( ! empty( $question_groups )) {
493
+		if ( ! empty($question_groups)) {
494 494
 //			EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
495 495
 			// loop thru question groups
496
-			foreach ( $question_groups as $QSG ) {
497
-				if ( $QSG instanceof EE_Question_Group ) {
496
+			foreach ($question_groups as $QSG) {
497
+				if ($QSG instanceof EE_Question_Group) {
498 498
 					// check that questions exist
499 499
 
500
-					$where = array( 'QST_deleted' => 0 );
501
-					if ( ! $from_admin ) {
500
+					$where = array('QST_deleted' => 0);
501
+					if ( ! $from_admin) {
502 502
 						$where['QST_admin_only'] = 0;
503 503
 					}
504
-					$questions = $QSG->questions( array( $where, 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' )));
505
-					if ( ! empty( $questions )) {
504
+					$questions = $QSG->questions(array($where, 'order_by' => array('Question_Group_Question.QGQ_order' => 'ASC')));
505
+					if ( ! empty($questions)) {
506 506
 						// use fieldsets
507
-						$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG->get( 'QSG_identifier' ) . '">';
507
+						$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG->get('QSG_identifier').'">';
508 508
 						// group_name
509
-						if ( $QSG->show_group_name() ) {
510
-							$html .=  "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . $QSG->get_pretty( 'QSG_name' ) . '</h5>';
509
+						if ($QSG->show_group_name()) {
510
+							$html .= "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.$QSG->get_pretty('QSG_name').'</h5>';
511 511
 						}
512 512
 						// group_desc
513
-						if ( $QSG->show_group_desc() ) {
514
-							$html .=  '<div class="espresso-question-group-desc-pg">' . $QSG->get_pretty( 'QSG_desc'  ) . '</div>';
513
+						if ($QSG->show_group_desc()) {
514
+							$html .= '<div class="espresso-question-group-desc-pg">'.$QSG->get_pretty('QSG_desc').'</div>';
515 515
 						}
516 516
 
517 517
 						$html .= $before_question_group_questions;
518 518
 						// loop thru questions
519
-						foreach ( $questions as $QST ) {
519
+						foreach ($questions as $QST) {
520 520
 							$qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID();
521 521
 
522 522
 							$answer = NULL;
523 523
 
524
-							if (  isset( $_GET['qstn'] ) && isset( $q_meta['input_id'] ) && isset( $q_meta['att_nmbr'] )) {
524
+							if (isset($_GET['qstn']) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) {
525 525
 								// check for answer in $_GET in case we are reprocessing a form after an error
526
-								if ( isset( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] )) {
527
-									$answer = is_array( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] ) ? $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] : sanitize_text_field( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] );
526
+								if (isset($_GET['qstn'][$q_meta['input_id']][$qstn_id])) {
527
+									$answer = is_array($_GET['qstn'][$q_meta['input_id']][$qstn_id]) ? $_GET['qstn'][$q_meta['input_id']][$qstn_id] : sanitize_text_field($_GET['qstn'][$q_meta['input_id']][$qstn_id]);
528 528
 								}
529
-							} else if ( isset( $q_meta['attendee'] ) && $q_meta['attendee'] ) {
529
+							} else if (isset($q_meta['attendee']) && $q_meta['attendee']) {
530 530
 								//attendee data from the session
531
-								$answer = isset( $q_meta['attendee'][ $qstn_id ] ) ? $q_meta['attendee'][ $qstn_id ] : NULL;
531
+								$answer = isset($q_meta['attendee'][$qstn_id]) ? $q_meta['attendee'][$qstn_id] : NULL;
532 532
 							}
533 533
 
534 534
 
535 535
 
536 536
 							$QFI = new EE_Question_Form_Input(
537 537
 									$QST,
538
-									EE_Answer::new_instance ( array(
538
+									EE_Answer::new_instance(array(
539 539
 											'ANS_ID'=> 0,
540 540
 											'QST_ID'=> 0,
541 541
 											'REG_ID'=> 0,
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 									$q_meta
545 545
 							);
546 546
 							//EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
547
-							$html .= self::generate_form_input( $QFI );
547
+							$html .= self::generate_form_input($QFI);
548 548
 						}
549 549
 						$html .= $after_question_group_questions;
550
-						$html .= "\n\t" . '</' . $group_wrapper . '>';
550
+						$html .= "\n\t".'</'.$group_wrapper.'>';
551 551
 					}
552 552
 				}
553 553
 			}
@@ -567,63 +567,63 @@  discard block
 block discarded – undo
567 567
 	 * @param EE_Question_Form_Input $QFI
568 568
 	 * @return string HTML
569 569
 	 */
570
-	static function generate_form_input( EE_Question_Form_Input $QFI ) {
571
-		if ( isset( $QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin() ) {
570
+	static function generate_form_input(EE_Question_Form_Input $QFI) {
571
+		if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) {
572 572
 			return '';
573 573
 		}
574 574
 
575
-		$QFI = self::_load_system_dropdowns( $QFI );
576
-		$QFI = self::_load_specialized_dropdowns( $QFI );
575
+		$QFI = self::_load_system_dropdowns($QFI);
576
+		$QFI = self::_load_specialized_dropdowns($QFI);
577 577
 
578 578
 		//we also need to verify
579 579
 
580 580
 		$display_text = $QFI->get('QST_display_text');
581 581
 		$input_name = $QFI->get('QST_input_name');
582
-		$answer = EE_Registry::instance()->REQ->is_set( $input_name ) ? EE_Registry::instance()->REQ->get( $input_name ) : $QFI->get('ANS_value');
582
+		$answer = EE_Registry::instance()->REQ->is_set($input_name) ? EE_Registry::instance()->REQ->get($input_name) : $QFI->get('ANS_value');
583 583
 		$input_id = $QFI->get('QST_input_id');
584 584
 		$input_class = $QFI->get('QST_input_class');
585 585
 //		$disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : '';
586 586
 		$disabled = $QFI->get('QST_disabled') ? TRUE : FALSE;
587
-		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>' );
587
+		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>');
588 588
 		$QST_required = $QFI->get('QST_required');
589
-		$required = $QST_required ? array( 'label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required ) : array();
590
-		$use_html_entities = $QFI->get_meta( 'htmlentities' );
591
-		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __( 'This field is required', 'event_espresso' );
592
-		$required_text = $QST_required ? "\n\t\t\t" . '<div class="required-text hidden">' . self::prep_answer( $required_text, $use_html_entities ) . '</div>' : '';
589
+		$required = $QST_required ? array('label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required) : array();
590
+		$use_html_entities = $QFI->get_meta('htmlentities');
591
+		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __('This field is required', 'event_espresso');
592
+		$required_text = $QST_required ? "\n\t\t\t".'<div class="required-text hidden">'.self::prep_answer($required_text, $use_html_entities).'</div>' : '';
593 593
 		$label_class = 'espresso-form-input-lbl';
594
-		$QST_options = $QFI->options(true,$answer);
595
-		$options = is_array( $QST_options ) ? self::prep_answer_options( $QST_options ) : array();
594
+		$QST_options = $QFI->options(true, $answer);
595
+		$options = is_array($QST_options) ? self::prep_answer_options($QST_options) : array();
596 596
 		$system_ID = $QFI->get('QST_system');
597
-		$label_b4 = $QFI->get_meta( 'label_b4' );
598
-		$use_desc_4_label = $QFI->get_meta( 'use_desc_4_label' );
597
+		$label_b4 = $QFI->get_meta('label_b4');
598
+		$use_desc_4_label = $QFI->get_meta('use_desc_4_label');
599 599
 
600 600
 
601
-		switch ( $QFI->get('QST_type') ){
601
+		switch ($QFI->get('QST_type')) {
602 602
 
603 603
 			case 'TEXTAREA' :
604
-					return EEH_Form_Fields::textarea( $display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
604
+					return EEH_Form_Fields::textarea($display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
605 605
 				break;
606 606
 
607 607
 			case 'DROPDOWN' :
608
-					return EEH_Form_Fields::select( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE );
608
+					return EEH_Form_Fields::select($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE);
609 609
 				break;
610 610
 
611 611
 
612 612
 			case 'RADIO_BTN' :
613
-					return EEH_Form_Fields::radio( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label );
613
+					return EEH_Form_Fields::radio($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label);
614 614
 				break;
615 615
 
616 616
 			case 'CHECKBOX' :
617
-					return EEH_Form_Fields::checkbox( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities );
617
+					return EEH_Form_Fields::checkbox($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities);
618 618
 				break;
619 619
 
620 620
 			case 'DATE' :
621
-					return EEH_Form_Fields::datepicker( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
621
+					return EEH_Form_Fields::datepicker($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
622 622
 				break;
623 623
 
624 624
 			case 'TEXT' :
625 625
 			default:
626
-					return EEH_Form_Fields::text( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
626
+					return EEH_Form_Fields::text($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
627 627
 				break;
628 628
 
629 629
 		}
@@ -649,31 +649,31 @@  discard block
 block discarded – undo
649 649
 	 * @param string $disabled 		disabled="disabled" or null
650 650
 	 * @return string HTML
651 651
 	 */
652
-	static function text( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
652
+	static function text($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
653 653
 		// need these
654
-		if ( ! $question || ! $name ) {
654
+		if ( ! $question || ! $name) {
655 655
 			return NULL;
656 656
 		}
657 657
 		// prep the answer
658
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
658
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
659 659
 		// prep the required array
660
-		$required = self::prep_required( $required );
660
+		$required = self::prep_required($required);
661 661
 		// set disabled tag
662
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
662
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
663 663
 		// ya gots ta have style man!!!
664 664
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp';
665
-		$class = empty( $class ) ? $txt_class : $class;
666
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
667
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
665
+		$class = empty($class) ? $txt_class : $class;
666
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
667
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
668 668
 
669
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
669
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
670 670
 		// filter label but ensure required text comes before it
671
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
671
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
672 672
 
673
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" value="' . esc_attr( $answer ) . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled .' ' . $extra . '/>';
673
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" value="'.esc_attr($answer).'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
674 674
 
675
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
676
-		return  $label_html . $input_html;
675
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
676
+		return  $label_html.$input_html;
677 677
 
678 678
 	}
679 679
 
@@ -695,35 +695,35 @@  discard block
 block discarded – undo
695 695
 	 * @param string $disabled 		disabled="disabled" or null
696 696
 	 * @return string HTML
697 697
 	 */
698
-	static function textarea( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
698
+	static function textarea($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
699 699
 		// need these
700
-		if ( ! $question || ! $name ) {
700
+		if ( ! $question || ! $name) {
701 701
 			return NULL;
702 702
 		}
703 703
 		// prep the answer
704
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
704
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
705 705
 		// prep the required array
706
-		$required = self::prep_required( $required );
706
+		$required = self::prep_required($required);
707 707
 		// make sure $dimensions is an array
708
-		$dimensions = is_array( $dimensions ) ? $dimensions : array();
708
+		$dimensions = is_array($dimensions) ? $dimensions : array();
709 709
 		// and set some defaults
710
-		$dimensions = array_merge( array( 'rows' => 3, 'cols' => 40 ), $dimensions );
710
+		$dimensions = array_merge(array('rows' => 3, 'cols' => 40), $dimensions);
711 711
 		// set disabled tag
712
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
712
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
713 713
 		// ya gots ta have style man!!!
714 714
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-textarea-inp';
715
-		$class = empty( $class ) ? $txt_class : $class;
716
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
717
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
715
+		$class = empty($class) ? $txt_class : $class;
716
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
717
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
718 718
 
719
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
719
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
720 720
 		// filter label but ensure required text comes before it
721
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
721
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
722 722
 
723
-		$input_html = "\n\t\t\t" . '<textarea name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" rows="' . $dimensions['rows'] . '" cols="' . $dimensions['cols'] . '"  title="' . $required['msg'] . '" ' . $disabled . ' ' . $extra . '>' . $answer . '</textarea>';
723
+		$input_html = "\n\t\t\t".'<textarea name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" rows="'.$dimensions['rows'].'" cols="'.$dimensions['cols'].'"  title="'.$required['msg'].'" '.$disabled.' '.$extra.'>'.$answer.'</textarea>';
724 724
 
725
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
726
-		return  $label_html . $input_html;
725
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
726
+		return  $label_html.$input_html;
727 727
 
728 728
 	}
729 729
 
@@ -746,47 +746,47 @@  discard block
 block discarded – undo
746 746
 	 * @param string $disabled 		disabled="disabled" or null
747 747
 	 * @return string HTML
748 748
 	 */
749
-	static function select( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE ) {
749
+	static function select($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE) {
750 750
 
751 751
 		// need these
752
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
752
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
753 753
 			return NULL;
754 754
 		}
755 755
 		// prep the answer
756
-		$answer = is_array( $answer ) ? self::prep_answer( array_shift( $answer ), $use_html_entities) : self::prep_answer( $answer, $use_html_entities );
756
+		$answer = is_array($answer) ? self::prep_answer(array_shift($answer), $use_html_entities) : self::prep_answer($answer, $use_html_entities);
757 757
 		// prep the required array
758
-		$required = self::prep_required( $required );
758
+		$required = self::prep_required($required);
759 759
 		// set disabled tag
760
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
760
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
761 761
 		// ya gots ta have style man!!!
762 762
 		$txt_class = is_admin() ? 'wide' : 'espresso-select-inp';
763
-		$class = empty( $class ) ? $txt_class : $class;
764
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
765
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
763
+		$class = empty($class) ? $txt_class : $class;
764
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
765
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
766 766
 
767
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
767
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
768 768
 		// filter label but ensure required text comes before it
769
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
769
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
770 770
 
771
-		$input_html = "\n\t\t\t" . '<select name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" title="' . esc_attr( $required['msg'] ) . '"' . $disabled . ' ' . $extra . '>';
771
+		$input_html = "\n\t\t\t".'<select name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" title="'.esc_attr($required['msg']).'"'.$disabled.' '.$extra.'>';
772 772
 		// recursively count array elements, to determine total number of options
773
-		$only_option = count( $options, 1 ) == 1 ? TRUE : FALSE;
774
-		if ( ! $only_option ) {
773
+		$only_option = count($options, 1) == 1 ? TRUE : FALSE;
774
+		if ( ! $only_option) {
775 775
 			// if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected
776 776
 			$selected = $answer === NULL ? ' selected="selected"' : '';
777
-			$input_html .= $add_please_select_option ? "\n\t\t\t\t" . '<option value=""' . $selected . '>' . __(' - please select - ', 'event_espresso') . '</option>' : '';
777
+			$input_html .= $add_please_select_option ? "\n\t\t\t\t".'<option value=""'.$selected.'>'.__(' - please select - ', 'event_espresso').'</option>' : '';
778 778
 		}
779
-		foreach ( $options as $key => $value ) {
779
+		foreach ($options as $key => $value) {
780 780
 			// if value is an array, then create option groups, else create regular ol' options
781
-			$input_html .= is_array( $value ) ? self::_generate_select_option_group( $key, $value, $answer, $use_html_entities ) : self::_generate_select_option( $value->value(), $value->desc(), $answer, $only_option, $use_html_entities );
781
+			$input_html .= is_array($value) ? self::_generate_select_option_group($key, $value, $answer, $use_html_entities) : self::_generate_select_option($value->value(), $value->desc(), $answer, $only_option, $use_html_entities);
782 782
 		}
783 783
 
784
-		$input_html .= "\n\t\t\t" . '</select>';
784
+		$input_html .= "\n\t\t\t".'</select>';
785 785
 
786
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID );
786
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID);
787 787
 
788
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
789
-		return  $label_html . $input_html;
788
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
789
+		return  $label_html.$input_html;
790 790
 
791 791
 	}
792 792
 
@@ -804,12 +804,12 @@  discard block
 block discarded – undo
804 804
 	 * @param boolean $use_html_entities
805 805
 	 * @return string
806 806
 	 */
807
-	private static function _generate_select_option_group( $opt_group, $QSOs, $answer, $use_html_entities = true ){
808
-		$html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value( $opt_group ) . '">';
809
-		foreach ( $QSOs as $QSO ) {
810
-			$html .= self::_generate_select_option( $QSO->value(), $QSO->desc(), $answer, false, $use_html_entities );
807
+	private static function _generate_select_option_group($opt_group, $QSOs, $answer, $use_html_entities = true) {
808
+		$html = "\n\t\t\t\t".'<optgroup label="'.self::prep_option_value($opt_group).'">';
809
+		foreach ($QSOs as $QSO) {
810
+			$html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer, false, $use_html_entities);
811 811
 		}
812
-		$html .= "\n\t\t\t\t" . '</optgroup>';
812
+		$html .= "\n\t\t\t\t".'</optgroup>';
813 813
 		return $html;
814 814
 	}
815 815
 
@@ -824,12 +824,12 @@  discard block
 block discarded – undo
824 824
 	 * @param boolean $use_html_entities
825 825
 	 * @return string
826 826
 	 */
827
-	private static function _generate_select_option( $key, $value, $answer, $only_option = FALSE, $use_html_entities = true ){
828
-		$key = self::prep_answer( $key, $use_html_entities );
829
-		$value = self::prep_answer( $value, $use_html_entities );
830
-		$value = ! empty( $value ) ? $value : $key;
831
-		$selected = ( $answer == $key || $only_option ) ? ' selected="selected"' : '';
832
-		return "\n\t\t\t\t" . '<option value="' . self::prep_option_value( $key ) . '"' . $selected . '> ' . $value . '&nbsp;&nbsp;&nbsp;</option>';
827
+	private static function _generate_select_option($key, $value, $answer, $only_option = FALSE, $use_html_entities = true) {
828
+		$key = self::prep_answer($key, $use_html_entities);
829
+		$value = self::prep_answer($value, $use_html_entities);
830
+		$value = ! empty($value) ? $value : $key;
831
+		$selected = ($answer == $key || $only_option) ? ' selected="selected"' : '';
832
+		return "\n\t\t\t\t".'<option value="'.self::prep_option_value($key).'"'.$selected.'> '.$value.'&nbsp;&nbsp;&nbsp;</option>';
833 833
 	}
834 834
 
835 835
 
@@ -853,56 +853,56 @@  discard block
 block discarded – undo
853 853
 	 * @param bool        $use_desc_4_label
854 854
 	 * @return string HTML
855 855
 	 */
856
-	static function radio( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE ) {
856
+	static function radio($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE) {
857 857
 		// need these
858
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
858
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
859 859
 			return NULL;
860 860
 		}
861 861
 		// prep the answer
862
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
862
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
863 863
 		// prep the required array
864
-		$required = self::prep_required( $required );
864
+		$required = self::prep_required($required);
865 865
 		// set disabled tag
866
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
866
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
867 867
 		// ya gots ta have style man!!!
868 868
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
869
-		$class = ! empty( $class ) ? $class : 'espresso-radio-btn-inp';
870
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
869
+		$class = ! empty($class) ? $class : 'espresso-radio-btn-inp';
870
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
871 871
 
872
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
872
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
873 873
 		// filter label but ensure required text comes before it
874
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
874
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
875 875
 
876
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $label_class . ' ' . $class . '-ul">';
876
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-radio-btn-options-ul '.$label_class.' '.$class.'-ul">';
877 877
 
878
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
879
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
878
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
879
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
880 880
 
881
-		foreach ( $options as $OPT ) {
882
-			if ( $OPT instanceof EE_Question_Option ) {
883
-				$value = self::prep_option_value( $OPT->value() );
881
+		foreach ($options as $OPT) {
882
+			if ($OPT instanceof EE_Question_Option) {
883
+				$value = self::prep_option_value($OPT->value());
884 884
 				$label = $use_desc_4_label ? $OPT->desc() : $OPT->value();
885
-				$size = $use_desc_4_label ? self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ) : self::get_label_size_class( $OPT->value() );
886
-				$desc = $OPT->desc();//no self::prep_answer
887
-				$answer = is_numeric( $value ) && empty( $answer ) ? 0 : $answer;
888
-				$checked = (string)$value == (string)$answer ? ' checked="checked"' : '';
889
-				$opt = '-' . sanitize_key( $value );
890
-
891
-				$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
892
-				$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">';
893
-				$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>' : '';
894
-				$input_html .= "\n\t\t\t\t\t\t" . '<input type="radio" name="' . $name . '" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
895
-				$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span class="espresso-radio-btn-desc">' . $label . '</span>' : '';
896
-				$input_html .= "\n\t\t\t\t\t" . '</label>';
897
-				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>';
898
-				$input_html .= "\n\t\t\t\t" . '</li>';
885
+				$size = $use_desc_4_label ? self::get_label_size_class($OPT->value().' '.$OPT->desc()) : self::get_label_size_class($OPT->value());
886
+				$desc = $OPT->desc(); //no self::prep_answer
887
+				$answer = is_numeric($value) && empty($answer) ? 0 : $answer;
888
+				$checked = (string) $value == (string) $answer ? ' checked="checked"' : '';
889
+				$opt = '-'.sanitize_key($value);
890
+
891
+				$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
892
+				$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-radio-btn-lbl">';
893
+				$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$label.'</span>' : '';
894
+				$input_html .= "\n\t\t\t\t\t\t".'<input type="radio" name="'.$name.'" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
895
+				$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span class="espresso-radio-btn-desc">'.$label.'</span>' : '';
896
+				$input_html .= "\n\t\t\t\t\t".'</label>';
897
+				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">'.$desc.'</span>';
898
+				$input_html .= "\n\t\t\t\t".'</li>';
899 899
 			}
900 900
 		}
901 901
 
902
-		$input_html .= "\n\t\t\t" . '</ul>';
902
+		$input_html .= "\n\t\t\t".'</ul>';
903 903
 
904
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
905
-		return  $label_html . $input_html;
904
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
905
+		return  $label_html.$input_html;
906 906
 
907 907
 	}
908 908
 
@@ -925,65 +925,65 @@  discard block
 block discarded – undo
925 925
 	 * @param string $disabled 		disabled="disabled" or null
926 926
 	 * @return string HTML
927 927
 	 */
928
-	static function checkbox( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
928
+	static function checkbox($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
929 929
 		// need these
930
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
930
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
931 931
 			return NULL;
932 932
 		}
933
-		$answer = maybe_unserialize( $answer );
933
+		$answer = maybe_unserialize($answer);
934 934
 
935 935
 		// prep the answer(s)
936
-		$answer = is_array( $answer ) ? $answer : array( sanitize_key( $answer ) => $answer );
936
+		$answer = is_array($answer) ? $answer : array(sanitize_key($answer) => $answer);
937 937
 
938
-		foreach ( $answer as $key => $value ) {
939
-			$key = self::prep_option_value( $key );
940
-			$answer[$key] = self::prep_answer( $value, $use_html_entities );
938
+		foreach ($answer as $key => $value) {
939
+			$key = self::prep_option_value($key);
940
+			$answer[$key] = self::prep_answer($value, $use_html_entities);
941 941
 		}
942 942
 
943 943
 		// prep the required array
944
-		$required = self::prep_required( $required );
944
+		$required = self::prep_required($required);
945 945
 		// set disabled tag
946
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
946
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
947 947
 		// ya gots ta have style man!!!
948 948
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
949
-		$class = empty( $class ) ? 'espresso-radio-btn-inp' : $class;
950
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
949
+		$class = empty($class) ? 'espresso-radio-btn-inp' : $class;
950
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
951 951
 
952
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
952
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
953 953
 		// filter label but ensure required text comes before it
954
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
955
-
956
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $label_class . ' ' . $class . '-ul">';
957
-
958
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
959
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
960
-
961
-		foreach ( $options as $OPT ) {
962
-			$value = $OPT->value();//self::prep_option_value( $OPT->value() );
963
-			$size = self::get_label_size_class(  $OPT->value() . ' ' . $OPT->desc() );
964
-			$text = self::prep_answer( $OPT->value() );
965
-			$desc = $OPT->desc() ;
966
-			$opt = '-' . sanitize_key( $value );
967
-
968
-			$checked = is_array( $answer ) && in_array( $text, $answer ) ? ' checked="checked"' : '';
969
-
970
-			$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
971
-			$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">';
972
-			$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
973
-			$input_html .= "\n\t\t\t\t\t\t" . '<input type="checkbox" name="' . $name . '[' . $OPT->ID() . ']" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
974
-			$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
975
- 			$input_html .= "\n\t\t\t\t\t" . '</label>';
976
-			if ( ! empty( $desc ) && $desc != $text ) {
977
-	 			$input_html .= "\n\t\t\t\t\t" . ' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">' . $desc . '</div>';
954
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
955
+
956
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-checkbox-options-ul '.$label_class.' '.$class.'-ul">';
957
+
958
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
959
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
960
+
961
+		foreach ($options as $OPT) {
962
+			$value = $OPT->value(); //self::prep_option_value( $OPT->value() );
963
+			$size = self::get_label_size_class($OPT->value().' '.$OPT->desc());
964
+			$text = self::prep_answer($OPT->value());
965
+			$desc = $OPT->desc();
966
+			$opt = '-'.sanitize_key($value);
967
+
968
+			$checked = is_array($answer) && in_array($text, $answer) ? ' checked="checked"' : '';
969
+
970
+			$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
971
+			$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-checkbox-lbl">';
972
+			$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
973
+			$input_html .= "\n\t\t\t\t\t\t".'<input type="checkbox" name="'.$name.'['.$OPT->ID().']" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
974
+			$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
975
+ 			$input_html .= "\n\t\t\t\t\t".'</label>';
976
+			if ( ! empty($desc) && $desc != $text) {
977
+	 			$input_html .= "\n\t\t\t\t\t".' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">'.$desc.'</div>';
978 978
 			}
979
-			$input_html .= "\n\t\t\t\t" . '</li>';
979
+			$input_html .= "\n\t\t\t\t".'</li>';
980 980
 
981 981
 		}
982 982
 
983
-		$input_html .= "\n\t\t\t" . '</ul>';
983
+		$input_html .= "\n\t\t\t".'</ul>';
984 984
 
985
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
986
-		return  $label_html . $input_html;
985
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
986
+		return  $label_html.$input_html;
987 987
 
988 988
 	}
989 989
 
@@ -1005,36 +1005,36 @@  discard block
 block discarded – undo
1005 1005
 	 * @param string $disabled 		disabled="disabled" or null
1006 1006
 	 * @return string HTML
1007 1007
 	 */
1008
-	static function datepicker( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
1008
+	static function datepicker($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
1009 1009
 		// need these
1010
-		if ( ! $question || ! $name ) {
1010
+		if ( ! $question || ! $name) {
1011 1011
 			return NULL;
1012 1012
 		}
1013 1013
 		// prep the answer
1014
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
1014
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1015 1015
 		// prep the required array
1016
-		$required = self::prep_required( $required );
1016
+		$required = self::prep_required($required);
1017 1017
 		// set disabled tag
1018
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
1018
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
1019 1019
 		// ya gots ta have style man!!!
1020 1020
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp';
1021
-		$class = empty( $class ) ? $txt_class : $class;
1022
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
1023
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
1021
+		$class = empty($class) ? $txt_class : $class;
1022
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
1023
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1024 1024
 
1025
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
1025
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
1026 1026
 		// filter label but ensure required text comes before it
1027
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
1027
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
1028 1028
 
1029
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . ' datepicker" value="' . $answer . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . ' ' . $extra . '/>';
1029
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].' datepicker" value="'.$answer.'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
1030 1030
 
1031 1031
 		// enqueue scripts
1032
-		wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION );
1033
-		wp_enqueue_style( 'espresso-ui-theme');
1034
-		wp_enqueue_script( 'jquery-ui-datepicker' );
1032
+		wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION);
1033
+		wp_enqueue_style('espresso-ui-theme');
1034
+		wp_enqueue_script('jquery-ui-datepicker');
1035 1035
 
1036
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
1037
-		return  $label_html . $input_html;
1036
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1037
+		return  $label_html.$input_html;
1038 1038
 
1039 1039
 	}
1040 1040
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 	 * 	@access public
1047 1047
 	 * 	@return 	string
1048 1048
 	 */
1049
-	public static function remove_label_keep_required_msg( $label_html, $required_text ) {
1049
+	public static function remove_label_keep_required_msg($label_html, $required_text) {
1050 1050
 		return $required_text;
1051 1051
 	}
1052 1052
 
@@ -1060,9 +1060,9 @@  discard block
 block discarded – undo
1060 1060
 	 * @param string $value
1061 1061
 	 * @return string HTML
1062 1062
 	 */
1063
-	static function hidden_input( $name, $value, $id = '' ){
1064
-		$id = ! empty( $id ) ? $id : $name;
1065
-		return '<input id="' . $id . '" type="hidden" name="'.$name.'" value="' .  $value . '"/>';
1063
+	static function hidden_input($name, $value, $id = '') {
1064
+		$id = ! empty($id) ? $id : $name;
1065
+		return '<input id="'.$id.'" type="hidden" name="'.$name.'" value="'.$value.'"/>';
1066 1066
 	}
1067 1067
 
1068 1068
 
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 	 * @param string $question
1075 1075
 	 * @return string
1076 1076
 	 */
1077
-	static function prep_question( $question ){
1077
+	static function prep_question($question) {
1078 1078
 		return $question;
1079 1079
 //		$link = '';
1080 1080
 //		// does this label have a help link attached ?
@@ -1097,13 +1097,13 @@  discard block
 block discarded – undo
1097 1097
 	 * @param mixed $answer
1098 1098
 	 * @return string
1099 1099
 	 */
1100
-	static function prep_answer( $answer, $use_html_entities = TRUE ){
1100
+	static function prep_answer($answer, $use_html_entities = TRUE) {
1101 1101
 		//make sure we convert bools first.  Otherwise (bool) false becomes an empty string which is NOT desired, we want "0".
1102
-		if ( is_bool( $answer ) ) {
1102
+		if (is_bool($answer)) {
1103 1103
 			$answer = $answer ? 1 : 0;
1104 1104
 		}
1105
-		$answer = trim( stripslashes( str_replace( '&#039;', "'", $answer )));
1106
-		return $use_html_entities ? htmlentities( $answer, ENT_QUOTES, 'UTF-8' ) : $answer;
1105
+		$answer = trim(stripslashes(str_replace('&#039;', "'", $answer)));
1106
+		return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer;
1107 1107
 	}
1108 1108
 
1109 1109
 
@@ -1113,18 +1113,18 @@  discard block
 block discarded – undo
1113 1113
 	 * 	@param array $QSOs  array of EE_Question_Option objects
1114 1114
 	 * 	@return array
1115 1115
 	 */
1116
-	public static function prep_answer_options( $QSOs = array() ){
1116
+	public static function prep_answer_options($QSOs = array()) {
1117 1117
 		$prepped_answer_options = array();
1118
-		if ( is_array( $QSOs ) && ! empty( $QSOs )) {
1119
-			foreach( $QSOs as $key => $QSO ) {
1120
-				if ( ! $QSO instanceof EE_Question_Option ) {
1121
-					$QSO = EE_Question_Option::new_instance( array(
1122
-						'QSO_value' => is_array( $QSO ) && isset( $QSO['id'] ) ? (string)$QSO['id'] : (string)$key,
1123
-						'QSO_desc' => is_array( $QSO ) && isset( $QSO['text'] ) ? (string)$QSO['text'] : (string)$QSO
1118
+		if (is_array($QSOs) && ! empty($QSOs)) {
1119
+			foreach ($QSOs as $key => $QSO) {
1120
+				if ( ! $QSO instanceof EE_Question_Option) {
1121
+					$QSO = EE_Question_Option::new_instance(array(
1122
+						'QSO_value' => is_array($QSO) && isset($QSO['id']) ? (string) $QSO['id'] : (string) $key,
1123
+						'QSO_desc' => is_array($QSO) && isset($QSO['text']) ? (string) $QSO['text'] : (string) $QSO
1124 1124
 					));
1125 1125
 				}
1126
-				if ( $QSO->opt_group() ) {
1127
-					$prepped_answer_options[ $QSO->opt_group() ][] = $QSO;
1126
+				if ($QSO->opt_group()) {
1127
+					$prepped_answer_options[$QSO->opt_group()][] = $QSO;
1128 1128
 				} else {
1129 1129
 					$prepped_answer_options[] = $QSO;
1130 1130
 				}
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
 	 * @param string $option_value
1141 1141
 	 * @return string
1142 1142
 	 */
1143
-	static function prep_option_value( $option_value ){
1144
-		return esc_attr( trim( stripslashes( $option_value ) ) );
1143
+	static function prep_option_value($option_value) {
1144
+		return esc_attr(trim(stripslashes($option_value)));
1145 1145
 	}
1146 1146
 
1147 1147
 
@@ -1152,11 +1152,11 @@  discard block
 block discarded – undo
1152 1152
 	 * @param string|array 	$required
1153 1153
 	 * @return array
1154 1154
 	 */
1155
-	static function prep_required( $required = array() ){
1155
+	static function prep_required($required = array()) {
1156 1156
 		// make sure required is an array
1157
-		$required = is_array( $required ) ? $required : array();
1157
+		$required = is_array($required) ? $required : array();
1158 1158
 		// and set some defaults
1159
-		$required = array_merge( array( 'label' => '', 'class' => '', 'msg' => '' ), $required );
1159
+		$required = array_merge(array('label' => '', 'class' => '', 'msg' => ''), $required);
1160 1160
 		return $required;
1161 1161
 	}
1162 1162
 
@@ -1167,30 +1167,30 @@  discard block
 block discarded – undo
1167 1167
 	 * @param string 	$value
1168 1168
 	 * @return string
1169 1169
 	 */
1170
-	static function get_label_size_class( $value = FALSE ){
1171
-			if ( $value === FALSE || $value == '' ) {
1170
+	static function get_label_size_class($value = FALSE) {
1171
+			if ($value === FALSE || $value == '') {
1172 1172
 				return ' class="medium-lbl"';
1173 1173
 			}
1174 1174
 			// determine length of option value
1175
-			$val_size = strlen( $value );
1176
-			switch( $val_size ){
1175
+			$val_size = strlen($value);
1176
+			switch ($val_size) {
1177 1177
 				case $val_size < 3 :
1178
-					$size =  ' class="nano-lbl"';
1178
+					$size = ' class="nano-lbl"';
1179 1179
 					break;
1180 1180
 				case $val_size < 6 :
1181
-					$size =  ' class="micro-lbl"';
1181
+					$size = ' class="micro-lbl"';
1182 1182
 					break;
1183 1183
 				case $val_size < 12 :
1184
-					$size =  ' class="tiny-lbl"';
1184
+					$size = ' class="tiny-lbl"';
1185 1185
 					break;
1186 1186
 				case $val_size < 25 :
1187
-					$size =  ' class="small-lbl"';
1187
+					$size = ' class="small-lbl"';
1188 1188
 					break;
1189 1189
 				case $val_size > 100 :
1190
-					$size =  ' class="big-lbl"';
1190
+					$size = ' class="big-lbl"';
1191 1191
 					break;
1192 1192
 				default:
1193
-					$size =  ' class="medium-lbl"';
1193
+					$size = ' class="medium-lbl"';
1194 1194
 					break;
1195 1195
 			}
1196 1196
 		return $size;
@@ -1204,20 +1204,20 @@  discard block
 block discarded – undo
1204 1204
 	 * @param array 	$QFI
1205 1205
 	 * @return array
1206 1206
 	 */
1207
-	private static function _load_system_dropdowns( $QFI ){
1207
+	private static function _load_system_dropdowns($QFI) {
1208 1208
 		$QST_system = $QFI->get('QST_system');
1209
-		switch ( $QST_system ) {
1209
+		switch ($QST_system) {
1210 1210
 			case 'state' :
1211
-				$QFI = self::generate_state_dropdown( $QFI );
1211
+				$QFI = self::generate_state_dropdown($QFI);
1212 1212
 				break;
1213 1213
 			case 'country' :
1214
-				$QFI = self::generate_country_dropdown( $QFI );
1214
+				$QFI = self::generate_country_dropdown($QFI);
1215 1215
 				break;
1216 1216
 			case 'admin-state' :
1217
-				$QFI = self::generate_state_dropdown( $QFI, TRUE );
1217
+				$QFI = self::generate_state_dropdown($QFI, TRUE);
1218 1218
 				break;
1219 1219
 			case 'admin-country' :
1220
-				$QFI = self::generate_country_dropdown( $QFI, TRUE );
1220
+				$QFI = self::generate_country_dropdown($QFI, TRUE);
1221 1221
 				break;
1222 1222
 		}
1223 1223
 		return $QFI;
@@ -1234,13 +1234,13 @@  discard block
 block discarded – undo
1234 1234
 	 *
1235 1235
 	 * @return EE_Question_Form_Input
1236 1236
 	 */
1237
-	protected static function _load_specialized_dropdowns( $QFI ) {
1238
-		switch( $QFI->get( 'QST_type' ) ) {
1237
+	protected static function _load_specialized_dropdowns($QFI) {
1238
+		switch ($QFI->get('QST_type')) {
1239 1239
 			case 'STATE' :
1240
-				$QFI = self::generate_state_dropdown( $QFI );
1240
+				$QFI = self::generate_state_dropdown($QFI);
1241 1241
 				break;
1242 1242
 			case 'COUNTRY' :
1243
-				$QFI = self::generate_country_dropdown( $QFI );
1243
+				$QFI = self::generate_country_dropdown($QFI);
1244 1244
 				break;
1245 1245
 		}
1246 1246
 		return $QFI;
@@ -1254,23 +1254,23 @@  discard block
 block discarded – undo
1254 1254
 	 * @param bool  $get_all
1255 1255
 	 * @return array
1256 1256
 	 */
1257
-	public static function generate_state_dropdown( $QST, $get_all = FALSE ){
1257
+	public static function generate_state_dropdown($QST, $get_all = FALSE) {
1258 1258
 		$states = $get_all ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_states_of_active_countries();
1259
-		if ( $states && count( $states ) != count( $QST->options() )) {
1260
-			$QST->set( 'QST_type', 'DROPDOWN' );
1259
+		if ($states && count($states) != count($QST->options())) {
1260
+			$QST->set('QST_type', 'DROPDOWN');
1261 1261
 			// if multiple countries, we'll create option groups within the dropdown
1262
-			foreach ( $states as $state ) {
1263
-				if ( $state instanceof EE_State ) {
1264
-					$QSO = EE_Question_Option::new_instance ( array (
1262
+			foreach ($states as $state) {
1263
+				if ($state instanceof EE_State) {
1264
+					$QSO = EE_Question_Option::new_instance(array(
1265 1265
 						'QSO_value' => $state->ID(),
1266 1266
 						'QSO_desc' => $state->name(),
1267
-						'QST_ID' => $QST->get( 'QST_ID' ),
1267
+						'QST_ID' => $QST->get('QST_ID'),
1268 1268
 						'QSO_deleted' => FALSE
1269 1269
 					));
1270 1270
 					// set option group
1271
-					$QSO->set_opt_group( $state->country()->name() );
1271
+					$QSO->set_opt_group($state->country()->name());
1272 1272
 					// add option to question
1273
-					$QST->add_temp_option( $QSO );
1273
+					$QST->add_temp_option($QSO);
1274 1274
 				}
1275 1275
 			}
1276 1276
 		}
@@ -1286,20 +1286,20 @@  discard block
 block discarded – undo
1286 1286
 	 * @internal param array $question
1287 1287
 	 * @return array
1288 1288
 	 */
1289
-	public static function generate_country_dropdown( $QST, $get_all = FALSE ){
1289
+	public static function generate_country_dropdown($QST, $get_all = FALSE) {
1290 1290
 		$countries = $get_all ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
1291
-		if ( $countries && count( $countries ) != count( $QST->options() ) ) {
1292
-			$QST->set( 'QST_type', 'DROPDOWN' );
1291
+		if ($countries && count($countries) != count($QST->options())) {
1292
+			$QST->set('QST_type', 'DROPDOWN');
1293 1293
 			// now add countries
1294
-			foreach ( $countries as $country ) {
1295
-				if ( $country instanceof EE_Country ) {
1296
-					$QSO = EE_Question_Option::new_instance ( array (
1294
+			foreach ($countries as $country) {
1295
+				if ($country instanceof EE_Country) {
1296
+					$QSO = EE_Question_Option::new_instance(array(
1297 1297
 						'QSO_value' => $country->ID(),
1298 1298
 						'QSO_desc' => $country->name(),
1299
-						'QST_ID' => $QST->get( 'QST_ID' ),
1299
+						'QST_ID' => $QST->get('QST_ID'),
1300 1300
 						'QSO_deleted' => FALSE
1301 1301
 					));
1302
-					$QST->add_temp_option( $QSO );
1302
+					$QST->add_temp_option($QSO);
1303 1303
 				}
1304 1304
 			}
1305 1305
 		}
@@ -1316,11 +1316,11 @@  discard block
 block discarded – undo
1316 1316
 	 */
1317 1317
 	public static function two_digit_months_dropdown_options() {
1318 1318
 		$options = array();
1319
-		for ( $x = 1; $x <= 12; $x++ ) {
1320
-			$mm = str_pad( $x, 2, '0', STR_PAD_LEFT );
1321
-			$options[ (string)$mm ] = (string)$mm;
1319
+		for ($x = 1; $x <= 12; $x++) {
1320
+			$mm = str_pad($x, 2, '0', STR_PAD_LEFT);
1321
+			$options[(string) $mm] = (string) $mm;
1322 1322
 		}
1323
-		return EEH_Form_Fields::prep_answer_options( $options );
1323
+		return EEH_Form_Fields::prep_answer_options($options);
1324 1324
 	}
1325 1325
 
1326 1326
 
@@ -1335,11 +1335,11 @@  discard block
 block discarded – undo
1335 1335
 		$options = array();
1336 1336
 		$current_year = date('y');
1337 1337
 		$next_decade = $current_year + 10;
1338
-		for ( $x = $current_year; $x <= $next_decade; $x++ ) {
1339
-			$yy = str_pad( $x, 2, '0', STR_PAD_LEFT );
1340
-			$options[ (string)$yy ] = (string)$yy;
1338
+		for ($x = $current_year; $x <= $next_decade; $x++) {
1339
+			$yy = str_pad($x, 2, '0', STR_PAD_LEFT);
1340
+			$options[(string) $yy] = (string) $yy;
1341 1341
 		}
1342
-		return EEH_Form_Fields::prep_answer_options( $options );
1342
+		return EEH_Form_Fields::prep_answer_options($options);
1343 1343
 	}
1344 1344
 
1345 1345
 
@@ -1353,17 +1353,17 @@  discard block
 block discarded – undo
1353 1353
 	 * @param  integer $evt_category Event Category ID if the Event Category filter is selected
1354 1354
 	 * @return string                html
1355 1355
 	 */
1356
-	public static function generate_registration_months_dropdown( $cur_date = '', $status = '', $evt_category = 0 ) {
1356
+	public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0) {
1357 1357
 		$_where = array();
1358
-		if ( !empty( $status ) ) {
1358
+		if ( ! empty($status)) {
1359 1359
 			$_where['STS_ID'] = $status;
1360 1360
 		}
1361 1361
 
1362
-		if ( $evt_category > 0 ) {
1362
+		if ($evt_category > 0) {
1363 1363
 			$_where['Event.Term_Taxonomy.term_id'] = $evt_category;
1364 1364
 		}
1365 1365
 
1366
-		$regdtts = EEM_Registration::instance()->get_reg_months_and_years( $_where );
1366
+		$regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where);
1367 1367
 
1368 1368
 		//setup vals for select input helper
1369 1369
 		$options = array(
@@ -1373,15 +1373,15 @@  discard block
 block discarded – undo
1373 1373
 				)
1374 1374
 			);
1375 1375
 
1376
-		foreach ( $regdtts as $regdtt ) {
1377
-			$date = $regdtt->reg_month. ' ' . $regdtt->reg_year;
1376
+		foreach ($regdtts as $regdtt) {
1377
+			$date = $regdtt->reg_month.' '.$regdtt->reg_year;
1378 1378
 			$options[] = array(
1379 1379
 				'text' => $date,
1380 1380
 				'id' => $date
1381 1381
 				);
1382 1382
 		}
1383 1383
 
1384
-		return self::select_input('month_range', $options, $cur_date, '', 'wide' );
1384
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1385 1385
 	}
1386 1386
 
1387 1387
 
@@ -1395,18 +1395,18 @@  discard block
 block discarded – undo
1395 1395
 	 * @param  string $evt_active_status "upcoming", "expired", "active", or "inactive"
1396 1396
 	 * @return string                    html
1397 1397
 	 */
1398
-	public static function generate_event_months_dropdown( $cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL ) {
1398
+	public static function generate_event_months_dropdown($cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL) {
1399 1399
 		//determine what post_status our condition will have for the query.
1400
-		switch ( $status ) {
1400
+		switch ($status) {
1401 1401
 			case 'month' :
1402 1402
 			case 'today' :
1403 1403
 			case NULL :
1404 1404
 			case 'all' :
1405
-				$where['Event.status'] = array( 'NOT IN', array('trash') );
1405
+				$where['Event.status'] = array('NOT IN', array('trash'));
1406 1406
 				break;
1407 1407
 
1408 1408
 			case 'draft' :
1409
-				$where['Event.status'] = array( 'IN', array('draft', 'auto-draft') );
1409
+				$where['Event.status'] = array('IN', array('draft', 'auto-draft'));
1410 1410
 
1411 1411
 			default :
1412 1412
 				$where['Event.status'] = $status;
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
 		//categories?
1416 1416
 
1417 1417
 
1418
-		if ( !empty ( $evt_category ) ) {
1418
+		if ( ! empty ($evt_category)) {
1419 1419
 			$where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1420 1420
 			$where['Event.Term_Taxonomy.term_id'] = $evt_category;
1421 1421
 		}
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 
1424 1424
 //		$where['DTT_is_primary'] = 1;
1425 1425
 
1426
-		$DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status );
1426
+		$DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status);
1427 1427
 
1428 1428
 		//let's setup vals for select input helper
1429 1429
 		$options = array(
@@ -1438,9 +1438,9 @@  discard block
 block discarded – undo
1438 1438
 		//translate month and date
1439 1439
 		global $wp_locale;
1440 1440
 
1441
-		foreach ( $DTTS as $DTT ) {
1442
-			$localized_date = $wp_locale->get_month( $DTT->dtt_month_num ) . ' ' . $DTT->dtt_year;
1443
-			$id = $DTT->dtt_month . ' ' . $DTT->dtt_year;
1441
+		foreach ($DTTS as $DTT) {
1442
+			$localized_date = $wp_locale->get_month($DTT->dtt_month_num).' '.$DTT->dtt_year;
1443
+			$id = $DTT->dtt_month.' '.$DTT->dtt_year;
1444 1444
 			$options[] = array(
1445 1445
 				'text' => $localized_date,
1446 1446
 				'id' => $id
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
 		}
1449 1449
 
1450 1450
 
1451
-		return self::select_input( 'month_range', $options, $cur_date, '', 'wide' );
1451
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1452 1452
 	}
1453 1453
 
1454 1454
 
@@ -1459,7 +1459,7 @@  discard block
 block discarded – undo
1459 1459
 	 * @param  integer $current_cat currently selected category
1460 1460
 	 * @return string               html for dropdown
1461 1461
 	 */
1462
-	public static function generate_event_category_dropdown( $current_cat = -1 ) {
1462
+	public static function generate_event_category_dropdown($current_cat = -1) {
1463 1463
 		$categories = EEM_Term::instance()->get_all_ee_categories(TRUE);
1464 1464
 		$options = array(
1465 1465
 			'0' => array(
@@ -1469,14 +1469,14 @@  discard block
 block discarded – undo
1469 1469
 			);
1470 1470
 
1471 1471
 		//setup categories for dropdown
1472
-		foreach ( $categories as $category ) {
1472
+		foreach ($categories as $category) {
1473 1473
 			$options[] = array(
1474 1474
 				'text' => $category->get('name'),
1475 1475
 				'id' => $category->ID()
1476 1476
 				);
1477 1477
 		}
1478 1478
 
1479
-		return self::select_input( 'EVT_CAT', $options, $current_cat );
1479
+		return self::select_input('EVT_CAT', $options, $current_cat);
1480 1480
 	}
1481 1481
 
1482 1482
 
@@ -1495,20 +1495,20 @@  discard block
 block discarded – undo
1495 1495
 	 * @param    string   $extra_attributes - any extra attributes that need to be attached to the form input
1496 1496
 	 * @return    void
1497 1497
 	 */
1498
-	public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) {
1498
+	public static function submit_button($url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '') {
1499 1499
 		$btn = '';
1500
-		if ( empty( $url ) || empty( $ID )) {
1500
+		if (empty($url) || empty($ID)) {
1501 1501
 			return $btn;
1502 1502
 		}
1503
-		$text = ! empty( $text ) ? $text : __('Submit', 'event_espresso' );
1504
-		$btn .= '<input id="' . $ID . '-btn" class="' . $class . '" type="submit" value="' . $text . '" ' . $extra_attributes . '/>';
1505
-		if ( ! $input_only ) {
1506
-			$btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">';
1507
-			$btn_frm .= ! empty( $nonce_action ) ? wp_nonce_field( $nonce_action, $nonce_action . '_nonce', TRUE, FALSE ) : '';
1503
+		$text = ! empty($text) ? $text : __('Submit', 'event_espresso');
1504
+		$btn .= '<input id="'.$ID.'-btn" class="'.$class.'" type="submit" value="'.$text.'" '.$extra_attributes.'/>';
1505
+		if ( ! $input_only) {
1506
+			$btn_frm = '<form id="'.$ID.'-frm" method="POST" action="'.$url.'">';
1507
+			$btn_frm .= ! empty($nonce_action) ? wp_nonce_field($nonce_action, $nonce_action.'_nonce', TRUE, FALSE) : '';
1508 1508
 			$btn_frm .= $btn;
1509 1509
 			$btn_frm .= '</form>';
1510 1510
 			$btn = $btn_frm;
1511
-			unset ( $btn_frm );
1511
+			unset ($btn_frm);
1512 1512
 		}
1513 1513
 		return $btn;
1514 1514
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_URL.helper.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * ------------------------------------------------------------------------
11 11
  */
12
-class EEH_URL{
12
+class EEH_URL {
13 13
 
14 14
 	/**
15 15
 	 * _add_query_arg
@@ -21,30 +21,30 @@  discard block
 block discarded – undo
21 21
 	 * @param bool  $exclude_nonce  If true then the nonce will be excluded from the generated url.
22 22
 	 * @return string
23 23
 	 */
24
-	public static function add_query_args_and_nonce( $args = array(), $url = '', $exclude_nonce = false ) {
25
-		if ( empty( $url ) ) {
26
-			$user_msg = __('An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.', 'event_espresso' );
27
-			$dev_msg = $user_msg . "\n" . sprintf(
28
-					__('In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s::add_query_args_and_nonce method.', 'event_espresso' ),
24
+	public static function add_query_args_and_nonce($args = array(), $url = '', $exclude_nonce = false) {
25
+		if (empty($url)) {
26
+			$user_msg = __('An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.', 'event_espresso');
27
+			$dev_msg = $user_msg."\n".sprintf(
28
+					__('In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s::add_query_args_and_nonce method.', 'event_espresso'),
29 29
 					__CLASS__
30 30
 				);
31
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
31
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
32 32
 		}
33 33
 		// check that an action exists and add nonce
34
-		if ( ! $exclude_nonce ) {
35
-			if ( isset( $args['action'] ) && ! empty( $args['action'] ) ) {
36
-				$args = array_merge( $args, array( $args['action'] . '_nonce' => wp_create_nonce( $args['action'] . '_nonce' ) ) );
34
+		if ( ! $exclude_nonce) {
35
+			if (isset($args['action']) && ! empty($args['action'])) {
36
+				$args = array_merge($args, array($args['action'].'_nonce' => wp_create_nonce($args['action'].'_nonce')));
37 37
 			} else {
38
-				$args = array_merge( $args, array( 'action' => 'default', 'default_nonce' => wp_create_nonce( 'default_nonce' ) ) );
38
+				$args = array_merge($args, array('action' => 'default', 'default_nonce' => wp_create_nonce('default_nonce')));
39 39
 			}
40 40
 		}
41 41
 
42 42
 		//finally, let's always add a return address (if present) :)
43
-		$args = ! empty( $_REQUEST['action'] ) && ! isset( $_REQUEST[ 'return' ] )
44
-			? array_merge( $args, array( 'return' => $_REQUEST['action'] ) )
43
+		$args = ! empty($_REQUEST['action']) && ! isset($_REQUEST['return'])
44
+			? array_merge($args, array('return' => $_REQUEST['action']))
45 45
 			: $args;
46 46
 
47
-		return add_query_arg( $args, $url );
47
+		return add_query_arg($args, $url);
48 48
 
49 49
 	}
50 50
 
@@ -57,17 +57,17 @@  discard block
 block discarded – undo
57 57
 	 * @param boolean $sslverify whether we care if the SSL certificate for the requested site is setup properly
58 58
 	 * @return boolean
59 59
 	 */
60
-	public static function remote_file_exists( $url, $args = array() ){
61
-		$results = wp_remote_request($url,array_merge( array(
60
+	public static function remote_file_exists($url, $args = array()) {
61
+		$results = wp_remote_request($url, array_merge(array(
62 62
 			'method'=>'GET',
63 63
 			'redirection'=>1
64
-		), $args ) );
65
-		if( ! $results instanceof WP_Error &&
64
+		), $args));
65
+		if ( ! $results instanceof WP_Error &&
66 66
 				isset($results['response']) &&
67 67
 				isset($results['response']['code']) &&
68
-				$results['response']['code'] == '200'){
68
+				$results['response']['code'] == '200') {
69 69
 			return true;
70
-		}else{
70
+		} else {
71 71
 			return false;
72 72
 		}
73 73
 	}
@@ -83,29 +83,29 @@  discard block
 block discarded – undo
83 83
 	 * @param bool   $base_url_only - TRUE will only return the scheme and host with no other parameters
84 84
 	 * @return string
85 85
 	 */
86
-	public static function refactor_url( $url = '', $remove_query = TRUE, $base_url_only = FALSE ) {
86
+	public static function refactor_url($url = '', $remove_query = TRUE, $base_url_only = FALSE) {
87 87
 		// break apart incoming URL
88
-		$url_bits = parse_url( $url );
88
+		$url_bits = parse_url($url);
89 89
 		// HTTP or HTTPS ?
90
-		$scheme = isset( $url_bits[ 'scheme' ] ) ? $url_bits[ 'scheme' ] . '://' : 'http://';
90
+		$scheme = isset($url_bits['scheme']) ? $url_bits['scheme'].'://' : 'http://';
91 91
 		// domain
92
-		$host = isset( $url_bits[ 'host' ] ) ? $url_bits[ 'host' ] : '';
92
+		$host = isset($url_bits['host']) ? $url_bits['host'] : '';
93 93
 		// if only the base URL is requested, then return that now
94
-		if ( $base_url_only ) {
95
-			return $scheme . $host;
94
+		if ($base_url_only) {
95
+			return $scheme.$host;
96 96
 		}
97
-		$port = isset( $url_bits[ 'port' ] ) ? ':' . $url_bits[ 'port' ] : '';
98
-		$user = isset( $url_bits[ 'user' ] ) ? $url_bits[ 'user' ] : '';
99
-		$pass = isset( $url_bits[ 'pass' ] ) ? ':' . $url_bits[ 'pass' ] : '';
100
-		$pass = ( $user || $pass ) ? $pass . '@' : '';
101
-		$path = isset( $url_bits[ 'path' ] ) ? $url_bits[ 'path' ] : '';
97
+		$port = isset($url_bits['port']) ? ':'.$url_bits['port'] : '';
98
+		$user = isset($url_bits['user']) ? $url_bits['user'] : '';
99
+		$pass = isset($url_bits['pass']) ? ':'.$url_bits['pass'] : '';
100
+		$pass = ($user || $pass) ? $pass.'@' : '';
101
+		$path = isset($url_bits['path']) ? $url_bits['path'] : '';
102 102
 		// if the query string is not required, then return what we have so far
103
-		if ( $remove_query ) {
104
-			return $scheme . $user . $pass . $host . $port . $path;
103
+		if ($remove_query) {
104
+			return $scheme.$user.$pass.$host.$port.$path;
105 105
 		}
106
-		$query = isset( $url_bits[ 'query' ] ) ? '?' . $url_bits[ 'query' ] : '';
107
-		$fragment = isset( $url_bits[ 'fragment' ] ) ? '#' . $url_bits[ 'fragment' ] : '';
108
-		return $scheme . $user . $pass . $host . $port . $path . $query . $fragment;
106
+		$query = isset($url_bits['query']) ? '?'.$url_bits['query'] : '';
107
+		$fragment = isset($url_bits['fragment']) ? '#'.$url_bits['fragment'] : '';
108
+		return $scheme.$user.$pass.$host.$port.$path.$query.$fragment;
109 109
 	}
110 110
 
111 111
 
@@ -118,29 +118,29 @@  discard block
 block discarded – undo
118 118
 	 * @param bool   $as_array TRUE (default) will return query params as an array of key value pairs, FALSE will simply return the query string
119 119
 	 * @return string|array
120 120
 	 */
121
-	public static function get_query_string( $url = '', $as_array = TRUE ) {
121
+	public static function get_query_string($url = '', $as_array = TRUE) {
122 122
 		// break apart incoming URL
123
-		$url_bits = parse_url( $url );
123
+		$url_bits = parse_url($url);
124 124
 		// grab query string from URL
125
-		$query = isset( $url_bits[ 'query' ] ) ? $url_bits[ 'query' ] : '';
125
+		$query = isset($url_bits['query']) ? $url_bits['query'] : '';
126 126
 		// if we don't want the query string formatted into an array of key => value pairs, then just return it as is
127
-		if ( ! $as_array ) {
127
+		if ( ! $as_array) {
128 128
 			return $query;
129 129
 		}
130 130
 		// if no query string exists then just return an empty array now
131
-		if ( empty( $query )) {
131
+		if (empty($query)) {
132 132
 			return array();
133 133
 		}
134 134
 		// empty array to hold results
135 135
 		$query_params = array();
136 136
 		// now break apart the query string into separate params
137
-		$query = explode( '&', $query );
137
+		$query = explode('&', $query);
138 138
 		// loop thru our query params
139
-		foreach ( $query as $query_args ) {
139
+		foreach ($query as $query_args) {
140 140
 			// break apart the key value pairs
141
-			$query_args = explode( '=', $query_args );
141
+			$query_args = explode('=', $query_args);
142 142
 			// and add to our results array
143
-			$query_params[ $query_args[0] ] = $query_args[1];
143
+			$query_params[$query_args[0]] = $query_args[1];
144 144
 		}
145 145
 		return $query_params;
146 146
 	}
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * prevent_prefetching
152 152
 	 * @return void
153 153
 	 */
154
-	public static function prevent_prefetching(){
154
+	public static function prevent_prefetching() {
155 155
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
156 156
 		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
157 157
 	}
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 	 * @param   string $prefix Use this to prefix the string with something.
167 167
 	 * @return string
168 168
 	 */
169
-	public static function generate_unique_token( $prefix = '' ) {
170
-		$token =  md5( uniqid() . mt_rand() );
171
-		return $prefix ? $prefix . '_' . $token : $token;
169
+	public static function generate_unique_token($prefix = '') {
170
+		$token = md5(uniqid().mt_rand());
171
+		return $prefix ? $prefix.'_'.$token : $token;
172 172
 	}
173 173
 
174 174
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * add_nocache_headers
178 178
 	 * @return void
179 179
 	 */
180
-	public static function add_nocache_headers(){
180
+	public static function add_nocache_headers() {
181 181
 		// add no cache headers
182 182
 //		add_action( 'wp_head' , array( 'EED_Single_Page_Checkout', 'nocache_headers' ), 10 );
183 183
 		// plus a little extra for nginx
@@ -194,19 +194,19 @@  discard block
 block discarded – undo
194 194
 	 * @param string $server_variable
195 195
 	 * @return string
196 196
 	 */
197
-	public static function filter_input_server_url( $server_variable = 'REQUEST_URI' ){
197
+	public static function filter_input_server_url($server_variable = 'REQUEST_URI') {
198 198
 		$URL = '';
199 199
 		$server_variables = array(
200 200
 			'REQUEST_URI' => 1,
201 201
 			'HTTP_HOST' => 1,
202 202
 			'PHP_SELF' => 1,
203 203
 		);
204
-		$server_variable = strtoupper( $server_variable );
204
+		$server_variable = strtoupper($server_variable);
205 205
 		// whitelist INPUT_SERVER var
206
-		if ( isset( $server_variables[ $server_variable ] ) ) {
207
-			$URL = filter_input( INPUT_SERVER, $server_variable, FILTER_SANITIZE_URL, FILTER_NULL_ON_FAILURE );
208
-			if ( empty( $URL ) ) {
209
-				$URL = esc_url( $_SERVER[ $server_variable ] );
206
+		if (isset($server_variables[$server_variable])) {
207
+			$URL = filter_input(INPUT_SERVER, $server_variable, FILTER_SANITIZE_URL, FILTER_NULL_ON_FAILURE);
208
+			if (empty($URL)) {
209
+				$URL = esc_url($_SERVER[$server_variable]);
210 210
 			}
211 211
 		}
212 212
 		return $URL;
Please login to merge, or discard this patch.
core/libraries/messages/EE_message_type.lib.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -382,12 +382,12 @@
 block discarded – undo
382 382
 
383 383
 
384 384
 	/**
385
-	* This sets up any action/filter hooks this message type puts in place for a specific messenger.  It's called from the set_messages() method.  Note that by default this does nothing.  Child classes will need to override if they want to add specific hooks for a messenger.
386
-	*
387
-	* @since 1.0.0
388
-	*
389
-	* @return void
390
-	*/
385
+	 * This sets up any action/filter hooks this message type puts in place for a specific messenger.  It's called from the set_messages() method.  Note that by default this does nothing.  Child classes will need to override if they want to add specific hooks for a messenger.
386
+	 *
387
+	 * @since 1.0.0
388
+	 *
389
+	 * @return void
390
+	 */
391 391
 	protected function _do_messenger_hooks() {
392 392
 		return;
393 393
 	}
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 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
 /**
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @param  bool   $preview indicate whether a preview is being generated or not.
272 272
 	 * @return void
273 273
 	 */
274
-	public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE ) {
274
+	public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE) {
275 275
 
276 276
 		$this->_active_messenger = $active_messenger;
277 277
 
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
 
281 281
 		//this is a special method that allows child message types to trigger an exit from generating messages early (in cases where there may be a delay on send).
282 282
 		$exit = $this->_trigger_exit();
283
-		if ( $exit && ! $this->_preview ) return FALSE;
283
+		if ($exit && ! $this->_preview) return FALSE;
284 284
 
285 285
 		//todo: need to move require into registration hook but for now we'll require here.
286
-		EE_Registry::instance()->load_helper( 'Parse_Shortcodes' );
286
+		EE_Registry::instance()->load_helper('Parse_Shortcodes');
287 287
 		//get shortcode_replace instance- set when _get_messages is called in child...
288 288
 		$this->_shortcode_replace = new EEH_Parse_Shortcodes();
289 289
 
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 		$this->_data_handler = ! $this->_preview ? $this->_data_handler : 'Preview';
295 295
 
296 296
 		//if there is an incoming context then this is a preview so let's ONLY show the given context!
297
-		if ( !empty( $context ) ) {
298
-			$cntxt = ! empty( $this->_contexts[$context] ) ? $this->_contexts[$context] : '';
299
-			if ( ! empty( $cntxt )  ) {
297
+		if ( ! empty($context)) {
298
+			$cntxt = ! empty($this->_contexts[$context]) ? $this->_contexts[$context] : '';
299
+			if ( ! empty($cntxt)) {
300 300
 				$this->_contexts = array();
301 301
 				$this->_contexts[$context] = $cntxt;
302 302
 			}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 		$exit = $this->_init_data();
306 306
 
307 307
 		//final check for if we exit or not cause child objects may have run conditionals that cleared out data so no addresees generated.
308
-		if ( $exit ) return FALSE;
308
+		if ($exit) return FALSE;
309 309
 
310 310
 		$this->_get_templates(); //get the templates that have been set with this type and for the given messenger that have been saved in the database.
311 311
 		$this->_assemble_messages();
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 * @param int      $id 		Optional. Integer corresponding to the value for the primary key of a EE_Base_Class_Object
342 342
 	 * @return mixed ( EE_Base_Class||EE_Base_Class[] )
343 343
 	 */
344
-	abstract protected function _get_data_for_context( $context, EE_Registration $registration, $id );
344
+	abstract protected function _get_data_for_context($context, EE_Registration $registration, $id);
345 345
 
346 346
 
347 347
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 *
374 374
 	 * @return int
375 375
 	 */
376
-	protected function _get_id_for_msg_url( $context, EE_Registration $registration ) {
376
+	protected function _get_id_for_msg_url($context, EE_Registration $registration) {
377 377
 		return 0;
378 378
 	}
379 379
 
@@ -406,28 +406,28 @@  discard block
 block discarded – undo
406 406
 	 *
407 407
 	 * @return string          generated url
408 408
 	 */
409
-	public function get_url_trigger( $context, $sending_messenger, EE_Registration $registration ) {
409
+	public function get_url_trigger($context, $sending_messenger, EE_Registration $registration) {
410 410
 
411 411
 		//validate context
412 412
 		//valid context?
413
-		if ( !isset( $this->_contexts[$context] ) ) {
414
-			throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) );
413
+		if ( ! isset($this->_contexts[$context])) {
414
+			throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this)));
415 415
 		}
416 416
 
417 417
 		//valid sending_messenger?
418 418
 		$not_valid_msgr = FALSE;
419
-		foreach ( $this->_with_messengers as $generating => $sendings ) {
420
-			if ( empty( $sendings ) || array_search( $sending_messenger, $sendings ) === FALSE ) {
419
+		foreach ($this->_with_messengers as $generating => $sendings) {
420
+			if (empty($sendings) || array_search($sending_messenger, $sendings) === FALSE) {
421 421
 				$not_valid_msgr = TRUE;
422 422
 			}
423 423
 		}
424 424
 
425
-		if ( $not_valid_msgr ) {
426
-			throw new EE_Error( sprintf( __('The given sending messenger string (%s) does not match a valid sending messenger with the %s.  If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class( $this ) ) );
425
+		if ($not_valid_msgr) {
426
+			throw new EE_Error(sprintf(__('The given sending messenger string (%s) does not match a valid sending messenger with the %s.  If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class($this)));
427 427
 		}
428 428
 
429 429
 		EE_Registry::instance()->load_helper('MSG_Template');
430
-		return EEH_MSG_Template::generate_url_trigger( $sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url( $context, $registration ) );
430
+		return EEH_MSG_Template::generate_url_trigger($sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url($context, $registration));
431 431
 	}
432 432
 
433 433
 
@@ -448,19 +448,19 @@  discard block
 block discarded – undo
448 448
 	 *
449 449
 	 * @return mixed (EE_Base_Class||EE_Base_Class[])
450 450
 	 */
451
-	public function get_data_for_context( $context, EE_Registration $registration, $id = 0 ) {
451
+	public function get_data_for_context($context, EE_Registration $registration, $id = 0) {
452 452
 		//valid context?
453
-		if ( !isset( $this->_contexts[$context] ) ) {
454
-			throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) );
453
+		if ( ! isset($this->_contexts[$context])) {
454
+			throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this)));
455 455
 		}
456 456
 
457 457
 		//get data and apply global and class specific filters on it.
458
-		$data = apply_filters( 'FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context( $context, $registration, $id ), $this );
459
-		$data = apply_filters( 'FHEE__' . get_class( $this ) . '__get_data_for_context__data', $data, $this );
458
+		$data = apply_filters('FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context($context, $registration, $id), $this);
459
+		$data = apply_filters('FHEE__'.get_class($this).'__get_data_for_context__data', $data, $this);
460 460
 
461 461
 		//if empty then something went wrong!
462
-		if ( empty( $data ) ) {
463
-			throw new EE_Error( sprintf(  __('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name ) );
462
+		if (empty($data)) {
463
+			throw new EE_Error(sprintf(__('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name));
464 464
 		}
465 465
 
466 466
 		return $data;
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 */
496 496
 	public function with_messengers() {
497 497
 
498
-		return apply_filters( 'FHEE__EE_message_type__get_with_messengers__with_messengers__' . get_class( $this ), $this->_with_messengers);
498
+		return apply_filters('FHEE__EE_message_type__get_with_messengers__with_messengers__'.get_class($this), $this->_with_messengers);
499 499
 	}
500 500
 
501 501
 
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 	 * @access public
514 514
 	 * @return void
515 515
 	 */
516
-	public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array() ) {
516
+	public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array()) {
517 517
 		//we can also further refine the context by action (if present).
518
-		return $this->_get_admin_page_content( $page, $action, $extra, $messengers );
518
+		return $this->_get_admin_page_content($page, $action, $extra, $messengers);
519 519
 	}
520 520
 
521 521
 
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
 	 */
560 560
 	public function get_master_templates() {
561 561
 		//first class specific filter then filter that by the global filter.
562
-		$master_templates = apply_filters( 'FHEE__' . get_class( $this ) . '__get_master_templates', $this->_master_templates );
563
-		return apply_filters( 'FHEE__EE_message_type__get_master_templates', $master_templates, $this );
562
+		$master_templates = apply_filters('FHEE__'.get_class($this).'__get_master_templates', $this->_master_templates);
563
+		return apply_filters('FHEE__EE_message_type__get_master_templates', $master_templates, $this);
564 564
 	}
565 565
 
566 566
 
@@ -579,31 +579,31 @@  discard block
 block discarded – undo
579 579
 		/**
580 580
 		 * first let's make sure that incoming data isn't empty!
581 581
 		 */
582
-		if ( is_array($this->_data) && empty($this->_data) && !$this->_preview ) {
583
-			$msg = sprintf( __( '"%s" message type incoming data is empty.  There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular'] );
584
-			throw new EE_Error( $msg );
582
+		if (is_array($this->_data) && empty($this->_data) && ! $this->_preview) {
583
+			$msg = sprintf(__('"%s" message type incoming data is empty.  There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular']);
584
+			throw new EE_Error($msg);
585 585
 		}
586 586
 
587
-		if ( empty( $this->_data_handler) ) {
588
-			$msg = sprintf( __('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__ );
589
-			throw new EE_Error( $msg );
587
+		if (empty($this->_data_handler)) {
588
+			$msg = sprintf(__('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__);
589
+			throw new EE_Error($msg);
590 590
 		}
591 591
 
592 592
 
593 593
 		//setup class name for the data handler
594
-		$classname = 'EE_Messages_' . $this->_data_handler . '_incoming_data';
594
+		$classname = 'EE_Messages_'.$this->_data_handler.'_incoming_data';
595 595
 
596 596
 		//check that the class exists
597
-		if ( !class_exists( $classname ) ) {
597
+		if ( ! class_exists($classname)) {
598 598
 
599 599
 			$msg[] = __('uhoh, Something went wrong and no data handler is found', 'event_espresso');
600
-			$msg[] = sprintf( __('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class").  Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname );
601
-			throw new EE_error( implode('||', $msg) );
600
+			$msg[] = sprintf(__('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class").  Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname);
601
+			throw new EE_error(implode('||', $msg));
602 602
 		}
603 603
 
604 604
 		//k lets get the prepared data object and replace existing data property with it.
605
-		$a = new ReflectionClass( $classname );
606
-		$this->_data = $a->newInstance( $this->_data );
605
+		$a = new ReflectionClass($classname);
606
+		$this->_data = $a->newInstance($this->_data);
607 607
 
608 608
 		$this->_set_default_addressee_data();
609 609
 		return $this->_process_data();
@@ -619,15 +619,15 @@  discard block
 block discarded – undo
619 619
 	protected function _process_data() {
620 620
 		//at a minimum, we NEED EE_Attendee objects.
621 621
 
622
-		if ( empty( $this->_data->attendees ) )
623
-			return TRUE;  //EXIT!
622
+		if (empty($this->_data->attendees))
623
+			return TRUE; //EXIT!
624 624
 
625 625
 		//process addressees for each context.  Child classes will have to have methods for each context defined to handle the processing of the data object within them
626
-		foreach ( $this->_contexts as $context => $details ) {
627
-			$xpctd_method = '_' . $context . '_addressees';
628
-			if ( !method_exists( $this, $xpctd_method ) )
629
-				throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so.  The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) );
630
-			 $this->_addressees[$context] = call_user_func( array( $this, $xpctd_method ) );
626
+		foreach ($this->_contexts as $context => $details) {
627
+			$xpctd_method = '_'.$context.'_addressees';
628
+			if ( ! method_exists($this, $xpctd_method))
629
+				throw new EE_Error(sprintf(__('The data for %1$s message type cannot be prepared because there is no set method for doing so.  The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method));
630
+			 $this->_addressees[$context] = call_user_func(array($this, $xpctd_method));
631 631
 		}
632 632
 		return FALSE; //DON'T EXIT
633 633
 	}
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
 			'total_ticket_count' => $this->_data->total_ticket_count
663 663
 			);
664 664
 
665
-		if ( is_array( $this->_data->primary_attendee_data ) ) {
666
-			$this->_default_addressee_data = array_merge( $this->_default_addressee_data, $this->_data->primary_attendee_data );
665
+		if (is_array($this->_data->primary_attendee_data)) {
666
+			$this->_default_addressee_data = array_merge($this->_default_addressee_data, $this->_data->primary_attendee_data);
667 667
 			$this->_default_addressee_data['primary_att_obj'] = $this->_data->primary_attendee_data['att_obj'];
668 668
 			$this->_default_addressee_data['primary_reg_obj'] = $this->_data->primary_attendee_data['reg_obj'];
669 669
 		}
@@ -681,26 +681,26 @@  discard block
 block discarded – undo
681 681
 	 * see abstract declaration in parent class for details, children message types can override these valid shortcodes if desired (we include all for all contexts by default).
682 682
 	 */
683 683
 	protected function _set_valid_shortcodes() {
684
-		$all_shortcodes = array( 'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger' );
684
+		$all_shortcodes = array('attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger');
685 685
 		$contexts = $this->get_contexts();
686
-		foreach ( $contexts as $context => $details ) {
686
+		foreach ($contexts as $context => $details) {
687 687
 			$this->_valid_shortcodes[$context] = $all_shortcodes;
688 688
 
689 689
 			//make sure non admin context does not include the event_author shortcodes
690
-			if ( $context != 'admin' ) {
691
-				if( ($key = array_search('event_author', $this->_valid_shortcodes[$context] ) ) !== false) {
690
+			if ($context != 'admin') {
691
+				if (($key = array_search('event_author', $this->_valid_shortcodes[$context])) !== false) {
692 692
 					unset($this->_valid_shortcodes[$context][$key]);
693 693
 				}
694 694
 			}
695 695
 		}
696 696
 
697 697
 		//make sure admin context does not include the recipient_details shortcodes IF we have admin context hooked in message types might not have that context.
698
-		if ( !empty( $this->_valid_shortcodes['admin'] ) ) {
699
-			if( ($key = array_search('recipient_details', $this->_valid_shortcodes['admin'] ) ) !== false) {
698
+		if ( ! empty($this->_valid_shortcodes['admin'])) {
699
+			if (($key = array_search('recipient_details', $this->_valid_shortcodes['admin'])) !== false) {
700 700
 					unset($this->_valid_shortcodes['admin'][$key]);
701 701
 				}
702 702
 			//make sure admin context does not include the recipient_details shortcodes
703
-			if( ($key = array_search('recipient_list', $this->_valid_shortcodes['admin'] ) ) !== false) {
703
+			if (($key = array_search('recipient_list', $this->_valid_shortcodes['admin'])) !== false) {
704 704
 					unset($this->_valid_shortcodes['admin'][$key]);
705 705
 				}
706 706
 		}
@@ -713,8 +713,8 @@  discard block
 block discarded – undo
713 713
 	 * @param  array  $new_config array of valid shortcodes (by context)
714 714
 	 * @return void               sets valid_shortcodes property
715 715
 	 */
716
-	public function reset_valid_shortcodes_config( $new_config ) {
717
-		foreach ( $new_config as $context => $shortcodes ) {
716
+	public function reset_valid_shortcodes_config($new_config) {
717
+		foreach ($new_config as $context => $shortcodes) {
718 718
 			$this->_valid_shortcodes[$context] = $shortcodes;
719 719
 		}
720 720
 	}
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		$addressees = array();
735 735
 
736 736
 		//first we need to get the event admin user id for all the events and setup an addressee object for each unique admin user.
737
-		foreach ( $this->_data->events as $line_ref => $event ) {
737
+		foreach ($this->_data->events as $line_ref => $event) {
738 738
 			$admin_id = $this->_get_event_admin_id($event['ID']);
739 739
 			//get the user_id for the event
740 740
 			$admin_ids[] = $admin_id;
@@ -746,14 +746,14 @@  discard block
 block discarded – undo
746 746
 		$admin_ids = array_unique($admin_ids);
747 747
 
748 748
 		//k now we can loop through the event_admins and setup the addressee data.
749
-		foreach ( $admin_ids as $event_admin ) {
749
+		foreach ($admin_ids as $event_admin) {
750 750
 			$aee = array(
751 751
 				'user_id' => $event_admin,
752 752
 				'events' => $admin_events[$event_admin],
753 753
 				'attendees' => $this->_data->attendees
754 754
 				);
755
-			$aee = array_merge( $this->_default_addressee_data, $aee );
756
-			$addressees[] = new EE_Messages_Addressee( $aee );
755
+			$aee = array_merge($this->_default_addressee_data, $aee);
756
+			$addressees[] = new EE_Messages_Addressee($aee);
757 757
 		}
758 758
 
759 759
 		return $addressees;
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 		$aee['attendees'] = $this->_data->attendees;
774 774
 
775 775
 		//great now we can instantiate the $addressee object and return (as an array);
776
-		$add[] = new EE_Messages_Addressee( $aee );
776
+		$add[] = new EE_Messages_Addressee($aee);
777 777
 		return $add;
778 778
 	}
779 779
 
@@ -792,38 +792,38 @@  discard block
 block discarded – undo
792 792
 		//use to verify unique attendee emails... we don't want to sent multiple copies to the same attendee do we?
793 793
 		$already_processed = array();
794 794
 
795
-		foreach ( $this->_data->attendees as $att_id => $details ) {
795
+		foreach ($this->_data->attendees as $att_id => $details) {
796 796
 			//set the attendee array to blank on each loop;
797 797
 			$aee = array();
798 798
 
799
-			if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) continue;
799
+			if (isset($this->_data->reg_obj) && ($this->_data->reg_obj->attendee_ID() != $att_id) && $this->_single_message) continue;
800 800
 
801 801
 			//is $this->_regs_for_sending present?  If so, let's make sure we ONLY generate addressee for registrations in that array.
802
-			if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) {
803
-				$regs_allowed = array_intersect_key( array_flip( $this->_regs_for_sending ), $details['reg_objs'] );
804
-				if ( empty( $regs_allowed ) ) {
802
+			if ( ! empty($this->_regs_for_sending) && is_array($this->_regs_for_sending)) {
803
+				$regs_allowed = array_intersect_key(array_flip($this->_regs_for_sending), $details['reg_objs']);
804
+				if (empty($regs_allowed)) {
805 805
 					continue;
806 806
 				}
807 807
 			}
808 808
 
809 809
 			if (
810
-				in_array( $details['attendee_email'], $already_processed )
811
-				&& apply_filters( 'FHEE__EE_message_type___attendee_addressees__prevent_duplicate_email_sends', true, $data, $this )
810
+				in_array($details['attendee_email'], $already_processed)
811
+				&& apply_filters('FHEE__EE_message_type___attendee_addressees__prevent_duplicate_email_sends', true, $data, $this)
812 812
 			) {
813 813
 				continue;
814 814
 			}
815 815
 
816 816
 			$already_processed[] = $details['attendee_email'];
817 817
 
818
-			foreach ( $details as $item => $value ) {
818
+			foreach ($details as $item => $value) {
819 819
 				$aee[$item] = $value;
820
-				if ( $item == 'line_ref' ) {
821
-					foreach ( $value as $event_id ) {
820
+				if ($item == 'line_ref') {
821
+					foreach ($value as $event_id) {
822 822
 						$aee['events'][$event_id] = $this->_data->events[$event_id];
823 823
 					}
824 824
 				}
825 825
 
826
-				if ( $item == 'attendee_email' ) {
826
+				if ($item == 'attendee_email') {
827 827
 					$aee['attendee_email'] = $value;
828 828
 				}
829 829
 
@@ -838,8 +838,8 @@  discard block
 block discarded – undo
838 838
 			$aee['attendees'] = $this->_data->attendees;
839 839
 
840 840
 			//merge in the primary attendee data
841
-			$aee = array_merge( $this->_default_addressee_data, $aee );
842
-			$add[] = new EE_Messages_Addressee( $aee );
841
+			$aee = array_merge($this->_default_addressee_data, $aee);
842
+			$add[] = new EE_Messages_Addressee($aee);
843 843
 		}
844 844
 
845 845
 		return $add;
@@ -864,46 +864,46 @@  discard block
 block discarded – undo
864 864
 		);
865 865
 
866 866
 		//in vanilla EE we're assuming there's only one event.  However, if there are multiple events then we'll just use the default templates instead of different templates per event (which could create problems).
867
-		if ( count($this->_data->events) === 1 ) {
868
-			foreach ( $this->_data->events as $event ) {
867
+		if (count($this->_data->events) === 1) {
868
+			foreach ($this->_data->events as $event) {
869 869
 				$EVT_ID = $event['ID'];
870 870
 			}
871 871
 		}
872 872
 		// is there a Group ID in the incoming request?
873
-		EE_Registry::instance()->load_core( 'Request_Handler' );
873
+		EE_Registry::instance()->load_core('Request_Handler');
874 874
 		// if not, set a default value of false
875
-		$GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID', false );
875
+		$GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID', false);
876 876
 		//if this is a preview then we just get whatever message group is for the preview and skip this part!
877
-		if ( $this->_preview && $GRP_ID ) {
878
-			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
877
+		if ($this->_preview && $GRP_ID) {
878
+			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
879 879
 		} else {
880 880
 			//not a preview or test send so lets continue on our way!
881 881
 			//is there an evt_id?  If so let's get that. template.
882
-			if ( !empty( $EVT_ID )  ) {
882
+			if ( ! empty($EVT_ID)) {
883 883
 				$evt_qa = array(
884 884
 					'Event.EVT_ID' => $EVT_ID
885 885
 				);
886
-				$qa = array_merge( $template_qa, $evt_qa );
887
-				$mtpg = EEM_Message_Template_Group::instance()->get_one( array( $qa ) );
886
+				$qa = array_merge($template_qa, $evt_qa);
887
+				$mtpg = EEM_Message_Template_Group::instance()->get_one(array($qa));
888 888
 			}
889 889
 
890 890
 			//is there a 'GRP_ID' ? if so let's get that.
891 891
 
892 892
 			//if global template is NOT an override, and there is a 'GRP_ID' in the request, then we'll assume a specific template has ben requested.
893
-			if ( $GRP_ID ) {
894
-				$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
893
+			if ($GRP_ID) {
894
+				$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
895 895
 			}
896 896
 
897 897
 
898 898
 			$template_qa['MTP_is_global'] = TRUE;
899 899
 
900 900
 			//this gets the current global template (message template group) for the active messenger and message type.
901
-			$global_mtpg = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) );
901
+			$global_mtpg = EEM_Message_Template_Group::instance()->get_one(array($template_qa));
902 902
 
903
-			$mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get( 'MTP_is_override' ) ? $mtpg : $global_mtpg;
903
+			$mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get('MTP_is_override') ? $mtpg : $global_mtpg;
904 904
 		}
905 905
 
906
-		if ( ! $mtpg instanceof EE_Message_Template_Group ) {
906
+		if ( ! $mtpg instanceof EE_Message_Template_Group) {
907 907
 			//get out because we can't process anything, there are no message template groups
908 908
 			// and thus some sort of bad setup issues.
909 909
 			return false;
@@ -919,8 +919,8 @@  discard block
 block discarded – undo
919 919
 
920 920
 
921 921
 
922
-		foreach ( $templates as $context => $template_fields ) {
923
-			foreach( $template_fields as $template_field=> $template_obj ) {
922
+		foreach ($templates as $context => $template_fields) {
923
+			foreach ($template_fields as $template_field=> $template_obj) {
924 924
 				$this->_templates[$template_field][$context] = $template_obj->get('MTP_content');
925 925
 			}
926 926
 		}
@@ -935,11 +935,11 @@  discard block
 block discarded – undo
935 935
 	protected function _assemble_messages() {
936 936
 		//make sure any set messages object is cleared
937 937
 		$this->messages = array();
938
-		foreach ( $this->_addressees as $context => $addressees ) {
939
-			foreach ( $addressees as $addressee ) {
938
+		foreach ($this->_addressees as $context => $addressees) {
939
+			foreach ($addressees as $addressee) {
940 940
 				$message = $this->_setup_message_object($context, $addressee);
941 941
 				//only assign message if everything went okay
942
-				if ( $message ) {
942
+				if ($message) {
943 943
 					$message->template_pack = $this->_template_pack;
944 944
 					$message->variation = $this->_variation;
945 945
 					$this->messages[] = $message;
@@ -963,22 +963,22 @@  discard block
 block discarded – undo
963 963
 		$m_shortcodes = $this->_active_messenger->get_valid_shortcodes();
964 964
 
965 965
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because this context is turned off) EXCEPT if we're previewing
966
-		if ( ( isset( $this->_templates['to'][$context] ) && empty( $this->_templates['to'][$context] ) ) && !$this->_preview )
966
+		if ((isset($this->_templates['to'][$context]) && empty($this->_templates['to'][$context])) && ! $this->_preview)
967 967
 			return false;
968 968
 
969
-		if ( empty( $this->_templates ) ) {
969
+		if (empty($this->_templates)) {
970 970
 			//unable to setup any messages because there are no templates.  Some sort of catastrophic setup
971 971
 			//issue exists
972 972
 			return false;
973 973
 		}
974 974
 
975
-		foreach ( $this->_templates as $field => $ctxt ) {
975
+		foreach ($this->_templates as $field => $ctxt) {
976 976
 			//let's setup the valid shortcodes for the incoming context.
977 977
 			$valid_shortcodes = $mt_shortcodes[$context];
978 978
 			//merge in valid shortcodes for the field.
979 979
 			$shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes;
980
-			if ( isset( $this->_templates[$field][$context] ) ) {
981
-				$message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID );
980
+			if (isset($this->_templates[$field][$context])) {
981
+				$message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID);
982 982
 			}
983 983
 		}
984 984
 		return $message;
Please login to merge, or discard this patch.
Braces   +21 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -280,7 +281,9 @@  discard block
 block discarded – undo
280 281
 
281 282
 		//this is a special method that allows child message types to trigger an exit from generating messages early (in cases where there may be a delay on send).
282 283
 		$exit = $this->_trigger_exit();
283
-		if ( $exit && ! $this->_preview ) return FALSE;
284
+		if ( $exit && ! $this->_preview ) {
285
+			return FALSE;
286
+		}
284 287
 
285 288
 		//todo: need to move require into registration hook but for now we'll require here.
286 289
 		EE_Registry::instance()->load_helper( 'Parse_Shortcodes' );
@@ -305,7 +308,9 @@  discard block
 block discarded – undo
305 308
 		$exit = $this->_init_data();
306 309
 
307 310
 		//final check for if we exit or not cause child objects may have run conditionals that cleared out data so no addresees generated.
308
-		if ( $exit ) return FALSE;
311
+		if ( $exit ) {
312
+			return FALSE;
313
+		}
309 314
 
310 315
 		$this->_get_templates(); //get the templates that have been set with this type and for the given messenger that have been saved in the database.
311 316
 		$this->_assemble_messages();
@@ -619,14 +624,17 @@  discard block
 block discarded – undo
619 624
 	protected function _process_data() {
620 625
 		//at a minimum, we NEED EE_Attendee objects.
621 626
 
622
-		if ( empty( $this->_data->attendees ) )
623
-			return TRUE;  //EXIT!
627
+		if ( empty( $this->_data->attendees ) ) {
628
+					return TRUE;
629
+		}
630
+		//EXIT!
624 631
 
625 632
 		//process addressees for each context.  Child classes will have to have methods for each context defined to handle the processing of the data object within them
626 633
 		foreach ( $this->_contexts as $context => $details ) {
627 634
 			$xpctd_method = '_' . $context . '_addressees';
628
-			if ( !method_exists( $this, $xpctd_method ) )
629
-				throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so.  The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) );
635
+			if ( !method_exists( $this, $xpctd_method ) ) {
636
+							throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so.  The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) );
637
+			}
630 638
 			 $this->_addressees[$context] = call_user_func( array( $this, $xpctd_method ) );
631 639
 		}
632 640
 		return FALSE; //DON'T EXIT
@@ -796,7 +804,9 @@  discard block
 block discarded – undo
796 804
 			//set the attendee array to blank on each loop;
797 805
 			$aee = array();
798 806
 
799
-			if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) continue;
807
+			if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) {
808
+				continue;
809
+			}
800 810
 
801 811
 			//is $this->_regs_for_sending present?  If so, let's make sure we ONLY generate addressee for registrations in that array.
802 812
 			if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) {
@@ -963,8 +973,9 @@  discard block
 block discarded – undo
963 973
 		$m_shortcodes = $this->_active_messenger->get_valid_shortcodes();
964 974
 
965 975
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because this context is turned off) EXCEPT if we're previewing
966
-		if ( ( isset( $this->_templates['to'][$context] ) && empty( $this->_templates['to'][$context] ) ) && !$this->_preview )
967
-			return false;
976
+		if ( ( isset( $this->_templates['to'][$context] ) && empty( $this->_templates['to'][$context] ) ) && !$this->_preview ) {
977
+					return false;
978
+		}
968 979
 
969 980
 		if ( empty( $this->_templates ) ) {
970 981
 			//unable to setup any messages because there are no templates.  Some sort of catastrophic setup
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_Payment_Method_Manager.lib.php 2 patches
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public static function instance() {
37 37
 		// check if class object is instantiated, and instantiated properly
38
-		if ( ! self::$_instance instanceof EE_Payment_Method_Manager ) {
38
+		if ( ! self::$_instance instanceof EE_Payment_Method_Manager) {
39 39
 			self::$_instance = new self();
40 40
 		}
41 41
 		EE_Registry::instance()->load_lib('PMT_Base');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * Resets the instance and returns a new one
47 47
 	 * @return EE_Payment_Method_Manager
48 48
 	 */
49
-	public static function reset(){
49
+	public static function reset() {
50 50
 		self::$_instance = NULL;
51 51
 		return self::instance();
52 52
 	}
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 * or just re-use the PMTs we found last time we checked during this request (if
58 58
 	 * we have not yet checked during this request, then we need to check anyways)
59 59
 	 */
60
-	public function maybe_register_payment_methods( $force_recheck = FALSE ){
61
-		if( ! $this->_payment_method_types || $force_recheck ){
60
+	public function maybe_register_payment_methods($force_recheck = FALSE) {
61
+		if ( ! $this->_payment_method_types || $force_recheck) {
62 62
 			$this->_register_payment_methods();
63 63
 			//if in admin lets ensure caps are set.
64
-			if ( is_admin() ) {
65
-				add_filter( 'FHEE__EE_Capabilities__init_caps_map__caps', array( $this, 'add_payment_method_caps' ) );
64
+			if (is_admin()) {
65
+				add_filter('FHEE__EE_Capabilities__init_caps_map__caps', array($this, 'add_payment_method_caps'));
66 66
 				EE_Registry::instance()->CAP->init_caps();
67 67
 			}
68 68
 		}
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function _register_payment_methods() {
77 77
 		// grab list of installed modules
78
-		$pm_to_register = glob( EE_PAYMENT_METHODS . '*', GLOB_ONLYDIR );
78
+		$pm_to_register = glob(EE_PAYMENT_METHODS.'*', GLOB_ONLYDIR);
79 79
 		// filter list of modules to register
80
-		$pm_to_register = apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register );
80
+		$pm_to_register = apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register);
81 81
 
82 82
 		// loop through folders
83
-		foreach ( $pm_to_register as $pm_path ) {
84
-				$this->register_payment_method( $pm_path );
83
+		foreach ($pm_to_register as $pm_path) {
84
+				$this->register_payment_method($pm_path);
85 85
 		}
86
-		do_action( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods' );
86
+		do_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods');
87 87
 		// filter list of installed modules
88 88
 		//keep them organized alphabetically by the payment method type's name
89
-		ksort( $this->_payment_method_types );
90
-		return apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types );
89
+		ksort($this->_payment_method_types);
90
+		return apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types);
91 91
 	}
92 92
 
93 93
 
@@ -99,35 +99,35 @@  discard block
 block discarded – undo
99 99
 	 * @param string $payment_method_path - full path up to and including payment method folder
100 100
 	 * @return boolean
101 101
 	 */
102
-	public function register_payment_method( $payment_method_path = '' ) {
103
-		do_action( 'AHEE__EE_Payment_Method_Manager__register_payment_method__begin',$payment_method_path );
102
+	public function register_payment_method($payment_method_path = '') {
103
+		do_action('AHEE__EE_Payment_Method_Manager__register_payment_method__begin', $payment_method_path);
104 104
 		$module_ext = '.pm.php';
105 105
 		// make all separators match
106
-		$payment_method_path = rtrim( str_replace( '/\\', DS, $payment_method_path ), DS );
106
+		$payment_method_path = rtrim(str_replace('/\\', DS, $payment_method_path), DS);
107 107
 		// grab and sanitize module name
108
-		$module_dir = basename( $payment_method_path );
108
+		$module_dir = basename($payment_method_path);
109 109
 		// create classname from module directory name
110
-		$module = str_replace( ' ', '_', str_replace( '_', ' ', $module_dir ));
110
+		$module = str_replace(' ', '_', str_replace('_', ' ', $module_dir));
111 111
 		// add class prefix
112
-		$module_class = 'EE_PMT_' . $module;
112
+		$module_class = 'EE_PMT_'.$module;
113 113
 		// does the module exist ?
114
-		if ( ! is_readable( $payment_method_path . DS . $module_class . $module_ext )) {
115
-			$msg = sprintf( __( 'The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
116
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
114
+		if ( ! is_readable($payment_method_path.DS.$module_class.$module_ext)) {
115
+			$msg = sprintf(__('The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
116
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
117 117
 			return FALSE;
118 118
 		}
119
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->start_timer(); }
119
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->start_timer(); }
120 120
 		// load the module class file
121
-		require_once( $payment_method_path . DS . $module_class . $module_ext );
122
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
121
+		require_once($payment_method_path.DS.$module_class.$module_ext);
122
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
123 123
 		// verify that class exists
124
-		if ( ! class_exists( $module_class )) {
125
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
126
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
124
+		if ( ! class_exists($module_class)) {
125
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
126
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
127 127
 			return FALSE;
128 128
 		}
129 129
 		// add to array of registered modules
130
-		$this->_payment_method_types[ $module ] = $payment_method_path . DS . $module_class . $module_ext;
130
+		$this->_payment_method_types[$module] = $payment_method_path.DS.$module_class.$module_ext;
131 131
 		return TRUE;
132 132
 	}
133 133
 	/**
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
137 137
 	 * @return boolean
138 138
 	 */
139
-	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE){
140
-		if ( ! is_array( $this->_payment_method_types ) || ! isset( $this->_payment_method_types[$payment_method_name] )
141
-				|| $force_recheck ) {
139
+	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE) {
140
+		if ( ! is_array($this->_payment_method_types) || ! isset($this->_payment_method_types[$payment_method_name])
141
+				|| $force_recheck) {
142 142
 			$this->maybe_register_payment_methods($force_recheck);
143 143
 		}
144
-		if(isset($this->_payment_method_types[$payment_method_name])){
144
+		if (isset($this->_payment_method_types[$payment_method_name])) {
145 145
 			require_once($this->_payment_method_types[$payment_method_name]);
146 146
 			return true;
147
-		}else{
147
+		} else {
148 148
 			return false;
149 149
 		}
150 150
 	}
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
156 156
 	 * @return array
157 157
 	 */
158
-	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE ){
158
+	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE) {
159 159
 		$this->maybe_register_payment_methods($force_recheck);
160
-		if($with_prefixes){
160
+		if ($with_prefixes) {
161 161
 			$classnames = array_keys($this->_payment_method_types);
162 162
 			$payment_methods = array();
163
-			foreach($classnames as $classname){
163
+			foreach ($classnames as $classname) {
164 164
 				$payment_methods[] = $this->payment_method_class_from_type($classname);
165 165
 			}
166 166
 			return $payment_methods;
167
-		}else{
167
+		} else {
168 168
 			return array_keys($this->_payment_method_types);
169 169
 		}
170 170
 	}
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
175 175
 	 * @return EE_PMT_Base[]
176 176
 	 */
177
-	public function payment_method_types( $force_recheck = FALSE ){
177
+	public function payment_method_types($force_recheck = FALSE) {
178 178
 		$this->maybe_register_payment_methods($force_recheck);
179 179
 		$pmt_objs = array();
180
-		foreach($this->payment_method_type_names(true) as $classname){
180
+		foreach ($this->payment_method_type_names(true) as $classname) {
181 181
 			$pmt_objs[] = new $classname;
182 182
 		}
183 183
 		return $pmt_objs;
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	 * @param string $classname
190 190
 	 * @return string
191 191
 	 */
192
-	public function payment_method_type_sans_class_prefix($classname){
193
-		$pmt_name = str_replace("EE_PMT_","",$classname);
192
+	public function payment_method_type_sans_class_prefix($classname) {
193
+		$pmt_name = str_replace("EE_PMT_", "", $classname);
194 194
 		return $pmt_name;
195 195
 	}
196 196
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @param string $type
200 200
 	 * @return string
201 201
 	 */
202
-	public function payment_method_class_from_type($type){
202
+	public function payment_method_class_from_type($type) {
203 203
 		$this->maybe_register_payment_methods();
204 204
 		return "EE_PMT_".$type;
205 205
 	}
@@ -213,38 +213,38 @@  discard block
 block discarded – undo
213 213
 	 * @return \EE_Payment_Method
214 214
 	 * @throws \EE_Error
215 215
 	 */
216
-	public function activate_a_payment_method_of_type( $payment_method_type ){
216
+	public function activate_a_payment_method_of_type($payment_method_type) {
217 217
 		$payment_method = EEM_Payment_Method::instance()->get_one_of_type($payment_method_type);
218
-		if( ! $payment_method instanceof EE_Payment_Method ){
218
+		if ( ! $payment_method instanceof EE_Payment_Method) {
219 219
 			$pm_type_class = $this->payment_method_class_from_type($payment_method_type);
220
-			if(class_exists($pm_type_class)){
220
+			if (class_exists($pm_type_class)) {
221 221
 				/** @var $pm_type_obj EE_PMT_Base */
222 222
 				$pm_type_obj = new $pm_type_class;
223 223
 				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug($pm_type_obj->system_name());
224
-				if( ! $payment_method){
225
-					$payment_method = $this->create_payment_method_of_type( $pm_type_obj );
224
+				if ( ! $payment_method) {
225
+					$payment_method = $this->create_payment_method_of_type($pm_type_obj);
226 226
 				}
227
-				$payment_method->set_type( $payment_method_type );
228
-				$this->initialize_payment_method( $payment_method );
227
+				$payment_method->set_type($payment_method_type);
228
+				$this->initialize_payment_method($payment_method);
229 229
 			} else {
230 230
 				throw new EE_Error(
231 231
 					sprintf(
232
-						__( 'There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
232
+						__('There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
233 233
 						$pm_type_class )
234 234
 				);
235 235
 			}
236 236
 		}
237 237
 		$payment_method->set_active();
238 238
 		$payment_method->save();
239
-		$this->set_usable_currencies_on_payment_method( $payment_method );
240
-		if( $payment_method->type() == 'Invoice' ){
241
-			$messages = EE_Registry::instance()->load_lib( 'messages' );
242
-			$messages->ensure_message_type_is_active( 'invoice', 'html' );
243
-			$messages->ensure_messenger_is_active( 'pdf' );
239
+		$this->set_usable_currencies_on_payment_method($payment_method);
240
+		if ($payment_method->type() == 'Invoice') {
241
+			$messages = EE_Registry::instance()->load_lib('messages');
242
+			$messages->ensure_message_type_is_active('invoice', 'html');
243
+			$messages->ensure_messenger_is_active('pdf');
244 244
 			EE_Error::add_attention(
245 245
 				sprintf(
246
-					__( 'Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso' ),
247
-					'<a href="' . admin_url( 'admin.php?page=espresso_messages') . '">',
246
+					__('Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso'),
247
+					'<a href="'.admin_url('admin.php?page=espresso_messages').'">',
248 248
 					'</a>'
249 249
 				)
250 250
 			);
@@ -258,17 +258,17 @@  discard block
 block discarded – undo
258 258
 	 * @param EE_PMT_Base $pm_type_obj
259 259
 	 * @return EE_Payment_Method
260 260
 	 */
261
-	public function create_payment_method_of_type( $pm_type_obj ) {
261
+	public function create_payment_method_of_type($pm_type_obj) {
262 262
 		global $current_user;
263 263
 		$payment_method = EE_Payment_Method::new_instance(
264 264
 			array(
265 265
 				'PMD_type' 		 => $pm_type_obj->system_name(),
266 266
 				'PMD_name' 		 => $pm_type_obj->pretty_name(),
267 267
 				'PMD_admin_name' => $pm_type_obj->pretty_name(),
268
-				'PMD_slug' 		 => $pm_type_obj->system_name(),//automatically converted to slug
268
+				'PMD_slug' 		 => $pm_type_obj->system_name(), //automatically converted to slug
269 269
 				'PMD_wp_user' 	 => $current_user->ID,
270 270
 				'PMD_order' 	 => EEM_Payment_Method::instance()->count(
271
-						array( array( 'PMD_type' => array( '!=', 'Admin_Only' )))
271
+						array(array('PMD_type' => array('!=', 'Admin_Only')))
272 272
 					) * 10,
273 273
 			)
274 274
 		);
@@ -280,21 +280,21 @@  discard block
 block discarded – undo
280 280
 	 * @param EE_Payment_Method $payment_method
281 281
 	 * @return EE_Payment_Method
282 282
 	 */
283
-	public function initialize_payment_method( $payment_method ) {
283
+	public function initialize_payment_method($payment_method) {
284 284
 		$pm_type_obj = $payment_method->type_obj();
285
-		$payment_method->set_description( $pm_type_obj->default_description() );
286
-		if( ! $payment_method->button_url() ){
287
-			$payment_method->set_button_url( $pm_type_obj->default_button_url() );
285
+		$payment_method->set_description($pm_type_obj->default_description());
286
+		if ( ! $payment_method->button_url()) {
287
+			$payment_method->set_button_url($pm_type_obj->default_button_url());
288 288
 		}
289 289
 		//now add setup its default extra meta properties
290 290
 		$extra_metas = $pm_type_obj->settings_form()->extra_meta_inputs();
291
-		if ( ! empty( $extra_metas ) ) {
291
+		if ( ! empty($extra_metas)) {
292 292
 			//verify the payment method has an ID before adding extra meta
293
-			if ( ! $payment_method->ID() ) {
293
+			if ( ! $payment_method->ID()) {
294 294
 				$payment_method->save();
295 295
 			}
296
-			foreach ( $extra_metas as $meta_name => $input ) {
297
-				$payment_method->update_extra_meta( $meta_name, $input->raw_value() );
296
+			foreach ($extra_metas as $meta_name => $input) {
297
+				$payment_method->update_extra_meta($meta_name, $input->raw_value());
298 298
 			}
299 299
 		}
300 300
 		return $payment_method;
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 	 * @param EE_Payment_Method $payment_method
306 306
 	 * @return EE_Payment_Method
307 307
 	 */
308
-	public function set_usable_currencies_on_payment_method( $payment_method ) {
309
-		foreach($payment_method->get_all_usable_currencies() as $currency_obj){
308
+	public function set_usable_currencies_on_payment_method($payment_method) {
309
+		foreach ($payment_method->get_all_usable_currencies() as $currency_obj) {
310 310
 			$payment_method->_add_relation_to($currency_obj, 'Currency');
311 311
 		}
312 312
 		return $payment_method;
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 	 *
325 325
 	 * @return int count of rows updated.
326 326
 	 */
327
-	public function deactivate_payment_method( $payment_method_slug ) {
328
-		$count_updated = EEM_Payment_Method::instance()->update(array('PMD_scope'=>array()),array(array('PMD_slug'=>$payment_method_slug)));
327
+	public function deactivate_payment_method($payment_method_slug) {
328
+		$count_updated = EEM_Payment_Method::instance()->update(array('PMD_scope'=>array()), array(array('PMD_slug'=>$payment_method_slug)));
329 329
 		return $count_updated;
330 330
 	}
331 331
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 	 * @param array $caps capabilities being filtered
339 339
 	 * @return array
340 340
 	 */
341
-	public function add_payment_method_caps( $caps ) {
341
+	public function add_payment_method_caps($caps) {
342 342
 		/* add dynamic caps from payment methods
343 343
 		 * at the time of writing, october 20 2014, these are the caps added:
344 344
 		 * ee_payment_method_admin_only
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		 * their related capability automatically added too, so long as they are
354 354
 		 * registered properly using EE_Register_Payment_Method::register()
355 355
 		 */
356
-		foreach( $this->payment_method_types() as $payment_method_type_obj ){
356
+		foreach ($this->payment_method_types() as $payment_method_type_obj) {
357 357
 			$caps['administrator'][] = $payment_method_type_obj->cap_name();
358 358
 		}
359 359
 		return $caps;
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- *
4
- * Class EE_Payment_Method_Manager
5
- *
6
- * Used for finding all payment method types that can be defined.
7
- * Allows addons to easily add other payment methods
8
- *
9
- * @package     Event Espresso
10
- * @subpackage 	core
11
- * @author      Michael Nelson
12
- * @since       4.5
13
- *
14
- */
3
+	 *
4
+	 * Class EE_Payment_Method_Manager
5
+	 *
6
+	 * Used for finding all payment method types that can be defined.
7
+	 * Allows addons to easily add other payment methods
8
+	 *
9
+	 * @package     Event Espresso
10
+	 * @subpackage 	core
11
+	 * @author      Michael Nelson
12
+	 * @since       4.5
13
+	 *
14
+	 */
15 15
 class EE_Payment_Method_Manager {
16 16
 
17 17
 	/**
Please login to merge, or discard this patch.
core/libraries/rest_api/changes/Changes_In_4_8_33.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 		//is for lower than 4.8.33
14 14
 		add_filter( 
15 15
 			'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes',
16
-			array( $this, 'remove_checkin_routes_earlier_than_4_8_33' ),
16
+			array($this, 'remove_checkin_routes_earlier_than_4_8_33'),
17 17
 			10,
18 18
 			2
19 19
 		);
20 20
 		add_filter( 
21 21
 			'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_headers_from_ee_notices__return',
22
-			array( $this, 'dont_add_headers_from_ee_notices' ),
22
+			array($this, 'dont_add_headers_from_ee_notices'),
23 23
 			10,
24 24
 			2
25 25
 		);
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 * @param string $version
33 33
 	 * @return array like $routes_on_this_version
34 34
 	 */
35
-	public function remove_checkin_routes_earlier_than_4_8_33( $routes_on_this_version, $version ) {
36
-		if( $this->applies_to_version(  $version ) ) {
37
-			unset( $routes_on_this_version[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] );
35
+	public function remove_checkin_routes_earlier_than_4_8_33($routes_on_this_version, $version) {
36
+		if ($this->applies_to_version($version)) {
37
+			unset($routes_on_this_version['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)']);
38 38
 		}
39 39
 		return $routes_on_this_version;
40 40
 	}
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @param string $requested_version
46 46
 	 * @return array
47 47
 	 */
48
-	public function dont_add_headers_from_ee_notices( $headers_from_ee_notices, $requested_version ) {
49
-		if( $this->applies_to_version(  $requested_version ) ) {
48
+	public function dont_add_headers_from_ee_notices($headers_from_ee_notices, $requested_version) {
49
+		if ($this->applies_to_version($requested_version)) {
50 50
 			return array();
51 51
 		}
52 52
 		return $headers_from_ee_notices;
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_Page.core.php 1 patch
Spacing   +243 added lines, -243 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
 /**
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 	protected function _init_page_props() {
65
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
65
+		require_once(EE_MODELS.'EEM_Venue.model.php');
66 66
 		$this->page_slug = EE_VENUES_PG_SLUG;
67 67
 		$this->_admin_base_url = EE_VENUES_ADMIN_URL;
68
-		$this->_admin_base_path = EE_ADMIN_PAGES . 'venues';
68
+		$this->_admin_base_path = EE_ADMIN_PAGES.'venues';
69 69
 		$this->page_label = __('Event Venues', 'event_espresso');
70 70
 		$this->_cpt_model_names = array(
71 71
 			'create_new' => 'EEM_Venue',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 				'edit' => __('Update Venue', 'event_espresso'),
109 109
 				'add_category' => __('Save New Category', 'event_espresso'),
110 110
 				'edit_category' => __('Update Category', 'event_espresso'),
111
-				'google_map_settings' => __( 'Update Settings', 'event_espresso' )
111
+				'google_map_settings' => __('Update Settings', 'event_espresso')
112 112
 				)
113 113
 		);
114 114
 	}
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	protected function _set_page_routes() {
121 121
 
122 122
 		//load formatter helper
123
-		EE_Registry::instance()->load_helper( 'Formatter' );
123
+		EE_Registry::instance()->load_helper('Formatter');
124 124
 		//load field generator helper
125
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
125
+		EE_Registry::instance()->load_helper('Form_Fields');
126 126
 
127 127
 		//is there a vnu_id in the request?
128
-		$vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0;
129
-		$vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id;
128
+		$vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0;
129
+		$vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id;
130 130
 
131 131
 		$this->_page_routes = array(
132 132
 			'default' => array(
@@ -144,27 +144,27 @@  discard block
 block discarded – undo
144 144
 				),
145 145
 			'trash_venue' => array(
146 146
 				'func' => '_trash_or_restore_venue',
147
-				'args' => array( 'venue_status' => 'trash' ),
147
+				'args' => array('venue_status' => 'trash'),
148 148
 				'noheader' => TRUE,
149 149
 				'capability' => 'ee_delete_venue',
150 150
 				'obj_id' => $vnu_id
151 151
 				),
152 152
 			'trash_venues' => array(
153 153
 				'func' => '_trash_or_restore_venues',
154
-				'args' => array( 'venue_status' => 'trash' ),
154
+				'args' => array('venue_status' => 'trash'),
155 155
 				'noheader' => TRUE,
156 156
 				'capability' => 'ee_delete_venues'
157 157
 				),
158 158
 			'restore_venue' => array(
159 159
 				'func' => '_trash_or_restore_venue',
160
-				'args' => array( 'venue_status' => 'draft' ),
160
+				'args' => array('venue_status' => 'draft'),
161 161
 				'noheader' => TRUE,
162 162
 				'capability' => 'ee_delete_venue',
163 163
 				'obj_id' => $vnu_id
164 164
 				),
165 165
 			'restore_venues' => array(
166 166
 				'func' => '_trash_or_restore_venues',
167
-				'args' => array( 'venue_status' => 'draft' ),
167
+				'args' => array('venue_status' => 'draft'),
168 168
 				'noheader' => TRUE,
169 169
 				'capability' => 'ee_delete_venues'
170 170
 				),
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 						'filename' => 'venues_overview_views_bulk_actions_search'
267 267
 					)
268 268
 				),
269
-				'help_tour' => array( 'Venues_Overview_Help_Tour' ),
269
+				'help_tour' => array('Venues_Overview_Help_Tour'),
270 270
 				'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
271 271
 				'require_nonce' => FALSE
272 272
 			),
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 						'filename' => 'venues_editor_other'
303 303
 					)
304 304
 				),
305
-				'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ),
305
+				'help_tour' => array('Venues_Add_Venue_Help_Tour'),
306 306
 				'metaboxes' => array('_venue_editor_metaboxes'),
307 307
 				'require_nonce' => FALSE
308 308
 				),
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 					'label' => __('Edit Venue', 'event_espresso'),
312 312
 					'order' => 5,
313 313
 					'persistent' => FALSE,
314
-					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url )  : $this->_admin_base_url
314
+					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url
315 315
 				),
316 316
 				'help_tabs' => array(
317 317
 					'venues_editor_help_tab' => array(
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 					'label' => __('Google Maps'),
349 349
 					'order' => 40
350 350
 				),
351
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
351
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
352 352
 				'help_tabs' => array(
353 353
 					'general_settings_google_maps_help_tab' => array(
354 354
 						'title' => __('Google Maps', 'event_espresso'),
355 355
 						'filename' => 'general_settings_google_maps'
356 356
 					)
357 357
 				),
358
-				'help_tour' => array( 'Google_Maps_Help_Tour' ),
358
+				'help_tour' => array('Google_Maps_Help_Tour'),
359 359
 				'require_nonce' => FALSE
360 360
 			),
361 361
 			//venue category stuff
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 						'filename' => 'venues_add_category'
372 372
 					)
373 373
 				),
374
-				'help_tour' => array( 'Venues_Add_Category_Help_Tour' ),
374
+				'help_tour' => array('Venues_Add_Category_Help_Tour'),
375 375
 				'require_nonce' => FALSE
376 376
 				),
377 377
 			'edit_category' => array(
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 					'label' => __('Edit Category', 'event_espresso'),
380 380
 					'order' => 15,
381 381
 					'persistent' => FALSE,
382
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
382
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
383 383
 					),
384 384
 				'metaboxes' => array('_publish_post_box'),
385 385
 				'help_tabs' => array(
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 						'filename' => 'venues_categories_other'
416 416
 					)
417 417
 				),
418
-				'help_tour' => array( 'Venues_Categories_Help_Tour' ),
418
+				'help_tour' => array('Venues_Categories_Help_Tour'),
419 419
 				'metaboxes' => $this->_default_espresso_metaboxes,
420 420
 				'require_nonce' => FALSE
421 421
 				)
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 
473 473
 
474 474
 	public function load_scripts_styles() {
475
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
475
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
476 476
 		wp_enqueue_style('ee-cat-admin');
477 477
 	}
478 478
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	public function load_scripts_styles_edit() {
496 496
 		//styles
497 497
 		wp_enqueue_style('espresso-ui-theme');
498
-		wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION );
498
+		wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION);
499 499
 		wp_enqueue_style('espresso_venues');
500 500
 	}
501 501
 
@@ -514,13 +514,13 @@  discard block
 block discarded – undo
514 514
 				)
515 515
 		);
516 516
 
517
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) {
517
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
518 518
 			$this->_views['all']['bulk_action'] = array(
519 519
 				'trash_venues' => __('Move to Trash', 'event_espresso')
520 520
 			);
521 521
 			$this->_views['trash'] = array(
522 522
 				'slug' => 'trash',
523
-				'label' => __( 'Trash', 'event_espresso' ),
523
+				'label' => __('Trash', 'event_espresso'),
524 524
 				'count' => 0,
525 525
 				'bulk_action' => array(
526 526
 					'restore_venues' => __('Restore from Trash', 'event_espresso'),
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 
554 554
 
555 555
 	protected function _overview_list_table() {
556
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
557
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' );
556
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
557
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button');
558 558
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
559 559
 		$this->_search_btn_label = __('Venues', 'event_espresso');
560 560
 		$this->display_admin_list_table_page_with_sidebar();
@@ -568,8 +568,8 @@  discard block
 block discarded – undo
568 568
 			'vnu_url' => $this->_cpt_model_obj->venue_url(),
569 569
 			'vnu_phone' => $this->_cpt_model_obj->phone()
570 570
 			);
571
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php';
572
-		EEH_Template::display_template( $template, $extra_rows );
571
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php';
572
+		EEH_Template::display_template($template, $extra_rows);
573 573
 	}
574 574
 
575 575
 
@@ -584,115 +584,115 @@  discard block
 block discarded – undo
584 584
 		$default_map_settings = new stdClass();
585 585
 		$default_map_settings->use_google_maps = TRUE;
586 586
 		// for event details pages (reg page)
587
-		$default_map_settings->event_details_map_width = 585; 			// ee_map_width_single
588
-		$default_map_settings->event_details_map_height = 362; 			// ee_map_height_single
589
-		$default_map_settings->event_details_map_zoom = 14; 			// ee_map_zoom_single
590
-		$default_map_settings->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
591
-		$default_map_settings->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
592
-		$default_map_settings->event_details_control_type = 'default'; 		// ee_map_type_control_single
593
-		$default_map_settings->event_details_map_align = 'center'; 			// ee_map_align_single
587
+		$default_map_settings->event_details_map_width = 585; // ee_map_width_single
588
+		$default_map_settings->event_details_map_height = 362; // ee_map_height_single
589
+		$default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single
590
+		$default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single
591
+		$default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single
592
+		$default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single
593
+		$default_map_settings->event_details_map_align = 'center'; // ee_map_align_single
594 594
 		// for event list pages
595
-		$default_map_settings->event_list_map_width = 300; 			// ee_map_width
596
-		$default_map_settings->event_list_map_height = 185; 		// ee_map_height
597
-		$default_map_settings->event_list_map_zoom = 12; 			// ee_map_zoom
598
-		$default_map_settings->event_list_display_nav = FALSE; 		// ee_map_nav_display
599
-		$default_map_settings->event_list_nav_size = TRUE; 			// ee_map_nav_size
600
-		$default_map_settings->event_list_control_type = 'dropdown'; 		// ee_map_type_control
601
-		$default_map_settings->event_list_map_align = 'center'; 			// ee_map_align
595
+		$default_map_settings->event_list_map_width = 300; // ee_map_width
596
+		$default_map_settings->event_list_map_height = 185; // ee_map_height
597
+		$default_map_settings->event_list_map_zoom = 12; // ee_map_zoom
598
+		$default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display
599
+		$default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size
600
+		$default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control
601
+		$default_map_settings->event_list_map_align = 'center'; // ee_map_align
602 602
 
603 603
 		$this->_template_args['map_settings'] =
604
-			isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings )
605
-				? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings )
604
+			isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings)
605
+				? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings)
606 606
 				: $default_map_settings;
607 607
 
608
-		$this->_set_add_edit_form_tags( 'update_google_map_settings' );
609
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
610
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', $this->_template_args, TRUE );
608
+		$this->_set_add_edit_form_tags('update_google_map_settings');
609
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
610
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_VENUES_TEMPLATE_PATH.'google_map.template.php', $this->_template_args, TRUE);
611 611
 		$this->display_admin_page_with_sidebar();
612 612
 	}
613 613
 
614 614
 	protected function _update_google_map_settings() {
615 615
 
616 616
 		EE_Registry::instance()->CFG->map_settings->use_google_maps =
617
-			isset( $this->_req_data['use_google_maps'] )
618
-				? absint( $this->_req_data['use_google_maps'] )
617
+			isset($this->_req_data['use_google_maps'])
618
+				? absint($this->_req_data['use_google_maps'])
619 619
 				: EE_Registry::instance()->CFG->map_settings->use_google_maps;
620 620
 
621 621
 		EE_Registry::instance()->CFG->map_settings->event_details_map_width =
622
-			isset( $this->_req_data['event_details_map_width'] )
623
-				? absint( $this->_req_data['event_details_map_width'] )
622
+			isset($this->_req_data['event_details_map_width'])
623
+				? absint($this->_req_data['event_details_map_width'])
624 624
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_width;
625 625
 
626 626
 		EE_Registry::instance()->CFG->map_settings->event_details_map_height =
627
-			isset( $this->_req_data['event_details_map_height'] )
628
-				? absint( $this->_req_data['event_details_map_height'] )
627
+			isset($this->_req_data['event_details_map_height'])
628
+				? absint($this->_req_data['event_details_map_height'])
629 629
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_height;
630 630
 
631 631
 		EE_Registry::instance()->CFG->map_settings->event_details_map_zoom =
632
-			isset( $this->_req_data['event_details_map_zoom'] )
633
-				? absint( $this->_req_data['event_details_map_zoom'] )
632
+			isset($this->_req_data['event_details_map_zoom'])
633
+				? absint($this->_req_data['event_details_map_zoom'])
634 634
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_zoom;
635 635
 
636 636
 		EE_Registry::instance()->CFG->map_settings->event_details_display_nav =
637
-			isset( $this->_req_data['event_details_display_nav'] )
638
-				? absint( $this->_req_data['event_details_display_nav'] )
637
+			isset($this->_req_data['event_details_display_nav'])
638
+				? absint($this->_req_data['event_details_display_nav'])
639 639
 				: EE_Registry::instance()->CFG->map_settings->event_details_display_nav;
640 640
 
641 641
 		EE_Registry::instance()->CFG->map_settings->event_details_nav_size =
642
-			isset( $this->_req_data['event_details_nav_size'] )
643
-				? absint( $this->_req_data['event_details_nav_size'] )
642
+			isset($this->_req_data['event_details_nav_size'])
643
+				? absint($this->_req_data['event_details_nav_size'])
644 644
 				: EE_Registry::instance()->CFG->map_settings->event_details_nav_size;
645 645
 
646 646
 		EE_Registry::instance()->CFG->map_settings->event_details_control_type =
647
-			isset( $this->_req_data['event_details_control_type'] )
648
-				? sanitize_text_field( $this->_req_data['event_details_control_type'] )
647
+			isset($this->_req_data['event_details_control_type'])
648
+				? sanitize_text_field($this->_req_data['event_details_control_type'])
649 649
 				: EE_Registry::instance()->CFG->map_settings->event_details_control_type;
650 650
 
651 651
 		EE_Registry::instance()->CFG->map_settings->event_details_map_align =
652
-			isset( $this->_req_data['event_details_map_align'] )
653
-				? sanitize_text_field( $this->_req_data['event_details_map_align'] )
652
+			isset($this->_req_data['event_details_map_align'])
653
+				? sanitize_text_field($this->_req_data['event_details_map_align'])
654 654
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_align;
655 655
 
656 656
 		EE_Registry::instance()->CFG->map_settings->event_list_map_width =
657
-			isset( $this->_req_data['event_list_map_width'] )
658
-				? absint( $this->_req_data['event_list_map_width'] )
657
+			isset($this->_req_data['event_list_map_width'])
658
+				? absint($this->_req_data['event_list_map_width'])
659 659
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_width;
660 660
 
661 661
 		EE_Registry::instance()->CFG->map_settings->event_list_map_height =
662
-			isset( $this->_req_data['event_list_map_height'] )
663
-				? absint( $this->_req_data['event_list_map_height'] )
662
+			isset($this->_req_data['event_list_map_height'])
663
+				? absint($this->_req_data['event_list_map_height'])
664 664
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_height;
665 665
 
666 666
 		EE_Registry::instance()->CFG->map_settings->event_list_map_zoom =
667
-			isset( $this->_req_data['event_list_map_zoom'] )
668
-				? absint( $this->_req_data['event_list_map_zoom'] )
667
+			isset($this->_req_data['event_list_map_zoom'])
668
+				? absint($this->_req_data['event_list_map_zoom'])
669 669
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_zoom;
670 670
 
671 671
 		EE_Registry::instance()->CFG->map_settings->event_list_display_nav =
672
-			isset( $this->_req_data['event_list_display_nav'] )
673
-				? absint( $this->_req_data['event_list_display_nav'] )
672
+			isset($this->_req_data['event_list_display_nav'])
673
+				? absint($this->_req_data['event_list_display_nav'])
674 674
 				: EE_Registry::instance()->CFG->map_settings->event_list_display_nav;
675 675
 
676 676
 		EE_Registry::instance()->CFG->map_settings->event_list_nav_size =
677
-			isset( $this->_req_data['event_list_nav_size'] )
678
-				? absint( $this->_req_data['event_list_nav_size'] )
677
+			isset($this->_req_data['event_list_nav_size'])
678
+				? absint($this->_req_data['event_list_nav_size'])
679 679
 				: EE_Registry::instance()->CFG->map_settings->event_list_nav_size;
680 680
 
681 681
 		EE_Registry::instance()->CFG->map_settings->event_list_control_type =
682
-			isset( $this->_req_data['event_list_control_type'] )
683
-				? sanitize_text_field( $this->_req_data['event_list_control_type'] )
682
+			isset($this->_req_data['event_list_control_type'])
683
+				? sanitize_text_field($this->_req_data['event_list_control_type'])
684 684
 				: EE_Registry::instance()->CFG->map_settings->event_list_control_type;
685 685
 
686 686
 		EE_Registry::instance()->CFG->map_settings->event_list_map_align =
687
-			isset( $this->_req_data['event_list_map_align'] )
688
-				? sanitize_text_field( $this->_req_data['event_list_map_align'] )
687
+			isset($this->_req_data['event_list_map_align'])
688
+				? sanitize_text_field($this->_req_data['event_list_map_align'])
689 689
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_align;
690 690
 
691
-		EE_Registry::instance()->CFG->map_settings = apply_filters( 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings );
691
+		EE_Registry::instance()->CFG->map_settings = apply_filters('FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings);
692 692
 
693 693
 		$what = 'Google Map Settings';
694
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__ );
695
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) );
694
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__);
695
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings'));
696 696
 
697 697
 	}
698 698
 
@@ -701,9 +701,9 @@  discard block
 block discarded – undo
701 701
 	protected function _venue_editor_metaboxes() {
702 702
 		$this->verify_cpt_object();
703 703
 
704
-		add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' );
705
-		add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' );
706
-		add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' );
704
+		add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default');
705
+		add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default');
706
+		add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default');
707 707
 
708 708
 	}
709 709
 
@@ -711,23 +711,23 @@  discard block
 block discarded – undo
711 711
 
712 712
 	public function venue_gmap_metabox() {
713 713
 		$template_args = array(
714
-			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ),
714
+			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()),
715 715
 			'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(),
716 716
 			);
717
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php';
718
-		EEH_Template::display_template( $template, $template_args );
717
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php';
718
+		EEH_Template::display_template($template, $template_args);
719 719
 	}
720 720
 
721 721
 
722 722
 
723 723
 	public function venue_address_metabox() {
724 724
 
725
-		$template_args['_venue'] =$this->_cpt_model_obj;
725
+		$template_args['_venue'] = $this->_cpt_model_obj;
726 726
 
727 727
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
728 728
 			$QFI = new EE_Question_Form_Input(
729
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
730
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->state_ID() )),
729
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
730
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())),
731 731
 				array(
732 732
 					'input_name' =>  'sta_id',
733 733
 					'input_id' => 'sta_id',
@@ -739,8 +739,8 @@  discard block
 block discarded – undo
739 739
 		);
740 740
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
741 741
 			$QFI = new EE_Question_Form_Input(
742
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
743
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->country_ID() )),
742
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
743
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())),
744 744
 				array(
745 745
 					'input_name' =>  'cnt_iso',
746 746
 					'input_id' => 'cnt_iso',
@@ -751,8 +751,8 @@  discard block
 block discarded – undo
751 751
 			)
752 752
 		);
753 753
 
754
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
755
-		EEH_Template::display_template( $template, $template_args );
754
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php';
755
+		EEH_Template::display_template($template, $template_args);
756 756
 	}
757 757
 
758 758
 
@@ -764,8 +764,8 @@  discard block
 block discarded – undo
764 764
 		$template_args = array(
765 765
 			'_venue' => $this->_cpt_model_obj
766 766
 			);
767
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php';
768
-		EEH_Template::display_template( $template, $template_args );
767
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php';
768
+		EEH_Template::display_template($template, $template_args);
769 769
 	}
770 770
 
771 771
 
@@ -788,52 +788,52 @@  discard block
 block discarded – undo
788 788
 	 * @param  object $post    Post object (with "blessed" WP properties)
789 789
 	 * @return void
790 790
 	 */
791
-	protected function _insert_update_cpt_item( $post_id, $post ) {
791
+	protected function _insert_update_cpt_item($post_id, $post) {
792 792
 
793
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) {
794
-			return;// get out we're not processing the saving of venues.
793
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') {
794
+			return; // get out we're not processing the saving of venues.
795 795
 		}
796 796
 
797
-		$wheres = array( $this->_venue_model->primary_key_name() => $post_id );
797
+		$wheres = array($this->_venue_model->primary_key_name() => $post_id);
798 798
 
799 799
 		$venue_values = array(
800
-			'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL,
801
-			'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL,
802
-			'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL,
803
-			'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL,
804
-			'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL,
805
-			'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL,
806
-			'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL,
807
-			'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF,
808
-			'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL,
809
-			'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL,
810
-			'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL,
811
-			'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE,
812
-			'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL
800
+			'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL,
801
+			'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL,
802
+			'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL,
803
+			'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL,
804
+			'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL,
805
+			'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL,
806
+			'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL,
807
+			'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF,
808
+			'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL,
809
+			'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL,
810
+			'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL,
811
+			'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE,
812
+			'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL
813 813
 			);
814 814
 
815 815
 		//update venue
816
-		$success = $this->_venue_model->update( $venue_values, array( $wheres ) );
816
+		$success = $this->_venue_model->update($venue_values, array($wheres));
817 817
 
818 818
 		//get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
819
-		$get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status  );
820
-		$venue = $this->_venue_model->get_one( array( $get_one_where ) );
819
+		$get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status);
820
+		$venue = $this->_venue_model->get_one(array($get_one_where));
821 821
 
822 822
 		//notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use.  So this is just here for addons to more easily hook into venue saves.
823
-		$venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() );
823
+		$venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array());
824 824
 
825 825
 		$att_success = TRUE;
826 826
 
827
-		foreach ( $venue_update_callbacks as $v_callback ) {
828
-			$_succ = call_user_func_array( $v_callback, array( $venue,  $this->_req_data ) );
829
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
827
+		foreach ($venue_update_callbacks as $v_callback) {
828
+			$_succ = call_user_func_array($v_callback, array($venue, $this->_req_data));
829
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
830 830
 		}
831 831
 
832 832
 		//any errors?
833
-		if ( $success && !$att_success ) {
834
-			EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
835
-		} else if ( $success === FALSE ) {
836
-			EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
833
+		if ($success && ! $att_success) {
834
+			EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
835
+		} else if ($success === FALSE) {
836
+			EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
837 837
 		}
838 838
 	}
839 839
 
@@ -841,9 +841,9 @@  discard block
 block discarded – undo
841 841
 
842 842
 
843 843
 
844
-	public function trash_cpt_item( $post_id ) {
844
+	public function trash_cpt_item($post_id) {
845 845
 		$this->_req_data['VNU_ID'] = $post_id;
846
-		$this->_trash_or_restore_venue( 'trash', FALSE );
846
+		$this->_trash_or_restore_venue('trash', FALSE);
847 847
 	}
848 848
 
849 849
 
@@ -851,18 +851,18 @@  discard block
 block discarded – undo
851 851
 
852 852
 
853 853
 
854
-	public function restore_cpt_item( $post_id ) {
854
+	public function restore_cpt_item($post_id) {
855 855
 		$this->_req_data['VNU_ID'] = $post_id;
856
-		$this->_trash_or_restore_venue( 'draft', FALSE );
856
+		$this->_trash_or_restore_venue('draft', FALSE);
857 857
 	}
858 858
 
859 859
 
860 860
 
861 861
 
862 862
 
863
-	public function delete_cpt_item( $post_id ) {
863
+	public function delete_cpt_item($post_id) {
864 864
 		$this->_req_data['VNU_ID'] = $post_id;
865
-		$this->_delete_venue( FALSE );
865
+		$this->_delete_venue(FALSE);
866 866
 	}
867 867
 
868 868
 
@@ -877,15 +877,15 @@  discard block
 block discarded – undo
877 877
 
878 878
 
879 879
 
880
-	protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) {
881
-		$VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE;
880
+	protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) {
881
+		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE;
882 882
 
883 883
 		//loop thru venues
884
-		if ( $VNU_ID ) {
884
+		if ($VNU_ID) {
885 885
 			//clean status
886
-			$venue_status = sanitize_key( $venue_status );
886
+			$venue_status = sanitize_key($venue_status);
887 887
 			// grab status
888
-			if (!empty($venue_status)) {
888
+			if ( ! empty($venue_status)) {
889 889
 				$success = $this->_change_venue_status($VNU_ID, $venue_status);
890 890
 			} else {
891 891
 				$success = FALSE;
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 		}
900 900
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
901 901
 
902
-		if ( $redirect_after )
902
+		if ($redirect_after)
903 903
 			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
904 904
 
905 905
 	}
@@ -908,11 +908,11 @@  discard block
 block discarded – undo
908 908
 
909 909
 
910 910
 
911
-	protected function _trash_or_restore_venues( $venue_status = 'trash' ) {
911
+	protected function _trash_or_restore_venues($venue_status = 'trash') {
912 912
 		// clean status
913 913
 		$venue_status = sanitize_key($venue_status);
914 914
 		// grab status
915
-		if (!empty($venue_status)) {
915
+		if ( ! empty($venue_status)) {
916 916
 			$success = TRUE;
917 917
 			//determine the event id and set to array.
918 918
 			$VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
@@ -952,20 +952,20 @@  discard block
 block discarded – undo
952 952
 	 * @param  string $venue_status
953 953
 	 * @return void
954 954
 	 */
955
-	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
955
+	private function _change_venue_status($VNU_ID = 0, $venue_status = '') {
956 956
 		// grab venue id
957
-		if (! $VNU_ID) {
957
+		if ( ! $VNU_ID) {
958 958
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
959 959
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
960 960
 			return FALSE;
961 961
 		}
962 962
 
963
-		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
963
+		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
964 964
 
965 965
 		// clean status
966 966
 		$venue_status = sanitize_key($venue_status);
967 967
 		// grab status
968
-		if ( ! $venue_status ) {
968
+		if ( ! $venue_status) {
969 969
 			$msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso');
970 970
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
971 971
 			return FALSE;
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
 				$hook = FALSE;
987 987
 		}
988 988
 		//use class to change status
989
-		$this->_cpt_model_obj->set_status( $venue_status );
989
+		$this->_cpt_model_obj->set_status($venue_status);
990 990
 		$success = $this->_cpt_model_obj->save();
991 991
 
992 992
 		if ($success === FALSE) {
@@ -1005,21 +1005,21 @@  discard block
 block discarded – undo
1005 1005
 	 * @param  bool $redirect_after
1006 1006
 	 * @return void
1007 1007
 	 */
1008
-	protected function _delete_venue( $redirect_after = true ) {
1008
+	protected function _delete_venue($redirect_after = true) {
1009 1009
 		//determine the venue id and set to array.
1010 1010
 		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL;
1011
-		$VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID;
1011
+		$VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID;
1012 1012
 
1013 1013
 
1014 1014
 		// loop thru venues
1015 1015
 		if ($VNU_ID) {
1016
-			$success = $this->_delete_or_trash_venue( $VNU_ID );
1016
+			$success = $this->_delete_or_trash_venue($VNU_ID);
1017 1017
 		} else {
1018 1018
 			$success = FALSE;
1019 1019
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1020 1020
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1021 1021
 		}
1022
-		if ( $redirect_after )
1022
+		if ($redirect_after)
1023 1023
 			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1024 1024
 	}
1025 1025
 
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 	//todo: put in parent
1052 1052
 	private function _delete_or_trash_venue($VNU_ID = FALSE) {
1053 1053
 		// grab event id
1054
-		if (!$VNU_ID = absint($VNU_ID)) {
1054
+		if ( ! $VNU_ID = absint($VNU_ID)) {
1055 1055
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
1056 1056
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1057 1057
 			return FALSE;
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1072 1072
 			return FALSE;
1073 1073
 		}
1074
-		do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' );
1074
+		do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1075 1075
 		return TRUE;
1076 1076
 	}
1077 1077
 
@@ -1082,11 +1082,11 @@  discard block
 block discarded – undo
1082 1082
 	/* QUERIES */
1083 1083
 
1084 1084
 
1085
-	public function get_venues( $per_page = 10, $count = FALSE ) {
1085
+	public function get_venues($per_page = 10, $count = FALSE) {
1086 1086
 
1087
-		$_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : '';
1087
+		$_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1088 1088
 
1089
-		switch ( $_orderby ) {
1089
+		switch ($_orderby) {
1090 1090
 			case 'id':
1091 1091
 				$orderby = 'VNU_ID';
1092 1092
 				break;
@@ -1104,43 +1104,43 @@  discard block
 block discarded – undo
1104 1104
 		}
1105 1105
 
1106 1106
 
1107
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
1107
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1108 1108
 
1109
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1110
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
1111
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1109
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1110
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
1111
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1112 1112
 
1113 1113
 
1114
-		$offset = ($current_page-1)*$per_page;
1114
+		$offset = ($current_page - 1) * $per_page;
1115 1115
 		$limit = array($offset, $per_page);
1116 1116
 
1117
-		$category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1117
+		$category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1118 1118
 		$where = array();
1119 1119
 
1120 1120
 		//only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
1121
-		if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) {
1121
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
1122 1122
 			$where['status'] = $this->_req_data['status'];
1123 1123
 		}
1124 1124
 
1125
-		if ( isset( $this->_req_data['venue_status'] ) ) {
1125
+		if (isset($this->_req_data['venue_status'])) {
1126 1126
 			$where['status'] = $this->_req_data['venue_status'];
1127 1127
 		}
1128 1128
 
1129 1129
 
1130
-		if ( $category ) {
1130
+		if ($category) {
1131 1131
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
1132 1132
 			$where['Term_Taxonomy.term_id'] = $category;
1133 1133
 		}
1134 1134
 
1135 1135
 
1136
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
1137
-			$where['VNU_wp_user'] =  get_current_user_id();
1136
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
1137
+			$where['VNU_wp_user'] = get_current_user_id();
1138 1138
 		} else {
1139
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
1139
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
1140 1140
 					$where['OR'] = array(
1141
-						'status*restrict_private' => array( '!=', 'private' ),
1141
+						'status*restrict_private' => array('!=', 'private'),
1142 1142
 						'AND'                     => array(
1143
-							'status*inclusive' => array( '=', 'private' ),
1143
+							'status*inclusive' => array('=', 'private'),
1144 1144
 							'VNU_wp_user'      => get_current_user_id()
1145 1145
 						)
1146 1146
 					);
@@ -1150,30 +1150,30 @@  discard block
 block discarded – undo
1150 1150
 
1151 1151
 
1152 1152
 
1153
-		if ( isset( $this->_req_data['s'] ) ) {
1154
-			$sstr = '%' . $this->_req_data['s'] . '%';
1153
+		if (isset($this->_req_data['s'])) {
1154
+			$sstr = '%'.$this->_req_data['s'].'%';
1155 1155
 			$where['OR'] = array(
1156
-				'VNU_name' => array('LIKE',$sstr ),
1157
-				'VNU_desc' => array('LIKE',$sstr ),
1158
-				'VNU_short_desc' => array( 'LIKE',$sstr ),
1159
-				'VNU_address' => array( 'LIKE', $sstr ),
1160
-				'VNU_address2' => array( 'LIKE', $sstr ),
1161
-				'VNU_city' => array( 'LIKE', $sstr ),
1162
-				'VNU_zip' => array( 'LIKE', $sstr ),
1163
-				'VNU_phone' => array( 'LIKE', $sstr ),
1164
-				'VNU_url' => array( 'LIKE', $sstr ),
1165
-				'VNU_virtual_phone' => array( 'LIKE', $sstr ),
1166
-				'VNU_virtual_url' => array( 'LIKE', $sstr ),
1167
-				'VNU_google_map_link' => array( 'LIKE', $sstr ),
1168
-				'Event.EVT_name' => array('LIKE', $sstr ),
1169
-				'Event.EVT_desc' => array('LIKE', $sstr ),
1170
-				'Event.EVT_phone' => array('LIKE', $sstr ),
1171
-				'Event.EVT_external_URL' => array('LIKE', $sstr ),
1156
+				'VNU_name' => array('LIKE', $sstr),
1157
+				'VNU_desc' => array('LIKE', $sstr),
1158
+				'VNU_short_desc' => array('LIKE', $sstr),
1159
+				'VNU_address' => array('LIKE', $sstr),
1160
+				'VNU_address2' => array('LIKE', $sstr),
1161
+				'VNU_city' => array('LIKE', $sstr),
1162
+				'VNU_zip' => array('LIKE', $sstr),
1163
+				'VNU_phone' => array('LIKE', $sstr),
1164
+				'VNU_url' => array('LIKE', $sstr),
1165
+				'VNU_virtual_phone' => array('LIKE', $sstr),
1166
+				'VNU_virtual_url' => array('LIKE', $sstr),
1167
+				'VNU_google_map_link' => array('LIKE', $sstr),
1168
+				'Event.EVT_name' => array('LIKE', $sstr),
1169
+				'Event.EVT_desc' => array('LIKE', $sstr),
1170
+				'Event.EVT_phone' => array('LIKE', $sstr),
1171
+				'Event.EVT_external_URL' => array('LIKE', $sstr),
1172 1172
 				);
1173 1173
 		}
1174 1174
 
1175 1175
 
1176
-		$venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) );
1176
+		$venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
1177 1177
 
1178 1178
 		return $venues;
1179 1179
 
@@ -1191,22 +1191,22 @@  discard block
 block discarded – undo
1191 1191
 	 * @return void
1192 1192
 	 */
1193 1193
 	private function _set_category_object() {
1194
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1194
+		if (isset($this->_category->id) && ! empty($this->_category->id))
1195 1195
 			return; //already have the category object so get out.
1196 1196
 
1197 1197
 		//set default category object
1198 1198
 		$this->_set_empty_category_object();
1199 1199
 
1200 1200
 		//only set if we've got an id
1201
-		if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) {
1201
+		if ( ! isset($this->_req_data['VEN_CAT_ID'])) {
1202 1202
 			return;
1203 1203
 		}
1204 1204
 
1205 1205
 		$category_id = absint($this->_req_data['VEN_CAT_ID']);
1206
-		$term = get_term( $category_id, 'espresso_venue_categories' );
1206
+		$term = get_term($category_id, 'espresso_venue_categories');
1207 1207
 
1208 1208
 
1209
-		if ( !empty( $term ) ) {
1209
+		if ( ! empty($term)) {
1210 1210
 			$this->_category->category_name = $term->name;
1211 1211
 			$this->_category->category_identifier = $term->slug;
1212 1212
 			$this->_category->category_desc = $term->description;
@@ -1220,14 +1220,14 @@  discard block
 block discarded – undo
1220 1220
 
1221 1221
 	private function _set_empty_category_object() {
1222 1222
 		$this->_category = new stdClass();
1223
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
1223
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
1224 1224
 		$this->_category->id = $this->_category->parent = 0;
1225 1225
 	}
1226 1226
 
1227 1227
 
1228 1228
 
1229 1229
 	protected function _category_list_table() {
1230
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1230
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1231 1231
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
1232 1232
 		$this->_search_btn_label = __('Venue Categories', 'event_espresso');
1233 1233
 		$this->display_admin_list_table_page_with_sidebar();
@@ -1237,21 +1237,21 @@  discard block
 block discarded – undo
1237 1237
 	protected function _category_details($view) {
1238 1238
 
1239 1239
 		//load formatter helper
1240
-		EE_Registry::instance()->load_helper( 'Formatter' );
1240
+		EE_Registry::instance()->load_helper('Formatter');
1241 1241
 		//load field generator helper
1242
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
1242
+		EE_Registry::instance()->load_helper('Form_Fields');
1243 1243
 
1244 1244
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
1245 1245
 		$this->_set_add_edit_form_tags($route);
1246 1246
 
1247 1247
 		$this->_set_category_object();
1248
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
1248
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
1249 1249
 
1250 1250
 		$delete_action = 'delete_category';
1251 1251
 
1252
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url );
1252
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
1253 1253
 
1254
-		$this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect );
1254
+		$this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
1255 1255
 
1256 1256
 		//take care of contents
1257 1257
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -1265,25 +1265,25 @@  discard block
 block discarded – undo
1265 1265
 			'type' => 'wp_editor',
1266 1266
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
1267 1267
 			'class' => 'my_editor_custom',
1268
-			'wpeditor_args' => array( 'media_buttons' => FALSE )
1268
+			'wpeditor_args' => array('media_buttons' => FALSE)
1269 1269
 		);
1270
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
1270
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
1271 1271
 
1272
-		$all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
1272
+		$all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
1273 1273
 
1274 1274
 		//setup category select for term parents.
1275 1275
 		$category_select_values[] = array(
1276 1276
 			'text' => __('No Parent', 'event_espresso'),
1277 1277
 			'id' => 0
1278 1278
 			);
1279
-		foreach ( $all_terms as $term ) {
1279
+		foreach ($all_terms as $term) {
1280 1280
 			$category_select_values[] = array(
1281 1281
 				'text' => $term->name,
1282 1282
 				'id' => $term->term_id
1283 1283
 				);
1284 1284
 		}
1285 1285
 
1286
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
1286
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
1287 1287
 		$template_args = array(
1288 1288
 			'category' => $this->_category,
1289 1289
 			'category_select' => $category_select,
@@ -1292,15 +1292,15 @@  discard block
 block discarded – undo
1292 1292
 			'disable' => '',
1293 1293
 			'disabled_message' =>FALSE
1294 1294
 			);
1295
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
1296
-		return EEH_Template::display_template($template, $template_args, TRUE );
1295
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
1296
+		return EEH_Template::display_template($template, $template_args, TRUE);
1297 1297
 	}
1298 1298
 
1299 1299
 
1300 1300
 	protected function _delete_categories() {
1301
-		$cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1301
+		$cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1302 1302
 
1303
-		foreach ( $cat_ids as $cat_id ) {
1303
+		foreach ($cat_ids as $cat_id) {
1304 1304
 			$this->_delete_category($cat_id);
1305 1305
 		}
1306 1306
 
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
 		$query_args = array(
1309 1309
 			'action' => 'category_list'
1310 1310
 			);
1311
-		$this->_redirect_after_action(0,'','',$query_args);
1311
+		$this->_redirect_after_action(0, '', '', $query_args);
1312 1312
 
1313 1313
 	}
1314 1314
 
@@ -1317,58 +1317,58 @@  discard block
 block discarded – undo
1317 1317
 
1318 1318
 
1319 1319
 	protected function _delete_category($cat_id) {
1320
-		$cat_id = absint( $cat_id );
1321
-		wp_delete_term( $cat_id, 'espresso_venue_categories' );
1320
+		$cat_id = absint($cat_id);
1321
+		wp_delete_term($cat_id, 'espresso_venue_categories');
1322 1322
 	}
1323 1323
 
1324 1324
 
1325 1325
 
1326 1326
 	protected function _insert_or_update_category($new_category) {
1327 1327
 
1328
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
1328
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
1329 1329
 		$success = 0; //we already have a success message so lets not send another.
1330
-		if ( $cat_id ) {
1330
+		if ($cat_id) {
1331 1331
 			$query_args = array(
1332 1332
 				'action'     => 'edit_category',
1333 1333
 				'VEN_CAT_ID' => $cat_id
1334 1334
 			);
1335 1335
 		} else {
1336
-			$query_args = array( 'action' => 'add_category' );
1336
+			$query_args = array('action' => 'add_category');
1337 1337
 		}
1338
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
1338
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
1339 1339
 
1340 1340
 	}
1341 1341
 
1342 1342
 
1343 1343
 
1344
-	private function _insert_category( $update = FALSE ) {
1344
+	private function _insert_category($update = FALSE) {
1345 1345
 		$cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : '';
1346
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
1347
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
1348
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
1346
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
1347
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
1348
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
1349 1349
 
1350
-		if ( empty( $category_name ) ) {
1351
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
1352
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1350
+		if (empty($category_name)) {
1351
+			$msg = __('You must add a name for the category.', 'event_espresso');
1352
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1353 1353
 			return false;
1354 1354
 		}
1355 1355
 
1356 1356
 
1357
-		$term_args=array(
1357
+		$term_args = array(
1358 1358
 			'name'=>$category_name,
1359 1359
 			'description'=>$category_desc,
1360 1360
 			'parent'=>$category_parent
1361 1361
 		);
1362 1362
 
1363
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args );
1363
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args);
1364 1364
 
1365
-		if ( !is_array( $insert_ids ) ) {
1366
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
1367
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1365
+		if ( ! is_array($insert_ids)) {
1366
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1367
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1368 1368
 		} else {
1369 1369
 			$cat_id = $insert_ids['term_id'];
1370
-			$msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name );
1371
-			EE_Error::add_success( $msg );
1370
+			$msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name);
1371
+			EE_Error::add_success($msg);
1372 1372
 		}
1373 1373
 
1374 1374
 		return $cat_id;
@@ -1388,12 +1388,12 @@  discard block
 block discarded – undo
1388 1388
 			'category_ids' => $this->_req_data['VEN_CAT_ID']
1389 1389
 			);
1390 1390
 
1391
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
1391
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
1392 1392
 
1393
-		EE_Registry::instance()->load_helper( 'File' );
1394
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
1395
-			require_once( EE_CLASSES . 'EE_Export.class.php');
1396
-			$EE_Export = EE_Export::instance( $this->_req_data );
1393
+		EE_Registry::instance()->load_helper('File');
1394
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
1395
+			require_once(EE_CLASSES.'EE_Export.class.php');
1396
+			$EE_Export = EE_Export::instance($this->_req_data);
1397 1397
 			$EE_Export->export();
1398 1398
 		}
1399 1399
 
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
 
1406 1406
 	protected function _import_categories() {
1407 1407
 
1408
-		require_once(EE_CLASSES . 'EE_Import.class.php');
1408
+		require_once(EE_CLASSES.'EE_Import.class.php');
1409 1409
 		EE_Import::instance()->import();
1410 1410
 
1411 1411
 	}
@@ -1413,29 +1413,29 @@  discard block
 block discarded – undo
1413 1413
 
1414 1414
 
1415 1415
 
1416
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1416
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
1417 1417
 
1418 1418
 		//testing term stuff
1419
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1420
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1421
-		$limit = ($current_page-1)*$per_page;
1422
-		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1423
-		if ( isset( $this->_req_data['s'] ) ) {
1424
-			$sstr = '%' . $this->_req_data['s'] . '%';
1419
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
1420
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1421
+		$limit = ($current_page - 1) * $per_page;
1422
+		$where = array('taxonomy' => 'espresso_venue_categories');
1423
+		if (isset($this->_req_data['s'])) {
1424
+			$sstr = '%'.$this->_req_data['s'].'%';
1425 1425
 			$where['OR'] = array(
1426
-				'Term.name' => array( 'LIKE', $sstr),
1427
-				'description' => array( 'LIKE', $sstr )
1426
+				'Term.name' => array('LIKE', $sstr),
1427
+				'description' => array('LIKE', $sstr)
1428 1428
 				);
1429 1429
 		}
1430 1430
 
1431 1431
 		$query_params = array(
1432 1432
 			$where,
1433
-			'order_by' => array( $orderby => $order ),
1434
-			'limit' => $limit . ',' . $per_page,
1433
+			'order_by' => array($orderby => $order),
1434
+			'limit' => $limit.','.$per_page,
1435 1435
 			'force_join' => array('Term')
1436 1436
 			);
1437 1437
 
1438
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1438
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
1439 1439
 
1440 1440
 		return $categories;
1441 1441
 	}
Please login to merge, or discard this patch.
admin/extend/transactions/Extend_Transactions_Admin_Page.core.php 1 patch
Spacing   +45 added lines, -45 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
 /**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 * @param bool $routing
43 43
 	 * @return \Extend_Transactions_Admin_Page
44 44
 	 */
45
-	public function __construct( $routing = TRUE ) {
46
-		parent::__construct( $routing );
47
-		define( 'TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/');
48
-		define( 'TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/');
49
-		define( 'TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/');
45
+	public function __construct($routing = TRUE) {
46
+		parent::__construct($routing);
47
+		define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'transactions/templates/');
48
+		define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'transactions/assets/');
49
+		define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'transactions/assets/');
50 50
 	}
51 51
 
52 52
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @return void
59 59
 	 */
60 60
 	protected function _extend_page_config() {
61
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions';
61
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'transactions';
62 62
 
63 63
 		$new_page_routes = array(
64 64
 			'reports' => array(
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			)
68 68
 		);
69 69
 
70
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
70
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
71 71
 
72 72
 		$new_page_config = array(
73 73
 			'reports' => array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 				'require_nonce' => FALSE
86 86
 			)
87 87
 		);
88
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
88
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
89 89
 	}
90 90
 
91 91
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 * @return void
98 98
 	 */
99 99
 	public function load_scripts_styles_reports() {
100
-		wp_register_script( 'ee-txn-reports-js', TXN_CAF_ASSETS_URL . 'ee-transaction-admin-reports.js', array( 'google-charts' ), EVENT_ESPRESSO_VERSION, true );
101
-		wp_enqueue_script( 'ee-txn-reports-js' );
100
+		wp_register_script('ee-txn-reports-js', TXN_CAF_ASSETS_URL.'ee-transaction-admin-reports.js', array('google-charts'), EVENT_ESPRESSO_VERSION, true);
101
+		wp_enqueue_script('ee-txn-reports-js');
102 102
 		$this->_transaction_reports_js_setup();
103 103
 		EE_Registry::instance()->load_helper('Money');
104 104
 		EE_Registry::$i18n_js_strings['currency_format'] = EEH_Money::get_format_for_google_charts();
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 	* @return void
127 127
 	*/
128 128
 	protected function _transaction_reports() {
129
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
129
+		$template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
130 130
 		$this->_admin_page_title = __('Transactions', 'event_espresso');
131
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, TRUE );
131
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_reports_template_data, TRUE);
132 132
 
133 133
 		// the final template wrapper
134 134
 		$this->display_admin_page_with_no_sidebar();
@@ -143,43 +143,43 @@  discard block
 block discarded – undo
143 143
 	 * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
144 144
 	 * @return string
145 145
 	 */
146
-	private function _revenue_per_day_report( $period = '-1 month' ) {
146
+	private function _revenue_per_day_report($period = '-1 month') {
147 147
 
148 148
 		$report_ID = 'txn-admin-revenue-per-day-report-dv';
149 149
 
150 150
 		$TXN = EEM_Transaction::instance();
151 151
 
152
-		$results = $TXN->get_revenue_per_day_report( $period );
152
+		$results = $TXN->get_revenue_per_day_report($period);
153 153
 		$results = (array) $results;
154 154
 		$revenue = array();
155 155
 		$subtitle = '';
156 156
 
157
-		if ( $results ) {
158
-			$revenue[] = array( __( 'Date (only shows dates that have a revenue greater than 1)', 'event_espresso' ), __( 'Total Revenue', 'event_espresso' ) );
159
-			foreach ( $results as $result ) {
160
-				if ( $result->revenue > 1 ) {
161
-					$revenue[] = array( $result->txnDate, (float) $result->revenue );
157
+		if ($results) {
158
+			$revenue[] = array(__('Date (only shows dates that have a revenue greater than 1)', 'event_espresso'), __('Total Revenue', 'event_espresso'));
159
+			foreach ($results as $result) {
160
+				if ($result->revenue > 1) {
161
+					$revenue[] = array($result->txnDate, (float) $result->revenue);
162 162
 				}
163 163
 			}
164 164
 
165 165
 			//setup the date range.
166
-			EE_Registry::instance()->load_helper( 'DTT_Helper' );
167
-			$beginning_date = new DateTime( 'now' . $period, new DateTimeZone( EEH_DTT_Helper::get_timezone() ) );
168
-			$ending_date = new DateTime( 'now', new DateTimeZone( EEH_DTT_Helper::get_timezone() ) );
169
-			$subtitle = sprintf( _x( 'For the period: %s to %s', 'Used to give date range', 'event_espresso' ), $beginning_date->format( 'Y-m-d' ), $ending_date->format( 'Y-m-d' ) );
166
+			EE_Registry::instance()->load_helper('DTT_Helper');
167
+			$beginning_date = new DateTime('now'.$period, new DateTimeZone(EEH_DTT_Helper::get_timezone()));
168
+			$ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone()));
169
+			$subtitle = sprintf(_x('For the period: %s to %s', 'Used to give date range', 'event_espresso'), $beginning_date->format('Y-m-d'), $ending_date->format('Y-m-d'));
170 170
 		}
171 171
 
172
-		$report_title = __( 'Total Revenue per Day' );
172
+		$report_title = __('Total Revenue per Day');
173 173
 
174 174
 		$report_params = array(
175 175
 			'title' 		=> $report_title,
176 176
 			'subtitle' => $subtitle,
177 177
 			'id' 			=> $report_ID,
178 178
 			'revenue' => $revenue,
179
-			'noResults' => empty( $revenue ),
180
-			'noTxnMsg'	=> sprintf( __( '%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso' ), '<h2>' . $report_title . '</h2><p>', '</p>' )
179
+			'noResults' => empty($revenue),
180
+			'noTxnMsg'	=> sprintf(__('%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso'), '<h2>'.$report_title.'</h2><p>', '</p>')
181 181
 		);
182
-		wp_localize_script( 'ee-txn-reports-js', 'txnRevPerDay', $report_params );
182
+		wp_localize_script('ee-txn-reports-js', 'txnRevPerDay', $report_params);
183 183
 
184 184
 		return $report_ID;
185 185
 	}
@@ -193,44 +193,44 @@  discard block
 block discarded – undo
193 193
 	 * @param string $period  The period (acceptable by PHP Datetime constructor) for which the report is generated.
194 194
 	 * @return int
195 195
 	 */
196
-	private function _revenue_per_event_report( $period = '-1 month' ) {
196
+	private function _revenue_per_event_report($period = '-1 month') {
197 197
 
198 198
 		$report_ID = 'txn-admin-revenue-per-event-report-dv';
199 199
 
200 200
 		$TXN = EEM_Transaction::instance();
201
-		$results = $TXN->get_revenue_per_event_report( $period );
201
+		$results = $TXN->get_revenue_per_event_report($period);
202 202
 		$results = (array) $results;
203 203
 		$revenue = array();
204 204
 		$subtitle = '';
205 205
 
206
-		if ( $results ) {
207
-			$revenue[] = array( __( 'Event (only events that have a revenue greater than 1 are shown)', 'event_espresso' ), __( 'Total Revenue', 'event_espresso' ) );
208
-			foreach ( $results as $result ) {
209
-				if ( $result->revenue > 1 ) {
210
-					$event_name = stripslashes( html_entity_decode( $result->event_name, ENT_QUOTES, 'UTF-8' ) );
211
-					$event_name = wp_trim_words( $event_name, 5, '...' );
212
-					$revenue[]  = array( $event_name, (float) $result->revenue );
206
+		if ($results) {
207
+			$revenue[] = array(__('Event (only events that have a revenue greater than 1 are shown)', 'event_espresso'), __('Total Revenue', 'event_espresso'));
208
+			foreach ($results as $result) {
209
+				if ($result->revenue > 1) {
210
+					$event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8'));
211
+					$event_name = wp_trim_words($event_name, 5, '...');
212
+					$revenue[]  = array($event_name, (float) $result->revenue);
213 213
 				}
214 214
 			}
215 215
 
216 216
 			//setup the date range.
217
-			EE_Registry::instance()->load_helper( 'DTT_Helper' );
218
-			$beginning_date = new DateTime( 'now' . $period, new DateTimeZone( EEH_DTT_Helper::get_timezone() ) );
219
-			$ending_date = new DateTime( 'now', new DateTimeZone( EEH_DTT_Helper::get_timezone() ) );
220
-			$subtitle = sprintf( _x( 'For the period: %s to %s', 'Used to give date range', 'event_espresso' ), $beginning_date->format( 'Y-m-d' ), $ending_date->format( 'Y-m-d' ) );
217
+			EE_Registry::instance()->load_helper('DTT_Helper');
218
+			$beginning_date = new DateTime('now'.$period, new DateTimeZone(EEH_DTT_Helper::get_timezone()));
219
+			$ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone()));
220
+			$subtitle = sprintf(_x('For the period: %s to %s', 'Used to give date range', 'event_espresso'), $beginning_date->format('Y-m-d'), $ending_date->format('Y-m-d'));
221 221
 		}
222 222
 
223
-		$report_title = __( 'Total Revenue per Event' );
223
+		$report_title = __('Total Revenue per Event');
224 224
 
225 225
 		$report_params = array(
226 226
 			'title' 		=> $report_title,
227 227
 			'subtitle' => $subtitle,
228 228
 			'id' 			=> $report_ID,
229 229
 			'revenue' => $revenue,
230
-			'noResults' => empty( $revenue ),
231
-			'noTxnMsg'	=> sprintf( __( '%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso' ), '<h2>' . $report_title . '</h2><p>', '</p>' )
230
+			'noResults' => empty($revenue),
231
+			'noTxnMsg'	=> sprintf(__('%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso'), '<h2>'.$report_title.'</h2><p>', '</p>')
232 232
 		);
233
-		wp_localize_script( 'ee-txn-reports-js', 'txnRevPerEvent', $report_params );
233
+		wp_localize_script('ee-txn-reports-js', 'txnRevPerEvent', $report_params);
234 234
 
235 235
 		return $report_ID;
236 236
 	}
Please login to merge, or discard this patch.