Completed
Branch BUG-9680-compress-dompdf-files... (43e183)
by
unknown
64:09 queued 52:26
created
core/db_classes/EE_Attendee.class.php 2 patches
Spacing   +98 added lines, -98 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
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 	 * @param string $timezone
34 34
 	 * @param array $date_formats
35 35
 	 */
36
-	protected function __construct( $fieldValues = NULL, $bydb = FALSE, $timezone = NULL, $date_formats = array() ) {
37
-		if ( !isset( $fieldValues[ 'ATT_full_name' ] ) ) {
38
-			$fname = isset( $fieldValues[ 'ATT_fname' ] ) ? $fieldValues[ 'ATT_fname' ] . ' ' : '';
39
-			$lname = isset( $fieldValues[ 'ATT_lname' ] ) ? $fieldValues[ 'ATT_lname' ] : '';
40
-			$fieldValues[ 'ATT_full_name' ] = $fname . $lname;
36
+	protected function __construct($fieldValues = NULL, $bydb = FALSE, $timezone = NULL, $date_formats = array()) {
37
+		if ( ! isset($fieldValues['ATT_full_name'])) {
38
+			$fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'].' ' : '';
39
+			$lname = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : '';
40
+			$fieldValues['ATT_full_name'] = $fname.$lname;
41 41
 		}
42
-		if ( !isset( $fieldValues[ 'ATT_slug' ] ) ) {
42
+		if ( ! isset($fieldValues['ATT_slug'])) {
43 43
 			//			$fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20));
44
-			$fieldValues[ 'ATT_slug' ] = sanitize_title( $fieldValues[ 'ATT_full_name' ] );
44
+			$fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']);
45 45
 		}
46
-		if ( !isset( $fieldValues[ 'ATT_short_bio' ] ) && isset( $fieldValues[ 'ATT_bio' ] ) ) {
47
-			$fieldValues[ 'ATT_short_bio' ] = substr( $fieldValues[ 'ATT_bio' ], 0, 50 );
46
+		if ( ! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) {
47
+			$fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50);
48 48
 		}
49
-		parent::__construct( $fieldValues, $bydb, $timezone, $date_formats );
49
+		parent::__construct($fieldValues, $bydb, $timezone, $date_formats);
50 50
 	}
51 51
 
52 52
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	 *                             		    date_format and the second value is the time format
61 61
 	 * @return EE_Attendee
62 62
 	 */
63
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
64
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
65
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
63
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
64
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
65
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
66 66
 	}
67 67
 
68 68
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 *                          		the website will be used.
74 74
 	 * @return EE_Attendee
75 75
 	 */
76
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
77
-		return new self( $props_n_values, TRUE, $timezone );
76
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
77
+		return new self($props_n_values, TRUE, $timezone);
78 78
 	}
79 79
 
80 80
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @access        public
86 86
 	 * @param string $fname
87 87
 	 */
88
-	public function set_fname( $fname = '' ) {
89
-		$this->set( 'ATT_fname', $fname );
88
+	public function set_fname($fname = '') {
89
+		$this->set('ATT_fname', $fname);
90 90
 	}
91 91
 
92 92
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 * @access        public
98 98
 	 * @param string $lname
99 99
 	 */
100
-	public function set_lname( $lname = '' ) {
101
-		$this->set( 'ATT_lname', $lname );
100
+	public function set_lname($lname = '') {
101
+		$this->set('ATT_lname', $lname);
102 102
 	}
103 103
 
104 104
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 * @access        public
110 110
 	 * @param string $address
111 111
 	 */
112
-	public function set_address( $address = '' ) {
113
-		$this->set( 'ATT_address', $address );
112
+	public function set_address($address = '') {
113
+		$this->set('ATT_address', $address);
114 114
 	}
115 115
 
116 116
 
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @access        public
122 122
 	 * @param        string $address2
123 123
 	 */
124
-	public function set_address2( $address2 = '' ) {
125
-		$this->set( 'ATT_address2', $address2 );
124
+	public function set_address2($address2 = '') {
125
+		$this->set('ATT_address2', $address2);
126 126
 	}
127 127
 
128 128
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @access        public
134 134
 	 * @param        string $city
135 135
 	 */
136
-	public function set_city( $city = '' ) {
137
-		$this->set( 'ATT_city', $city );
136
+	public function set_city($city = '') {
137
+		$this->set('ATT_city', $city);
138 138
 	}
139 139
 
140 140
 
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 	 * @access        public
146 146
 	 * @param        int $STA_ID
147 147
 	 */
148
-	public function set_state( $STA_ID = 0 ) {
149
-		$this->set( 'STA_ID', $STA_ID );
148
+	public function set_state($STA_ID = 0) {
149
+		$this->set('STA_ID', $STA_ID);
150 150
 	}
151 151
 
152 152
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 	 * @access        public
158 158
 	 * @param        string $CNT_ISO
159 159
 	 */
160
-	public function set_country( $CNT_ISO = '' ) {
161
-		$this->set( 'CNT_ISO', $CNT_ISO );
160
+	public function set_country($CNT_ISO = '') {
161
+		$this->set('CNT_ISO', $CNT_ISO);
162 162
 	}
163 163
 
164 164
 
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 * @access        public
170 170
 	 * @param        string $zip
171 171
 	 */
172
-	public function set_zip( $zip = '' ) {
173
-		$this->set( 'ATT_zip', $zip );
172
+	public function set_zip($zip = '') {
173
+		$this->set('ATT_zip', $zip);
174 174
 	}
175 175
 
176 176
 
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 * @access        public
182 182
 	 * @param        string $email
183 183
 	 */
184
-	public function set_email( $email = '' ) {
185
-		$this->set( 'ATT_email', $email );
184
+	public function set_email($email = '') {
185
+		$this->set('ATT_email', $email);
186 186
 	}
187 187
 
188 188
 
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	 * @access        public
194 194
 	 * @param        string $phone
195 195
 	 */
196
-	public function set_phone( $phone = '' ) {
197
-		$this->set( 'ATT_phone', $phone );
196
+	public function set_phone($phone = '') {
197
+		$this->set('ATT_phone', $phone);
198 198
 	}
199 199
 
200 200
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 	 * @access        public
206 206
 	 * @param        bool $ATT_deleted
207 207
 	 */
208
-	public function set_deleted( $ATT_deleted = FALSE ) {
209
-		$this->set( 'ATT_deleted', $ATT_deleted );
208
+	public function set_deleted($ATT_deleted = FALSE) {
209
+		$this->set('ATT_deleted', $ATT_deleted);
210 210
 	}
211 211
 
212 212
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	 * @return int
220 220
 	 */
221 221
 	public function wp_user() {
222
-		return $this->get( 'ATT_author' );
222
+		return $this->get('ATT_author');
223 223
 	}
224 224
 
225 225
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 * @return string
231 231
 	 */
232 232
 	public function fname() {
233
-		return $this->get( 'ATT_fname' );
233
+		return $this->get('ATT_fname');
234 234
 	}
235 235
 
236 236
 
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 	 * @param bool $apply_html_entities
251 251
 	 * @return string
252 252
 	 */
253
-	public function full_name( $apply_html_entities = FALSE ) {
254
-		$full_name = $this->fname() . ' ' . $this->lname();
255
-		return $apply_html_entities ? htmlentities( $full_name, ENT_QUOTES, 'UTF-8' ) : $full_name;
253
+	public function full_name($apply_html_entities = FALSE) {
254
+		$full_name = $this->fname().' '.$this->lname();
255
+		return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name;
256 256
 	}
257 257
 
258 258
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 * @return string
264 264
 	 */
265 265
 	public function lname() {
266
-		return $this->get( 'ATT_lname' );
266
+		return $this->get('ATT_lname');
267 267
 	}
268 268
 
269 269
 
@@ -277,26 +277,26 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	public function full_address_as_array() {
279 279
 		$full_address_array = array();
280
-		$initial_address_fields = array( 'ATT_address', 'ATT_address2', 'ATT_city', );
281
-		foreach ( $initial_address_fields as $address_field_name ) {
282
-			$address_fields_value = $this->get( $address_field_name );
283
-			if ( !empty( $address_fields_value ) ) {
284
-				$full_address_array[ ] = $address_fields_value;
280
+		$initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',);
281
+		foreach ($initial_address_fields as $address_field_name) {
282
+			$address_fields_value = $this->get($address_field_name);
283
+			if ( ! empty($address_fields_value)) {
284
+				$full_address_array[] = $address_fields_value;
285 285
 			}
286 286
 		}
287 287
 		//now handle state and country
288 288
 		$state_obj = $this->state_obj();
289
-		if ( !empty( $state_obj ) ) {
290
-			$full_address_array[ ] = $state_obj->name();
289
+		if ( ! empty($state_obj)) {
290
+			$full_address_array[] = $state_obj->name();
291 291
 		}
292 292
 		$country_obj = $this->country_obj();
293
-		if ( !empty( $country_obj ) ) {
294
-			$full_address_array[ ] = $country_obj->name();
293
+		if ( ! empty($country_obj)) {
294
+			$full_address_array[] = $country_obj->name();
295 295
 		}
296 296
 		//lastly get the xip
297 297
 		$zip_value = $this->zip();
298
-		if ( !empty( $zip_value ) ) {
299
-			$full_address_array[ ] = $zip_value;
298
+		if ( ! empty($zip_value)) {
299
+			$full_address_array[] = $zip_value;
300 300
 		}
301 301
 		return $full_address_array;
302 302
 	}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 * @return string
309 309
 	 */
310 310
 	public function address() {
311
-		return $this->get( 'ATT_address' );
311
+		return $this->get('ATT_address');
312 312
 	}
313 313
 
314 314
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * @return string
319 319
 	 */
320 320
 	public function address2() {
321
-		return $this->get( 'ATT_address2' );
321
+		return $this->get('ATT_address2');
322 322
 	}
323 323
 
324 324
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 * @return string
329 329
 	 */
330 330
 	public function city() {
331
-		return $this->get( 'ATT_city' );
331
+		return $this->get('ATT_city');
332 332
 	}
333 333
 
334 334
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 	 * @return string
339 339
 	 */
340 340
 	public function state_ID() {
341
-		return $this->get( 'STA_ID' );
341
+		return $this->get('STA_ID');
342 342
 	}
343 343
 
344 344
 
@@ -357,17 +357,17 @@  discard block
 block discarded – undo
357 357
 	 * @return EE_State
358 358
 	 */
359 359
 	public function state_obj() {
360
-		return $this->get_first_related( 'State' );
360
+		return $this->get_first_related('State');
361 361
 	}
362 362
 
363 363
 	/**
364 364
 	 * Returns the state's name, otherwise 'Unknown'
365 365
 	 * @return string
366 366
 	 */
367
-	public function state_name(){
368
-		if( $this->state_obj() ){
367
+	public function state_name() {
368
+		if ($this->state_obj()) {
369 369
 			return $this->state_obj()->name();
370
-		}else{
370
+		} else {
371 371
 			return '';
372 372
 		}
373 373
 	}
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 * @return string
382 382
 	 */
383 383
 	public function state() {
384
-		if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) {
384
+		if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) {
385 385
 			return $this->state_abbrev();
386 386
 		} else {
387 387
 			return $this->state_name();
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	 * @return string
396 396
 	 */
397 397
 	public function country_ID() {
398
-		return $this->get( 'CNT_ISO' );
398
+		return $this->get('CNT_ISO');
399 399
 	}
400 400
 
401 401
 
@@ -405,17 +405,17 @@  discard block
 block discarded – undo
405 405
 	 * @return EE_Country
406 406
 	 */
407 407
 	public function country_obj() {
408
-		return $this->get_first_related( 'Country' );
408
+		return $this->get_first_related('Country');
409 409
 	}
410 410
 
411 411
 	/**
412 412
 	 * Returns the country's name if known, otherwise 'Unknown'
413 413
 	 * @return string
414 414
 	 */
415
-	public function country_name(){
416
-		if( $this->country_obj() ){
415
+	public function country_name() {
416
+		if ($this->country_obj()) {
417 417
 			return $this->country_obj()->name();
418
-		}else{
418
+		} else {
419 419
 			return '';
420 420
 		}
421 421
 	}
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 	 * @return string
430 430
 	 */
431 431
 	public function country() {
432
-		if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) {
432
+		if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) {
433 433
 			return $this->country_ID();
434 434
 		} else {
435 435
 			return $this->country_name();
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	 * @return string
444 444
 	 */
445 445
 	public function zip() {
446
-		return $this->get( 'ATT_zip' );
446
+		return $this->get('ATT_zip');
447 447
 	}
448 448
 
449 449
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 * @return string
454 454
 	 */
455 455
 	public function email() {
456
-		return $this->get( 'ATT_email' );
456
+		return $this->get('ATT_email');
457 457
 	}
458 458
 
459 459
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	 * @return string
464 464
 	 */
465 465
 	public function phone() {
466
-		return $this->get( 'ATT_phone' );
466
+		return $this->get('ATT_phone');
467 467
 	}
468 468
 
469 469
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 	 * @return        bool
474 474
 	 */
475 475
 	public function deleted() {
476
-		return $this->get( 'ATT_deleted' );
476
+		return $this->get('ATT_deleted');
477 477
 	}
478 478
 
479 479
 
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
 	 * @param array $query_params
484 484
 	 * @return EE_Registration[]
485 485
 	 */
486
-	public function get_registrations( $query_params = array() ) {
487
-		return $this->get_many_related( 'Registration', $query_params );
486
+	public function get_registrations($query_params = array()) {
487
+		return $this->get_many_related('Registration', $query_params);
488 488
 	}
489 489
 
490 490
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 	 * @return EE_Registration
495 495
 	 */
496 496
 	public function get_most_recent_registration() {
497
-		return $this->get_first_related( 'Registration', array( 'order_by' => array( 'REG_date' => 'DESC' ) ) ); //null, 'REG_date', 'DESC', '=', 'OBJECT_K');
497
+		return $this->get_first_related('Registration', array('order_by' => array('REG_date' => 'DESC'))); //null, 'REG_date', 'DESC', '=', 'OBJECT_K');
498 498
 	}
499 499
 
500 500
 
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
 	 * @param int $event_id
505 505
 	 * @return EE_Registration
506 506
 	 */
507
-	public function get_most_recent_registration_for_event( $event_id ) {
508
-		return $this->get_first_related( 'Registration', array(array( 'EVT_ID' => $event_id ), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' );
507
+	public function get_most_recent_registration_for_event($event_id) {
508
+		return $this->get_first_related('Registration', array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC'))); //, '=', 'OBJECT_K' );
509 509
 	}
510 510
 
511 511
 
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 	 * @return array
516 516
 	 */
517 517
 	public function events() {
518
-		return $this->get_many_related( 'Event' );
518
+		return $this->get_many_related('Event');
519 519
 	}
520 520
 
521 521
 	/**
@@ -524,17 +524,17 @@  discard block
 block discarded – undo
524 524
 	 * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class
525 525
 	 * @return EE_Form_Section_Proper
526 526
 	 */
527
-	public function billing_info_for_payment_method($payment_method){
527
+	public function billing_info_for_payment_method($payment_method) {
528 528
 		$pm_type = $payment_method->type_obj();
529
-		if( ! $pm_type instanceof EE_PMT_Base ){
529
+		if ( ! $pm_type instanceof EE_PMT_Base) {
530 530
 			return NULL;
531 531
 		}
532
-		$billing_info =  $this->get_post_meta( $this->get_billing_info_postmeta_name( $payment_method ), true );
533
-		if ( ! $billing_info){
532
+		$billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true);
533
+		if ( ! $billing_info) {
534 534
 			return NULL;
535 535
 		}
536 536
 		$billing_form = $pm_type->billing_form();
537
-		$billing_form->receive_form_submission( array( $billing_form->name() => $billing_info ), FALSE );
537
+		$billing_form->receive_form_submission(array($billing_form->name() => $billing_info), FALSE);
538 538
 		return $billing_form;
539 539
 	}
540 540
 
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 	 * @param EE_Payment_Method $payment_method
545 545
 	 * @return string
546 546
 	 */
547
-	public function get_billing_info_postmeta_name($payment_method){
548
-		if( $payment_method->type_obj() instanceof EE_PMT_Base ){
549
-			return 'billing_info_' . $payment_method->type_obj()->system_name();
550
-		}else{
547
+	public function get_billing_info_postmeta_name($payment_method) {
548
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
549
+			return 'billing_info_'.$payment_method->type_obj()->system_name();
550
+		} else {
551 551
 			return NULL;
552 552
 		}
553 553
 	}
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 	 * @param EE_Payment_Method $payment_method
559 559
 	 * @return boolean
560 560
 	 */
561
-	public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method){
562
-		if( ! $billing_form instanceof EE_Billing_Attendee_Info_Form ){
563
-			EE_Error::add_error( __( 'Cannot save billing info because there is none.', 'event_espresso' ) );
561
+	public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method) {
562
+		if ( ! $billing_form instanceof EE_Billing_Attendee_Info_Form) {
563
+			EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso'));
564 564
 			return false;
565 565
 		}
566 566
 		$billing_form->clean_sensitive_data();
567
-		return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name( $payment_method ), $billing_form->input_values( true ) );
567
+		return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name($payment_method), $billing_form->input_values(true));
568 568
 	}
569 569
 
570 570
 	/**
@@ -580,14 +580,14 @@  discard block
 block discarded – undo
580 580
 	 * @return string
581 581
 	 */
582 582
 	public function get_admin_edit_link() {
583
-		EE_Registry::instance()->load_helper( 'URL' );
583
+		EE_Registry::instance()->load_helper('URL');
584 584
 		return EEH_URL::add_query_args_and_nonce(
585 585
 			array(
586 586
 				'page' => 'espresso_registrations',
587 587
 				'action' => 'edit_attendee',
588 588
 				'post' => $this->ID()
589 589
 			),
590
-			admin_url( 'admin.php' )
590
+			admin_url('admin.php')
591 591
 		);
592 592
 	}
593 593
 
@@ -604,13 +604,13 @@  discard block
 block discarded – undo
604 604
 	 * @return string
605 605
 	 */
606 606
 	public function get_admin_overview_link() {
607
-		EE_Registry::instance()->load_helper( 'URL' );
607
+		EE_Registry::instance()->load_helper('URL');
608 608
 		return EEH_URL::add_query_args_and_nonce(
609 609
 			array(
610 610
 				'page' => 'espresso_registrations',
611 611
 				'action' => 'contact_list'
612 612
 			),
613
-			admin_url( 'admin.php' )
613
+			admin_url('admin.php')
614 614
 		);
615 615
 	}
616 616
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	public function state_name(){
368 368
 		if( $this->state_obj() ){
369 369
 			return $this->state_obj()->name();
370
-		}else{
370
+		} else{
371 371
 			return '';
372 372
 		}
373 373
 	}
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	public function country_name(){
416 416
 		if( $this->country_obj() ){
417 417
 			return $this->country_obj()->name();
418
-		}else{
418
+		} else{
419 419
 			return '';
420 420
 		}
421 421
 	}
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	public function get_billing_info_postmeta_name($payment_method){
548 548
 		if( $payment_method->type_obj() instanceof EE_PMT_Base ){
549 549
 			return 'billing_info_' . $payment_method->type_obj()->system_name();
550
-		}else{
550
+		} else{
551 551
 			return NULL;
552 552
 		}
553 553
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Ticket.model.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Ticket.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Ticket.class.php');
26 26
 
27 27
 class EEM_Ticket extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,35 +35,35 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Ticket','event_espresso');
40
-		$this->plural_item = __('Tickets','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Ticket', 'event_espresso');
40
+		$this->plural_item = __('Tickets', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Ticket'=>array(
47
-				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')),
48
-				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'),
47
+				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')),
48
+				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'),
49 49
 				'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''),
50
-				'TKT_description'=>new EE_Post_Content_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ),
51
-				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, time(), $timezone ),
52
-				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, time(), $timezone ),
53
-				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ),
54
-				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ),
50
+				'TKT_description'=>new EE_Post_Content_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''),
51
+				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, time(), $timezone),
52
+				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, time(), $timezone),
53
+				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0),
54
+				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF),
55 55
 				'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0),
56 56
 				'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0),
57
-				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF),
58
-				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ),
59
-				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ),
60
-				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false),
61
-				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ),
57
+				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF),
58
+				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF),
59
+				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false),
60
+				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false),
61
+				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false),
62 62
 				'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0),
63
-				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ),
63
+				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0),
64 64
 				'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false),
65
-				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ),
66
-				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 )
65
+				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE),
66
+				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0)
67 67
 			));
68 68
 		$this->_model_relations = array(
69 69
 			'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		);
76 76
 
77 77
 		//this model is generally available for reading
78
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
78
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
79 79
 		//account for default tickets in the caps
80
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
81
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
82
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
83
-		parent::__construct( $timezone );
80
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
81
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
82
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
83
+		parent::__construct($timezone);
84 84
 	}
85 85
 
86 86
 
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function get_all_default_tickets() {
93 93
 		/** @type EE_Ticket[] $tickets */
94
-		$tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')) );
94
+		$tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')));
95 95
 		//we need to set the start date and end date to today's date and the start of the default dtt
96
-		return $this->_set_default_dates( $tickets );
96
+		return $this->_set_default_dates($tickets);
97 97
 	}
98 98
 
99 99
 
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	 * @param EE_Ticket[] $tickets
104 104
 	 * @return EE_Ticket[]
105 105
 	 */
106
-	private function _set_default_dates( $tickets ) {
107
-		foreach ( $tickets as $ticket ) {
108
-			$ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true) );
109
-			$ticket->set('TKT_end_date', $this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) );
110
-			$ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) );
106
+	private function _set_default_dates($tickets) {
107
+		foreach ($tickets as $ticket) {
108
+			$ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true));
109
+			$ticket->set('TKT_end_date', $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30));
110
+			$ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone));
111 111
 		}
112 112
 
113 113
 		return $tickets;
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @param array $query_params
123 123
 	 * @return int
124 124
 	 */
125
-	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){
126
-		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params );
125
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
126
+		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params);
127 127
 	}
128 128
 
129 129
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @param EE_Ticket[] $tickets
134 134
 	 * @return void
135 135
 	 */
136
-	public function update_tickets_sold($tickets){
137
-		foreach($tickets as $ticket){
136
+	public function update_tickets_sold($tickets) {
137
+		foreach ($tickets as $ticket) {
138 138
 			/* @var  $ticket EE_Ticket */
139 139
 			$ticket->update_tickets_sold();
140 140
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Question.model.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
 	exit('No direct script access allowed');
3 3
 }
4
-require_once( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
5
-require_once( EE_CLASSES . 'EE_Question.class.php' );
4
+require_once(EE_MODELS.'EEM_Soft_Delete_Base.model.php');
5
+require_once(EE_CLASSES.'EE_Question.class.php');
6 6
 
7 7
 
8 8
 
@@ -101,52 +101,52 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @param null $timezone
103 103
 	 */
104
-	protected function __construct( $timezone = NULL ) {
105
-		$this->singular_item = __('Question','event_espresso');
106
-		$this->plural_item = __('Questions','event_espresso');
107
-		$this->_allowed_question_types=apply_filters(
104
+	protected function __construct($timezone = NULL) {
105
+		$this->singular_item = __('Question', 'event_espresso');
106
+		$this->plural_item = __('Questions', 'event_espresso');
107
+		$this->_allowed_question_types = apply_filters(
108 108
 			'FHEE__EEM_Question__construct__allowed_question_types',
109 109
 			array(
110
-				EEM_Question::QST_type_text =>__('Text','event_espresso'),
111
-				EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'),
112
-				EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'),
113
-				EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'),
114
-				EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'),
115
-				EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'),
116
-				EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'),
117
-				EEM_Question::QST_type_date =>__('Date Picker','event_espresso'),
118
-				EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ),
119
-				EEM_Question::QST_type_email => __( 'Email', 'event_espresso' ),
120
-				EEM_Question::QST_type_us_phone => __( 'USA - Format Phone', 'event_espresso' ),
121
-				EEM_Question::QST_type_decimal => __( 'Number', 'event_espresso' ),
122
-				EEM_Question::QST_type_int => __( 'Whole Number', 'event_espresso' ),
123
-				EEM_Question::QST_type_url => __( 'URL', 'event_espresso' ),
124
-				EEM_Question::QST_type_year => __( 'Year', 'event_espresso' ),
125
-				EEM_Question::QST_type_multi_select => __( 'Multi Select', 'event_espresso' )
110
+				EEM_Question::QST_type_text =>__('Text', 'event_espresso'),
111
+				EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'),
112
+				EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'),
113
+				EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'),
114
+				EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'),
115
+				EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'),
116
+				EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'),
117
+				EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'),
118
+				EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'),
119
+				EEM_Question::QST_type_email => __('Email', 'event_espresso'),
120
+				EEM_Question::QST_type_us_phone => __('USA - Format Phone', 'event_espresso'),
121
+				EEM_Question::QST_type_decimal => __('Number', 'event_espresso'),
122
+				EEM_Question::QST_type_int => __('Whole Number', 'event_espresso'),
123
+				EEM_Question::QST_type_url => __('URL', 'event_espresso'),
124
+				EEM_Question::QST_type_year => __('Year', 'event_espresso'),
125
+				EEM_Question::QST_type_multi_select => __('Multi Select', 'event_espresso')
126 126
 			)
127 127
 		);
128 128
 		$this->_question_descriptions = apply_filters(
129 129
 			'FHEE__EEM_Question__construct__allowed_question_types',
130 130
 			array(
131
-				EEM_Question::QST_type_text          => __( 'A single line text input field', 'event_espresso' ),
132
-				EEM_Question::QST_type_textarea      => __( 'A multi line text input field', 'event_espresso' ),
133
-				EEM_Question::QST_type_checkbox      => __( 'Allows multiple preset options to be selected', 'event_espresso' ),
134
-				EEM_Question::QST_type_radio         => __( 'Allows a single preset option to be selected', 'event_espresso' ),
135
-				EEM_Question::QST_type_dropdown      => __( 'A dropdown that allows a single selection', 'event_espresso' ),
136
-				EEM_Question::QST_type_state         => __( 'A dropdown that lists states/provinces', 'event_espresso' ),
137
-				EEM_Question::QST_type_country       => __( 'A dropdown that lists countries', 'event_espresso' ),
138
-				EEM_Question::QST_type_date          => __( 'A popup calendar that allows date selections', 'event_espresso' ),
139
-				EEM_Question::QST_type_html_textarea => __( 'A multi line text input field that allows HTML', 'event_espresso' ),
140
-				EEM_Question::QST_type_email         => __( 'A text field that must contain a valid Email address', 'event_espresso' ),
141
-				EEM_Question::QST_type_us_phone      => __( 'A text field that must contain a valid US phone number', 'event_espresso' ),
142
-				EEM_Question::QST_type_decimal       => __( 'A text field that allows number values with decimals', 'event_espresso' ),
143
-				EEM_Question::QST_type_int           => __( 'A text field that only allows whole numbers (no decimals)', 'event_espresso' ),
144
-				EEM_Question::QST_type_url           => __( 'A text field that must contain a valid URL', 'event_espresso' ),
145
-				EEM_Question::QST_type_year          => __( 'A dropdown that lists the last 100 years', 'event_espresso' ),
146
-				EEM_Question::QST_type_multi_select  => __( 'A dropdown that allows multiple selections', 'event_espresso' )
131
+				EEM_Question::QST_type_text          => __('A single line text input field', 'event_espresso'),
132
+				EEM_Question::QST_type_textarea      => __('A multi line text input field', 'event_espresso'),
133
+				EEM_Question::QST_type_checkbox      => __('Allows multiple preset options to be selected', 'event_espresso'),
134
+				EEM_Question::QST_type_radio         => __('Allows a single preset option to be selected', 'event_espresso'),
135
+				EEM_Question::QST_type_dropdown      => __('A dropdown that allows a single selection', 'event_espresso'),
136
+				EEM_Question::QST_type_state         => __('A dropdown that lists states/provinces', 'event_espresso'),
137
+				EEM_Question::QST_type_country       => __('A dropdown that lists countries', 'event_espresso'),
138
+				EEM_Question::QST_type_date          => __('A popup calendar that allows date selections', 'event_espresso'),
139
+				EEM_Question::QST_type_html_textarea => __('A multi line text input field that allows HTML', 'event_espresso'),
140
+				EEM_Question::QST_type_email         => __('A text field that must contain a valid Email address', 'event_espresso'),
141
+				EEM_Question::QST_type_us_phone      => __('A text field that must contain a valid US phone number', 'event_espresso'),
142
+				EEM_Question::QST_type_decimal       => __('A text field that allows number values with decimals', 'event_espresso'),
143
+				EEM_Question::QST_type_int           => __('A text field that only allows whole numbers (no decimals)', 'event_espresso'),
144
+				EEM_Question::QST_type_url           => __('A text field that must contain a valid URL', 'event_espresso'),
145
+				EEM_Question::QST_type_year          => __('A dropdown that lists the last 100 years', 'event_espresso'),
146
+				EEM_Question::QST_type_multi_select  => __('A dropdown that allows multiple selections', 'event_espresso')
147 147
 			)
148 148
 		);
149
-		$this->_question_type_categories = (array)apply_filters(
149
+		$this->_question_type_categories = (array) apply_filters(
150 150
 				'FHEE__EEM_Question__construct__question_type_categories',
151 151
 				array(
152 152
 				'text' => array(
@@ -171,22 +171,22 @@  discard block
 block discarded – undo
171 171
 		);
172 172
 
173 173
 		$this->_tables = array(
174
-			'Question'=>new EE_Primary_Table('esp_question','QST_ID')
174
+			'Question'=>new EE_Primary_Table('esp_question', 'QST_ID')
175 175
 		);
176 176
 		$this->_fields = array(
177 177
 			'Question'=>array(
178
-				'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')),
179
-				'QST_display_text'=>new EE_Post_Content_Field('QST_display_text', __('Question Text','event_espresso'), true, ''),
180
-				'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''),
181
-				'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), false, '' ),
182
-				'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types),
183
-				'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false),
184
-				'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''),
185
-				'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0),
186
-				'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false),
187
-				'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso'	), false, EE_INF ),
188
-				'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ),
189
-				'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false)
178
+				'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')),
179
+				'QST_display_text'=>new EE_Post_Content_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''),
180
+				'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''),
181
+				'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), false, ''),
182
+				'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types),
183
+				'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false),
184
+				'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''),
185
+				'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0),
186
+				'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false),
187
+				'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF),
188
+				'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false),
189
+				'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false)
190 190
 			)
191 191
 		);
192 192
 		$this->_model_relations = array(
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
 			'Question_Group_Question'=>new EE_Has_Many_Relation()
199 199
 		);
200 200
 		//this model is generally available for reading
201
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
202
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system');
203
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system');
204
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system');
205
-		parent::__construct( $timezone );
201
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
202
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system');
203
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system');
204
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system');
205
+		parent::__construct($timezone);
206 206
 	}
207 207
 
208 208
 	/**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * but they can be extended
211 211
 	 * @return string[]
212 212
 	 */
213
-	public function allowed_question_types(){
213
+	public function allowed_question_types() {
214 214
 		return $this->_allowed_question_types;
215 215
 	}
216 216
 	/**
@@ -218,16 +218,16 @@  discard block
 block discarded – undo
218 218
 	 * @param string $question_type one of EEM_Question::allowed_question_types(
219 219
 	 * @return string[] like EEM_Question::allowed_question_types()
220 220
 	 */
221
-	public function question_types_in_same_category( $question_type ) {
222
-		$question_types = array( $question_type );
223
-		foreach( $this->_question_type_categories as $category => $question_types_in_category ) {
224
-			if( in_array( $question_type, $question_types_in_category ) ) {
221
+	public function question_types_in_same_category($question_type) {
222
+		$question_types = array($question_type);
223
+		foreach ($this->_question_type_categories as $category => $question_types_in_category) {
224
+			if (in_array($question_type, $question_types_in_category)) {
225 225
 				$question_types = $question_types_in_category;
226 226
 				break;
227 227
 			}
228 228
 		}
229 229
 
230
-		return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) );
230
+		return array_intersect_key($this->allowed_question_types(), array_flip($question_types));
231 231
 	}
232 232
 
233 233
 	/**
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
 	 * @param string $category one of the top-level keys of EEM_Question::question_type_categories()
237 237
 	 * @return boolean
238 238
 	 */
239
-	public function question_type_is_in_category( $question_type, $category ) {
240
-		if( ! isset( $this->_question_type_categories[ $category ] ) ) {
239
+	public function question_type_is_in_category($question_type, $category) {
240
+		if ( ! isset($this->_question_type_categories[$category])) {
241 241
 			return false;
242 242
 		}
243
-		return in_array( $question_type, $this->_question_type_categories[ $category ] );
243
+		return in_array($question_type, $this->_question_type_categories[$category]);
244 244
 	}
245 245
 
246 246
 	/**
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
 	 * @param string $system_question_group_id QSG_system
258 258
 	 * @return array of system question names (QST_system)
259 259
 	 */
260
-	public function allowed_system_questions_in_system_question_group( $system_question_group_id ) {
260
+	public function allowed_system_questions_in_system_question_group($system_question_group_id) {
261 261
 		$question_system_ids = array();
262
-		switch( $system_question_group_id ) {
262
+		switch ($system_question_group_id) {
263 263
 			case EEM_Question_Group::system_personal:
264 264
 				$question_system_ids = array(
265 265
 					EEM_Attendee::system_question_fname,
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 				);
281 281
 				break;
282 282
 		}
283
-		return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id );
283
+		return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id);
284 284
 	}
285 285
 
286 286
 	/**
@@ -289,11 +289,11 @@  discard block
 block discarded – undo
289 289
 	 * @param string $system_question_group_id QSG_system
290 290
 	 * @return array of system question names (QST_system)
291 291
 	 */
292
-	public function required_system_questions_in_system_question_group( $system_question_group_id ) {
292
+	public function required_system_questions_in_system_question_group($system_question_group_id) {
293 293
 		$question_system_ids = null;
294
-		switch( $system_question_group_id ) {
294
+		switch ($system_question_group_id) {
295 295
 			case EEM_Question_Group::system_personal:
296
-				$question_system_ids =  array(
296
+				$question_system_ids = array(
297 297
 					EEM_Attendee::system_question_fname,
298 298
 					EEM_Attendee::system_question_email,
299 299
 				);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			default:
302 302
 				$question_system_ids = array();
303 303
 		}
304
-		return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id );
304
+		return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id);
305 305
 	}
306 306
 
307 307
 
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
 	 * @param $QST_system
313 313
 	 * @return int of QST_ID for the question that corresponds to that QST_system
314 314
 	 */
315
-	public function get_Question_ID_from_system_string( $QST_system ){
316
-		 return $this->get_var( array( array( 'QST_system' => $QST_system ) ) );
315
+	public function get_Question_ID_from_system_string($QST_system) {
316
+		 return $this->get_var(array(array('QST_system' => $QST_system)));
317 317
 	}
318 318
 
319 319
 
@@ -325,10 +325,10 @@  discard block
 block discarded – undo
325 325
 	 */
326 326
 	public function get_latest_question_order() {
327 327
 		$columns_to_select = array(
328
-			'max_order' => array("MAX(QST_order)","%d")
328
+			'max_order' => array("MAX(QST_order)", "%d")
329 329
 		);
330
-		$max = $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select );
331
-		return isset( $max[0], $max[0]['max_order'] ) ? $max[0]['max_order'] : 0;
330
+		$max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select);
331
+		return isset($max[0], $max[0]['max_order']) ? $max[0]['max_order'] : 0;
332 332
 	}
333 333
 
334 334
 	/**
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 	 * @param string $system_question_value
358 358
 	 * @return int|float
359 359
 	 */
360
-	public function absolute_max_for_system_question( $system_question_value ) {
360
+	public function absolute_max_for_system_question($system_question_value) {
361 361
 		$maxes = $this->system_question_maxes();
362
-		if( isset( $maxes[ $system_question_value ] ) ) {
363
-			return $maxes[ $system_question_value ];
362
+		if (isset($maxes[$system_question_value])) {
363
+			return $maxes[$system_question_value];
364 364
 		} else {
365 365
 			return EE_INF;
366 366
 		}
Please login to merge, or discard this patch.
core/db_models/fields/EE_Full_HTML_Field.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * but you want to have an exceptional case where users can directly submit content
12 12
  * for this field, then you should first run the content through `wp_kses( $content, 'post' )`
13 13
  */
14
-class EE_Full_HTML_Field extends EE_Text_Field_Base{
14
+class EE_Full_HTML_Field extends EE_Text_Field_Base {
15 15
 
16 16
 
17 17
 	/**
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 	 * @return string
22 22
 	 */
23 23
 	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) {
24
-		if($schema =='form_input'){
24
+		if ($schema == 'form_input') {
25 25
 			return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
26
-		}elseif($schema == 'no_wpautop'){
26
+		}elseif ($schema == 'no_wpautop') {
27 27
 			return do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema));
28
-		}else{
28
+		} else {
29 29
 			return wpautop(do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema)));
30 30
 		}
31 31
 	}
Please login to merge, or discard this patch.
core/db_models/fields/EE_Post_Content_Field.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,20 +3,20 @@
 block discarded – undo
3 3
  * Field to only allow tags that are normally allowed on post_content:
4 4
  * address,a,abbr,acronym,area,article,aside,b,big,blockquote,br,button,caption,cite,code,col,del,dd,dfn,details,div,dl,dt,em,fieldset,figure,figcaption,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,ins,kbd,label,legend,li,map,mark,menu,nav,p,pre,q,s,samp,span,section,small,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,ol,var
5 5
  */
6
-class EE_Post_Content_Field extends EE_Text_Field_Base{
6
+class EE_Post_Content_Field extends EE_Text_Field_Base {
7 7
 	/**
8 8
 	 * removes all tags which a WP Post wouldn't allow in its content normally
9 9
 	 * @param string $value
10 10
 	 * @return string
11 11
 	 */
12 12
 	function prepare_for_set($value) {
13
-		if( ! current_user_can( 'unfiltered_html' ) ) {
14
-			$value =  wp_kses("$value",wp_kses_allowed_html( 'post' ));
13
+		if ( ! current_user_can('unfiltered_html')) {
14
+			$value = wp_kses("$value", wp_kses_allowed_html('post'));
15 15
 		}
16 16
 		return parent::prepare_for_set($value);
17 17
 	}
18 18
 	
19
-	function prepare_for_set_from_db($value_found_in_db_for_model_object){
19
+	function prepare_for_set_from_db($value_found_in_db_for_model_object) {
20 20
 		return $value_found_in_db_for_model_object;
21 21
 	}
22 22
 }
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_Email_Field.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	 * @param string $value_inputted_for_field_on_model_object
14 14
 	 * @return string
15 15
 	 */
16
-	function prepare_for_set( $value_inputted_for_field_on_model_object ) {
16
+	function prepare_for_set($value_inputted_for_field_on_model_object) {
17 17
 		if ( ! preg_match(
18 18
 			'/^(?!\.)((?!.*\.{2})[a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\.!#$%&\'*+-\/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\-\.\d]+)((\.([a-zA-Z\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}]){2,63})+)$/u',
19 19
 			$value_inputted_for_field_on_model_object
Please login to merge, or discard this patch.
core/db_models/EEM_Question_Option.model.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once( EE_CLASSES . 'EE_Question_Option.class.php');
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once(EE_CLASSES.'EE_Question_Option.class.php');
26 26
 
27 27
 
28 28
 class EEM_Question_Option extends EEM_Soft_Delete_Base {
@@ -30,22 +30,22 @@  discard block
 block discarded – undo
30 30
   	// private instance of the Attendee object
31 31
 	protected static $_instance = NULL;
32 32
 
33
-	protected function __construct( $timezone = NULL ) {
34
-		$this->singular_item = __('Question Option','event_espresso');
35
-		$this->plural_item = __('Question Options','event_espresso');
33
+	protected function __construct($timezone = NULL) {
34
+		$this->singular_item = __('Question Option', 'event_espresso');
35
+		$this->plural_item = __('Question Options', 'event_espresso');
36 36
 
37 37
 		$this->_tables = array(
38
-			'Question_Option'=>new EE_Primary_Table('esp_question_option','QSO_ID')
38
+			'Question_Option'=>new EE_Primary_Table('esp_question_option', 'QSO_ID')
39 39
 		);
40 40
 		$this->_fields = array(
41 41
 			'Question_Option'=>array(
42
-					'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID','event_espresso')),
43
-					'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'),
44
-					'QSO_value'=>new EE_Plain_Text_Field('QSO_value',  __("Question Option Value", "event_espresso"),false,''),
45
-					'QSO_desc'=>new EE_Post_Content_Field('QSO_desc', __('Question Option Description','event_espresso'), false, ''),
46
-					'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso' ), false, 0 ),
47
-					'QSO_system'=>new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option','event_espresso'), TRUE, NULL ),
48
-					'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed','event_espresso'), false, false)
42
+					'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID', 'event_espresso')),
43
+					'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'),
44
+					'QSO_value'=>new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"), false, ''),
45
+					'QSO_desc'=>new EE_Post_Content_Field('QSO_desc', __('Question Option Description', 'event_espresso'), false, ''),
46
+					'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso'), false, 0),
47
+					'QSO_system'=>new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option', 'event_espresso'), TRUE, NULL),
48
+					'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed', 'event_espresso'), false, false)
49 49
 				)
50 50
 		);
51 51
 		$this->_model_relations = array(
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$this->_model_chain_to_wp_user = 'Question';
56 56
 		//this model is generally available for reading
57
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
58
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
60
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
57
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
58
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('Question_Option');
59
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('Question_Option');
60
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('Question_Option');
61 61
 		$this->_caps_slug = 'questions';
62
-		parent::__construct( $timezone );
62
+		parent::__construct($timezone);
63 63
 	}
64 64
 
65 65
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Question_Group.model.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once( EE_CLASSES . 'EE_Question_Group.class.php');
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once(EE_CLASSES.'EE_Question_Group.class.php');
26 26
 class EEM_Question_Group extends EEM_Soft_Delete_Base {
27 27
 	const system_personal = 1;
28 28
 	const system_address = 2;
@@ -30,25 +30,25 @@  discard block
 block discarded – undo
30 30
 	protected static $_instance = NULL;
31 31
         
32 32
         
33
-	protected function __construct( $timezone = NULL ) {
34
-		$this->singular_item = __('Question Group','event_espresso');
35
-		$this->plural_item = __('Question Groups','event_espresso');
33
+	protected function __construct($timezone = NULL) {
34
+		$this->singular_item = __('Question Group', 'event_espresso');
35
+		$this->plural_item = __('Question Groups', 'event_espresso');
36 36
 
37 37
 		$this->_tables = array(
38
-			'Question_Group'=>new EE_Primary_Table('esp_question_group','QSG_ID')
38
+			'Question_Group'=>new EE_Primary_Table('esp_question_group', 'QSG_ID')
39 39
 		);
40 40
 		$this->_fields = array(
41 41
 			'Question_Group'=>array(
42
-				'QSG_ID'=>new EE_Primary_Key_Int_Field('QSG_ID', __('Question Group ID','event_espresso')),
43
-				'QSG_name'=>new EE_Plain_Text_Field('QSG_name', __('Question Group Name','event_espresso'), false, ''),
44
-				'QSG_identifier'=>new EE_Plain_Text_Field('QSG_identifier', __('Text ID for question Group','event_espresso'), false, ''),
45
-				'QSG_desc'=>new EE_Post_Content_Field('QSG_desc', __('Description of Question Group','event_espresso'), true, ''),
46
-				'QSG_order'=>new EE_Integer_Field('QSG_order', __('Order in which to show the question group','event_espresso'), true, 0),
47
-				'QSG_show_group_name'=>new EE_Boolean_Field('QSG_show_group_name', __('Flag indicating whether to show the group\'s name on the registration page','event_espresso'), false, true),
48
-				'QSG_show_group_desc'=>new EE_Boolean_Field('QSG_show_group_desc', __('Flag indicating whether to show the group\s description on the registration page','event_espresso'), false, false),
49
-				'QSG_wp_user' => new EE_WP_User_Field('QSG_wp_user', __('Question Group Creator ID', 'event_espresso'), FALSE ),
50
-				'QSG_system'=>new EE_Integer_Field('QSG_system', __('Indicate IF this is a system group and if it is what system group it corresponds to.','event_espresso'), false, 0),
51
-				'QSG_deleted'=>new EE_Trashed_Flag_Field('QSG_deleted', __('Flag indicating this question group was deleted','event_espresso'), false, false)
42
+				'QSG_ID'=>new EE_Primary_Key_Int_Field('QSG_ID', __('Question Group ID', 'event_espresso')),
43
+				'QSG_name'=>new EE_Plain_Text_Field('QSG_name', __('Question Group Name', 'event_espresso'), false, ''),
44
+				'QSG_identifier'=>new EE_Plain_Text_Field('QSG_identifier', __('Text ID for question Group', 'event_espresso'), false, ''),
45
+				'QSG_desc'=>new EE_Post_Content_Field('QSG_desc', __('Description of Question Group', 'event_espresso'), true, ''),
46
+				'QSG_order'=>new EE_Integer_Field('QSG_order', __('Order in which to show the question group', 'event_espresso'), true, 0),
47
+				'QSG_show_group_name'=>new EE_Boolean_Field('QSG_show_group_name', __('Flag indicating whether to show the group\'s name on the registration page', 'event_espresso'), false, true),
48
+				'QSG_show_group_desc'=>new EE_Boolean_Field('QSG_show_group_desc', __('Flag indicating whether to show the group\s description on the registration page', 'event_espresso'), false, false),
49
+				'QSG_wp_user' => new EE_WP_User_Field('QSG_wp_user', __('Question Group Creator ID', 'event_espresso'), FALSE),
50
+				'QSG_system'=>new EE_Integer_Field('QSG_system', __('Indicate IF this is a system group and if it is what system group it corresponds to.', 'event_espresso'), false, 0),
51
+				'QSG_deleted'=>new EE_Trashed_Flag_Field('QSG_deleted', __('Flag indicating this question group was deleted', 'event_espresso'), false, false)
52 52
 			)
53 53
 		);
54 54
 		$this->_model_relations = array(
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 			'WP_User' => new EE_Belongs_To_Relation(),
59 59
 		);
60 60
 		//this model is generally available for reading
61
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
62
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QSG_system');
63
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QSG_system');
64
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QSG_system');
65
-		parent::__construct( $timezone );
61
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
62
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QSG_system');
63
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QSG_system');
64
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QSG_system');
65
+		parent::__construct($timezone);
66 66
 
67 67
 	}
68 68
 	/**
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function get_latest_question_group_order() {
74 74
 		$columns_to_select = array(
75
-			'max_order' => array("MAX(QSG_order)","%d")
75
+			'max_order' => array("MAX(QSG_order)", "%d")
76 76
 			);
77
-		$max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select );
77
+		$max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select);
78 78
 		return $max[0]['max_order'];
79 79
 	}
80 80
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/EE_Payment_Processor.core.php 2 patches
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 /**
4 4
  *
5 5
  * EE_Payment_Processor
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function instance() {
29 29
 		// check if class object is instantiated
30
-		if ( ! self::$_instance instanceof EE_Payment_Processor ) {
30
+		if ( ! self::$_instance instanceof EE_Payment_Processor) {
31 31
 			self::$_instance = new self();
32 32
 		}
33 33
 		return self::$_instance;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *@return EE_Payment_Processor
43 43
 	 */
44 44
 	private function __construct() {
45
-		do_action( 'AHEE__EE_Payment_Processor__construct' );
45
+		do_action('AHEE__EE_Payment_Processor__construct');
46 46
 	}
47 47
 
48 48
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		$update_txn = true,
82 82
 		$cancel_url = ''
83 83
 	) {
84
-		if( (float)$amount < 0 ) {
84
+		if ((float) $amount < 0) {
85 85
 			throw new EE_Error(
86 86
 				sprintf(
87 87
 					__(
@@ -94,33 +94,33 @@  discard block
 block discarded – undo
94 94
 			);
95 95
 		}
96 96
 		// verify payment method
97
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE );
97
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE);
98 98
 		// verify transaction
99
-		EEM_Transaction::instance()->ensure_is_obj( $transaction );
100
-		$transaction->set_payment_method_ID( $payment_method->ID() );
99
+		EEM_Transaction::instance()->ensure_is_obj($transaction);
100
+		$transaction->set_payment_method_ID($payment_method->ID());
101 101
 		// verify payment method type
102
-		if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
102
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
103 103
 			$payment = $payment_method->type_obj()->process_payment(
104 104
 				$transaction,
105
-				min( $amount, $transaction->remaining() ),//make sure we don't overcharge
105
+				min($amount, $transaction->remaining()), //make sure we don't overcharge
106 106
 				$billing_form,
107 107
 				$return_url,
108
-				add_query_arg( array( 'ee_cancel_payment' => true ), $cancel_url ),
108
+				add_query_arg(array('ee_cancel_payment' => true), $cancel_url),
109 109
 				$method,
110 110
 				$by_admin
111 111
 			);
112 112
 			// check if payment method uses an off-site gateway
113
-			if ( $payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite ) {
113
+			if ($payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite) {
114 114
 				// don't process payments for off-site gateways yet because no payment has occurred yet
115
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
115
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
116 116
 			}
117 117
 			return $payment;
118 118
 		} else {
119 119
 			EE_Error::add_error(
120 120
 				sprintf(
121
-					__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
121
+					__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
122 122
 					'<br/>',
123
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
123
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
124 124
 				), __FILE__, __FUNCTION__, __LINE__
125 125
 			);
126 126
 			return NULL;
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 	 * @throws EE_Error
137 137
 	 * @return string
138 138
 	 */
139
-	public function get_ipn_url_for_payment_method( $transaction, $payment_method ){
139
+	public function get_ipn_url_for_payment_method($transaction, $payment_method) {
140 140
 		/** @type \EE_Transaction $transaction */
141
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
141
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
142 142
 		$primary_reg = $transaction->primary_registration();
143
-		if( ! $primary_reg instanceof EE_Registration ){
143
+		if ( ! $primary_reg instanceof EE_Registration) {
144 144
 			throw new EE_Error(
145 145
 				sprintf(
146 146
 					__(
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 				)
152 152
 			);
153 153
 		}
154
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true);
154
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true);
155 155
 		$url = add_query_arg(
156 156
 			array(
157 157
 				'e_reg_url_link'=>$primary_reg->reg_url_link(),
@@ -188,92 +188,92 @@  discard block
 block discarded – undo
188 188
 		$update_txn = true,
189 189
 		$separate_IPN_request = true
190 190
 	) {
191
-		EE_Registry::instance()->load_model( 'Change_Log' );
192
-		$_req_data = $this->_remove_unusable_characters_from_array( (array)$_req_data );
193
-		EE_Processor_Base::set_IPN( $separate_IPN_request );
191
+		EE_Registry::instance()->load_model('Change_Log');
192
+		$_req_data = $this->_remove_unusable_characters_from_array((array) $_req_data);
193
+		EE_Processor_Base::set_IPN($separate_IPN_request);
194 194
 		$obj_for_log = null;
195
-		if( $transaction instanceof EE_Transaction ){
195
+		if ($transaction instanceof EE_Transaction) {
196 196
 			$obj_for_log = $transaction;
197
-			if( $payment_method instanceof EE_Payment_Method ) {
197
+			if ($payment_method instanceof EE_Payment_Method) {
198 198
 				$obj_for_log = EEM_Payment::instance()->get_one(
199 199
 					array(
200
-						array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ),
201
-						'order_by' => array( 'PAY_timestamp' => 'desc' )
200
+						array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()),
201
+						'order_by' => array('PAY_timestamp' => 'desc')
202 202
 					)
203 203
 				);
204 204
 			}
205
-		} else if( $payment_method instanceof EE_Payment ) {
205
+		} else if ($payment_method instanceof EE_Payment) {
206 206
 			$obj_for_log = $payment_method;
207 207
 		}
208 208
 		$log = EEM_Change_Log::instance()->log(
209 209
 			EEM_Change_Log::type_gateway,
210
-			array( 'IPN data received' => $_req_data ),
210
+			array('IPN data received' => $_req_data),
211 211
 			$obj_for_log
212 212
 		);
213
-		try{
213
+		try {
214 214
 			/**
215 215
 			 * @var EE_Payment $payment
216 216
 			 */
217 217
 			$payment = NULL;
218
-			if($transaction && $payment_method){
218
+			if ($transaction && $payment_method) {
219 219
 				/** @type EE_Transaction $transaction */
220 220
 				$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
221 221
 				/** @type EE_Payment_Method $payment_method */
222 222
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
223
-				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
224
-						$payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction );
223
+				if ($payment_method->type_obj() instanceof EE_PMT_Base) {
224
+						$payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
225 225
 						$log->set_object($payment);
226 226
 				} else {
227 227
 					// not a payment
228 228
 					EE_Error::add_error(
229 229
 						sprintf(
230
-							__( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ),
230
+							__('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'),
231 231
 							'<br/>',
232
-							EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
232
+							EE_Registry::instance()->CFG->organization->get_pretty('email')
233 233
 						),
234 234
 						__FILE__, __FUNCTION__, __LINE__
235 235
 					);
236 236
 				}
237
-			}else{
237
+			} else {
238 238
 				//that's actually pretty ok. The IPN just wasn't able
239 239
 				//to identify which transaction or payment method this was for
240 240
 				// give all active payment methods a chance to claim it
241 241
 				$active_payment_methods = EEM_Payment_Method::instance()->get_all_active();
242
-				foreach( $active_payment_methods as $active_payment_method ){
243
-					try{
244
-						$payment = $active_payment_method->type_obj()->handle_unclaimed_ipn( $_req_data );
242
+				foreach ($active_payment_methods as $active_payment_method) {
243
+					try {
244
+						$payment = $active_payment_method->type_obj()->handle_unclaimed_ipn($_req_data);
245 245
 						$payment_method = $active_payment_method;
246 246
 						EEM_Change_Log::instance()->log(
247 247
 							EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment
248 248
 						);
249 249
 						break;
250
-					} catch( EE_Error $e ) {
250
+					} catch (EE_Error $e) {
251 251
 						//that's fine- it apparently couldn't handle the IPN
252 252
 					}
253 253
 				}
254 254
 
255 255
 			}
256 256
 // 			EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method);
257
-			if( $payment instanceof EE_Payment){
257
+			if ($payment instanceof EE_Payment) {
258 258
 				$payment->save();
259 259
 				//  update the TXN
260
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
261
-			}else{
260
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request);
261
+			} else {
262 262
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
263
-				if($payment_method){
263
+				if ($payment_method) {
264 264
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
265
-				}elseif($transaction){
265
+				}elseif ($transaction) {
266 266
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
267 267
 				}
268 268
 			}
269 269
 			return $payment;
270 270
 
271
-		} catch( EE_Error $e ) {
271
+		} catch (EE_Error $e) {
272 272
 			do_action(
273 273
 				'AHEE__log', __FILE__, __FUNCTION__, sprintf(
274
-					__( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ),
275
-					print_r( $transaction, TRUE ),
276
-					print_r( $_req_data, TRUE ),
274
+					__('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'),
275
+					print_r($transaction, TRUE),
276
+					print_r($_req_data, TRUE),
277 277
 					$e->getMessage()
278 278
 				)
279 279
 			);
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 	 * @param  array $request_data
289 289
 	 * @return array
290 290
 	 */
291
-	protected function _remove_unusable_characters_from_array( array $request_data ) {
291
+	protected function _remove_unusable_characters_from_array(array $request_data) {
292 292
 		$return_data = array();
293
-		foreach( $request_data as $key => $value ) {
294
-			$return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value );
293
+		foreach ($request_data as $key => $value) {
294
+			$return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value);
295 295
 		}
296 296
 		return $return_data;
297 297
 	}
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
 	 * @param string $request_data
304 304
 	 * @return string
305 305
 	 */
306
-	protected function _remove_unusable_characters( $request_data ) {
307
-		return preg_replace( '/[^[:print:]]/', '', $request_data );
306
+	protected function _remove_unusable_characters($request_data) {
307
+		return preg_replace('/[^[:print:]]/', '', $request_data);
308 308
 	}
309 309
 
310 310
 
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
 	 * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO,
327 327
 	 *                                      to call handle_ipn() for offsite gateways that don't receive separate IPNs
328 328
 	 */
329
-	public function finalize_payment_for( $transaction, $update_txn = TRUE ){
329
+	public function finalize_payment_for($transaction, $update_txn = TRUE) {
330 330
 		/** @var $transaction EE_Transaction */
331
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
331
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
332 332
 		$last_payment_method = $transaction->payment_method();
333
-		if ( $last_payment_method instanceof EE_Payment_Method ) {
334
-			$payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction );
335
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
333
+		if ($last_payment_method instanceof EE_Payment_Method) {
334
+			$payment = $last_payment_method->type_obj()->finalize_payment_for($transaction);
335
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
336 336
 			return $payment;
337 337
 		} else {
338 338
 			return NULL;
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
 		EE_Payment $payment_to_refund,
356 356
 		$refund_info = array()
357 357
 	) {
358
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) {
359
-			$payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info );
360
-			$this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund );
358
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) {
359
+			$payment_method->type_obj()->process_refund($payment_to_refund, $refund_info);
360
+			$this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund);
361 361
 		}
362 362
 		return $payment_to_refund;
363 363
 	}
@@ -398,12 +398,12 @@  discard block
 block discarded – undo
398 398
 	 *                        TXN is locked before updating
399 399
 	 * @throws \EE_Error
400 400
 	 */
401
-	public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){
401
+	public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) {
402 402
 		$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful';
403 403
 		/** @type EE_Transaction $transaction */
404
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
404
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
405 405
 		// can we freely update the TXN at this moment?
406
-		if ( $IPN && $transaction->is_locked() ) {
406
+		if ($IPN && $transaction->is_locked()) {
407 407
 			// don't update the transaction at this exact moment
408 408
 			// because the TXN is active in another request
409 409
 			EE_Cron_Tasks::schedule_update_transaction_with_payment(
@@ -413,45 +413,45 @@  discard block
 block discarded – undo
413 413
 			);
414 414
 		} else {
415 415
 			// verify payment and that it has been saved
416
-			if ( $payment instanceof EE_Payment && $payment->ID() ) {
417
-				if(
416
+			if ($payment instanceof EE_Payment && $payment->ID()) {
417
+				if (
418 418
 					$payment->payment_method() instanceof EE_Payment_Method
419 419
 					&& $payment->payment_method()->type_obj() instanceof EE_PMT_Base
420
-				){
421
-					$payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment );
420
+				) {
421
+					$payment->payment_method()->type_obj()->update_txn_based_on_payment($payment);
422 422
 					// update TXN registrations with payment info
423
-					$this->process_registration_payments( $transaction, $payment );
423
+					$this->process_registration_payments($transaction, $payment);
424 424
 				}
425 425
 				$do_action = $payment->just_approved()
426 426
 					? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful'
427 427
 					: $do_action;
428 428
 			} else {
429 429
 				// send out notifications
430
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
430
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
431 431
 				$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made';
432 432
 			}
433 433
 			// if this is an IPN, then we want to know the initial TXN status prior to updating the TXN
434 434
 			// so that we know whether the status has changed and notifications should be triggered
435
-			if ( $IPN ) {
435
+			if ($IPN) {
436 436
 				/** @type EE_Transaction_Processor $transaction_processor */
437
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
438
-				$transaction_processor->set_old_txn_status( $transaction->status_ID() );
437
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
438
+				$transaction_processor->set_old_txn_status($transaction->status_ID());
439 439
 			}
440
-			if ( $payment->status() !== EEM_Payment::status_id_failed ) {
440
+			if ($payment->status() !== EEM_Payment::status_id_failed) {
441 441
 				/** @type EE_Transaction_Payments $transaction_payments */
442
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
442
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
443 443
 				// set new value for total paid
444
-				$transaction_payments->calculate_total_payments_and_update_status( $transaction );
444
+				$transaction_payments->calculate_total_payments_and_update_status($transaction);
445 445
 				// call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ???
446
-				if ( $update_txn ) {
447
-					$this->_post_payment_processing( $transaction, $payment, $IPN );
446
+				if ($update_txn) {
447
+					$this->_post_payment_processing($transaction, $payment, $IPN);
448 448
 				}
449 449
 			}
450 450
 			// granular hook for others to use.
451
-			do_action( $do_action, $transaction, $payment );
452
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' );
451
+			do_action($do_action, $transaction, $payment);
452
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action');
453 453
 			//global hook for others to use.
454
-			do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment );
454
+			do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment);
455 455
 		}
456 456
 	}
457 457
 
@@ -471,25 +471,25 @@  discard block
 block discarded – undo
471 471
 		$registrations = array()
472 472
 	) {
473 473
 		// only process if payment was successful
474
-		if ( $payment->status() !== EEM_Payment::status_id_approved ) {
474
+		if ($payment->status() !== EEM_Payment::status_id_approved) {
475 475
 			return;
476 476
 		}
477 477
 		//EEM_Registration::instance()->show_next_x_db_queries();
478
-		if ( empty( $registrations )) {
478
+		if (empty($registrations)) {
479 479
 			// find registrations with monies owing that can receive a payment
480 480
 			$registrations = $transaction->registrations(
481 481
 				array(
482 482
 					array(
483 483
 						// only these reg statuses can receive payments
484
-						'STS_ID'           => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ),
485
-						'REG_final_price'  => array( '!=', 0 ),
486
-						'REG_final_price*' => array( '!=', 'REG_paid', true ),
484
+						'STS_ID'           => array('IN', EEM_Registration::reg_statuses_that_allow_payment()),
485
+						'REG_final_price'  => array('!=', 0),
486
+						'REG_final_price*' => array('!=', 'REG_paid', true),
487 487
 					)
488 488
 				)
489 489
 			);
490 490
 		}
491 491
 		// still nothing ??!??
492
-		if ( empty( $registrations )) {
492
+		if (empty($registrations)) {
493 493
 			return;
494 494
 		}
495 495
 		// todo: break out the following logic into a separate strategy class
@@ -501,28 +501,28 @@  discard block
 block discarded – undo
501 501
 
502 502
 		$refund = $payment->is_a_refund();
503 503
 		// how much is available to apply to registrations?
504
-		$available_payment_amount = abs( $payment->amount() );
505
-		foreach ( $registrations as $registration ) {
506
-			if ( $registration instanceof EE_Registration ) {
504
+		$available_payment_amount = abs($payment->amount());
505
+		foreach ($registrations as $registration) {
506
+			if ($registration instanceof EE_Registration) {
507 507
 				// nothing left?
508
-				if ( $available_payment_amount <= 0 ) {
508
+				if ($available_payment_amount <= 0) {
509 509
 					break;
510 510
 				}
511
-				if ( $refund ) {
512
-					$available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount );
511
+				if ($refund) {
512
+					$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
513 513
 				} else {
514
-					$available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount );
514
+					$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
515 515
 				}
516 516
 			}
517 517
 		}
518
-		if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) {
518
+		if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) {
519 519
 			EE_Error::add_attention(
520 520
 				sprintf(
521
-					__( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ),
522
-					EEH_Template::format_currency( $available_payment_amount ),
523
-					implode( ', ',  array_keys( $registrations ) ),
521
+					__('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'),
522
+					EEH_Template::format_currency($available_payment_amount),
523
+					implode(', ', array_keys($registrations)),
524 524
 					'<br/>',
525
-					EEH_Template::format_currency( $payment->amount() )
525
+					EEH_Template::format_currency($payment->amount())
526 526
 				),
527 527
 				__FILE__, __FUNCTION__, __LINE__
528 528
 			);
@@ -540,17 +540,17 @@  discard block
 block discarded – undo
540 540
 	 * @return float
541 541
 	 * @throws \EE_Error
542 542
 	 */
543
-	public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) {
543
+	public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) {
544 544
 		$owing = $registration->final_price() - $registration->paid();
545
-		if ( $owing > 0 ) {
545
+		if ($owing > 0) {
546 546
 			// don't allow payment amount to exceed the available payment amount, OR the amount owing
547
-			$payment_amount = min( $available_payment_amount, $owing );
547
+			$payment_amount = min($available_payment_amount, $owing);
548 548
 			// update $available_payment_amount
549 549
 			$available_payment_amount -= $payment_amount;
550 550
 			//calculate and set new REG_paid
551
-			$registration->set_paid( $registration->paid() + $payment_amount );
551
+			$registration->set_paid($registration->paid() + $payment_amount);
552 552
 			// now save it
553
-			$this->_apply_registration_payment( $registration, $payment, $payment_amount );
553
+			$this->_apply_registration_payment($registration, $payment, $payment_amount);
554 554
 		}
555 555
 		return $available_payment_amount;
556 556
 	}
@@ -566,19 +566,19 @@  discard block
 block discarded – undo
566 566
 	 * @return float
567 567
 	 * @throws \EE_Error
568 568
 	 */
569
-	protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) {
569
+	protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) {
570 570
 		// find any existing reg payment records for this registration and payment
571 571
 		$existing_reg_payment = EEM_Registration_Payment::instance()->get_one(
572
-			array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) )
572
+			array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID()))
573 573
 		);
574 574
 		// if existing registration payment exists
575
-		if ( $existing_reg_payment instanceof EE_Registration_Payment ) {
575
+		if ($existing_reg_payment instanceof EE_Registration_Payment) {
576 576
 			// then update that record
577
-			$existing_reg_payment->set_amount( $payment_amount );
577
+			$existing_reg_payment->set_amount($payment_amount);
578 578
 			$existing_reg_payment->save();
579 579
 		} else {
580 580
 			// or add new relation between registration and payment and set amount
581
-			$registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) );
581
+			$registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount));
582 582
 			// make it stick
583 583
 			$registration->save();
584 584
 		}
@@ -595,21 +595,21 @@  discard block
 block discarded – undo
595 595
 	 * @return float
596 596
 	 * @throws \EE_Error
597 597
 	 */
598
-	public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) {
598
+	public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) {
599 599
 		//EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ );
600
-		if ( $registration->paid() > 0 ) {
600
+		if ($registration->paid() > 0) {
601 601
 			// ensure $available_refund_amount is NOT negative
602
-			$available_refund_amount = (float)abs( $available_refund_amount );
602
+			$available_refund_amount = (float) abs($available_refund_amount);
603 603
 			// don't allow refund amount to exceed the available payment amount, OR the amount paid
604
-			$refund_amount = min( $available_refund_amount, (float)$registration->paid() );
604
+			$refund_amount = min($available_refund_amount, (float) $registration->paid());
605 605
 			// update $available_payment_amount
606 606
 			$available_refund_amount -= $refund_amount;
607 607
 			//calculate and set new REG_paid
608
-			$registration->set_paid( $registration->paid() - $refund_amount );
608
+			$registration->set_paid($registration->paid() - $refund_amount);
609 609
 			// convert payment amount back to a negative value for storage in the db
610
-			$refund_amount = (float)abs( $refund_amount ) * -1;
610
+			$refund_amount = (float) abs($refund_amount) * -1;
611 611
 			// now save it
612
-			$this->_apply_registration_payment( $registration, $payment, $refund_amount );
612
+			$this->_apply_registration_payment($registration, $payment, $refund_amount);
613 613
 		}
614 614
 		return $available_refund_amount;
615 615
 	}
@@ -628,21 +628,21 @@  discard block
 block discarded – undo
628 628
 	 * @param bool           $IPN
629 629
 	 * @throws \EE_Error
630 630
 	 */
631
-	protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) {
631
+	protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) {
632 632
 
633 633
 		/** @type EE_Transaction_Processor $transaction_processor */
634
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
634
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
635 635
 		// is the Payment Options Reg Step completed ?
636
-		$payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' );
636
+		$payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options');
637 637
 		// if the Payment Options Reg Step is completed...
638 638
 		$revisit = $payment_options_step_completed === true ? true : false;
639 639
 		// then this is kinda sorta a revisit with regards to payments at least
640
-		$transaction_processor->set_revisit( $revisit );
640
+		$transaction_processor->set_revisit($revisit);
641 641
 		// if this is an IPN, let's consider the Payment Options Reg Step completed if not already
642 642
 		if (
643 643
 			$IPN &&
644 644
 			$payment_options_step_completed !== true &&
645
-			( $payment->is_approved() || $payment->is_pending() )
645
+			($payment->is_approved() || $payment->is_pending())
646 646
 		) {
647 647
 			$payment_options_step_completed = $transaction_processor->set_reg_step_completed(
648 648
 				$transaction,
@@ -650,34 +650,34 @@  discard block
 block discarded – undo
650 650
 			);
651 651
 		}
652 652
 		/** @type EE_Transaction_Payments $transaction_payments */
653
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
653
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
654 654
 		// maybe update status, but don't save transaction just yet
655
-		$transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false );
655
+		$transaction_payments->update_transaction_status_based_on_total_paid($transaction, false);
656 656
 		// check if 'finalize_registration' step has been completed...
657
-		$finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' );
657
+		$finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration');
658 658
 		//  if this is an IPN and the final step has not been initiated
659
-		if ( $IPN && $payment_options_step_completed && $finalized === false ) {
659
+		if ($IPN && $payment_options_step_completed && $finalized === false) {
660 660
 			// and if it hasn't already been set as being started...
661
-			$finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' );
661
+			$finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration');
662 662
 		}
663 663
 		$transaction->save();
664 664
 		// because the above will return false if the final step was not fully completed, we need to check again...
665
-		if ( $IPN && $finalized !== false ) {
665
+		if ($IPN && $finalized !== false) {
666 666
 			// and if we are all good to go, then send out notifications
667
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
667
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
668 668
 			//ok, now process the transaction according to the payment
669
-			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment );
669
+			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment);
670 670
 		}
671 671
 		// DEBUG LOG
672 672
 		$payment_method = $payment->payment_method();
673
-		if ( $payment_method instanceof EE_Payment_Method ) {
673
+		if ($payment_method instanceof EE_Payment_Method) {
674 674
 			$payment_method_type_obj = $payment_method->type_obj();
675
-			if ( $payment_method_type_obj instanceof EE_PMT_Base ) {
675
+			if ($payment_method_type_obj instanceof EE_PMT_Base) {
676 676
 				$gateway = $payment_method_type_obj->get_gateway();
677
-				if ( $gateway instanceof EE_Gateway ){
677
+				if ($gateway instanceof EE_Gateway) {
678 678
 					$gateway->log(
679 679
 						array(
680
-							'message'               => __( 'Post Payment Transaction Details', 'event_espresso' ),
680
+							'message'               => __('Post Payment Transaction Details', 'event_espresso'),
681 681
 							'transaction'           => $transaction->model_field_array(),
682 682
 							'finalized'             => $finalized,
683 683
 							'IPN'                   => $IPN,
Please login to merge, or discard this patch.
Indentation   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
  */
14 14
 class EE_Payment_Processor extends EE_Processor_Base {
15 15
 	/**
16
-     * 	@var EE_Payment_Processor $_instance
16
+	 * 	@var EE_Payment_Processor $_instance
17 17
 	 * 	@access 	private
18
-     */
18
+	 */
19 19
 	private static $_instance;
20 20
 
21 21
 
@@ -50,7 +50,6 @@  discard block
 block discarded – undo
50 50
 	/**
51 51
 	 * Using the selected gateway, processes the payment for that transaction, and updates the transaction appropriately.
52 52
 	 * Saves the payment that is generated
53
-
54 53
 	 *
55 54
 *@param EE_Payment_Method    $payment_method
56 55
 	 * @param EE_Transaction       $transaction
@@ -130,7 +129,6 @@  discard block
 block discarded – undo
130 129
 
131 130
 
132 131
 	/**
133
-
134 132
 	 * @param EE_Transaction|int $transaction
135 133
 	 * @param EE_Payment_Method $payment_method
136 134
 	 * @throws EE_Error
Please login to merge, or discard this patch.