Completed
Branch BUG-9647-cpt-queries (303307)
by
unknown
102:32 queued 85:20
created
core/db_classes/EE_Attendee.class.php 2 patches
Spacing   +101 added lines, -101 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
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 * @return string
348 348
 	 */
349 349
 	public function state_abbrev() {
350
-		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' );
350
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso');
351 351
 	}
352 352
 
353 353
 
@@ -357,18 +357,18 @@  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{
371
-			return __( 'Unknown', 'event_espresso' );
370
+		} else {
371
+			return __('Unknown', 'event_espresso');
372 372
 		}
373 373
 	}
374 374
 
@@ -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,18 +405,18 @@  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{
419
-			return __( 'Unknown', 'event_espresso' );
418
+		} else {
419
+			return __('Unknown', 'event_espresso');
420 420
 		}
421 421
 	}
422 422
 
@@ -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.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
 	/**
514 514
 	 * returns any events attached to this attendee ($_Event property);
515
-	 * @return array
515
+	 * @return EE_Base_Class[]
516 516
 	 */
517 517
 	public function events() {
518 518
 		return $this->get_many_related( 'Event' );
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 	 * Gets the billing info array where keys match espresso_reg_page_billing_inputs(),
523 523
 	 * and keys are their cleaned values. @see EE_Attendee::save_and_clean_billing_info_for_payment_method() which was used to save the billing info
524 524
 	 * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class
525
-	 * @return EE_Form_Section_Proper
525
+	 * @return null|EE_Billing_Info_Form
526 526
 	 */
527 527
 	public function billing_info_for_payment_method($payment_method){
528 528
 		$pm_type = $payment_method->type_obj();
Please login to merge, or discard this patch.
core/db_classes/EE_Message.class.php 2 patches
Spacing   +109 added lines, -109 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
  * EE_Message class
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 	 * @param array $date_formats incoming date formats in an array.  First value is the date_format, second is time format.
49 49
 	 * @return EE_Message
50 50
 	 */
51
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
52
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
51
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
52
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
53 53
 		//if object doesn't exist, let's generate a unique token on instantiation so that its available even before saving to db.
54
-		if ( ! $has_object ) {
55
-			EE_Registry::instance()->load_helper( 'URL' );
54
+		if ( ! $has_object) {
55
+			EE_Registry::instance()->load_helper('URL');
56 56
 			$props_n_values['MSG_token'] = EEH_URL::generate_unique_token();
57 57
 		}
58
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
58
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
59 59
 	}
60 60
 
61 61
 
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	 * @param string $timezone
67 67
 	 * @return EE_Message
68 68
 	 */
69
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
70
-		return new self( $props_n_values, true, $timezone );
69
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
70
+		return new self($props_n_values, true, $timezone);
71 71
 	}
72 72
 
73 73
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @return int
79 79
 	 */
80 80
 	public function MSG_token() {
81
-		return $this->get( 'MSG_token' );
81
+		return $this->get('MSG_token');
82 82
 	}
83 83
 
84 84
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @param int $MSG_token
90 90
 	 */
91
-	public function set_MSG_token( $MSG_token) {
92
-		$this->set( 'MSG_token', $MSG_token );
91
+	public function set_MSG_token($MSG_token) {
92
+		$this->set('MSG_token', $MSG_token);
93 93
 	}
94 94
 
95 95
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @return int
102 102
 	 */
103 103
 	public function GRP_ID() {
104
-		return $this->get( 'GRP_ID' );
104
+		return $this->get('GRP_ID');
105 105
 	}
106 106
 
107 107
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @param int $GRP_ID
113 113
 	 */
114
-	public function set_GRP_ID( $GRP_ID ) {
115
-		$this->set( 'GRP_ID', $GRP_ID );
114
+	public function set_GRP_ID($GRP_ID) {
115
+		$this->set('GRP_ID', $GRP_ID);
116 116
 	}
117 117
 
118 118
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @return int
125 125
 	 */
126 126
 	public function TXN_ID() {
127
-		return $this->get( 'TXN_ID' );
127
+		return $this->get('TXN_ID');
128 128
 	}
129 129
 
130 130
 
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @param int $TXN_ID
136 136
 	 */
137
-	public function set_TXN_ID( $TXN_ID) {
138
-		$this->set( 'TXN_ID', $TXN_ID );
137
+	public function set_TXN_ID($TXN_ID) {
138
+		$this->set('TXN_ID', $TXN_ID);
139 139
 	}
140 140
 
141 141
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 * @return string
148 148
 	 */
149 149
 	public function messenger() {
150
-		return $this->get( 'MSG_messenger' );
150
+		return $this->get('MSG_messenger');
151 151
 	}
152 152
 
153 153
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @param string $messenger
159 159
 	 */
160
-	public function set_messenger( $messenger ) {
161
-		$this->set( 'MSG_messenger', $messenger );
160
+	public function set_messenger($messenger) {
161
+		$this->set('MSG_messenger', $messenger);
162 162
 	}
163 163
 
164 164
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @param EE_messenger $messenger
181 181
 	 */
182
-	public function set_messenger_object( EE_messenger $messenger ) {
182
+	public function set_messenger_object(EE_messenger $messenger) {
183 183
 		$this->_messenger = $messenger;
184 184
 	}
185 185
 
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 	 * @return bool
193 193
 	 * @throws \EE_Error
194 194
 	 */
195
-	public function valid_messenger( $throw_exceptions = false ) {
196
-		if ( $this->_messenger instanceof EE_messenger ) {
195
+	public function valid_messenger($throw_exceptions = false) {
196
+		if ($this->_messenger instanceof EE_messenger) {
197 197
 			return true;
198 198
 		}
199
-		if ( $throw_exceptions ) {
199
+		if ($throw_exceptions) {
200 200
 			throw new EE_Error(
201 201
 				sprintf(
202 202
 					__(
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 	 * @param   bool    $plural whether to return the plural label or not.
221 221
 	 * @return string
222 222
 	 */
223
-	public function messenger_label( $plural = false ) {
223
+	public function messenger_label($plural = false) {
224 224
 		$label_type = $plural ? 'plural' : 'singular';
225 225
 		$messenger = $this->messenger_object();
226
-		return $messenger instanceof EE_messenger ? $messenger->label[ $label_type ] : $this->messenger();
226
+		return $messenger instanceof EE_messenger ? $messenger->label[$label_type] : $this->messenger();
227 227
 	}
228 228
 
229 229
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 * @return string
235 235
 	 */
236 236
 	public function message_type() {
237
-		return $this->get( 'MSG_message_type' );
237
+		return $this->get('MSG_message_type');
238 238
 	}
239 239
 
240 240
 
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @param string $message_type
246 246
 	 */
247
-	public function set_message_type( $message_type ) {
248
-		$this->set( 'MSG_message_type', $message_type );
247
+	public function set_message_type($message_type) {
248
+		$this->set('MSG_message_type', $message_type);
249 249
 	}
250 250
 
251 251
 
@@ -268,10 +268,10 @@  discard block
 block discarded – undo
268 268
 	 * @param bool            $set_priority   This indicates whether to set the priority to whatever the priority is on
269 269
 	 *                                        the message type or not.
270 270
 	 */
271
-	public function set_message_type_object( EE_message_type $message_type, $set_priority = false ) {
271
+	public function set_message_type_object(EE_message_type $message_type, $set_priority = false) {
272 272
 		$this->_message_type = $message_type;
273
-		if ( $set_priority ) {
274
-			$this->set_priority( $this->_message_type->get_priority() );
273
+		if ($set_priority) {
274
+			$this->set_priority($this->_message_type->get_priority());
275 275
 		}
276 276
 	}
277 277
 
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
 	 * @return bool
285 285
 	 * @throws \EE_Error
286 286
 	 */
287
-	public function valid_message_type( $throw_exceptions = false ) {
288
-		if ( $this->_message_type instanceof EE_message_type ) {
287
+	public function valid_message_type($throw_exceptions = false) {
288
+		if ($this->_message_type instanceof EE_message_type) {
289 289
 			return true;
290 290
 		}
291
-		if ( $throw_exceptions ) {
291
+		if ($throw_exceptions) {
292 292
 			throw new EE_Error(
293 293
 				sprintf(
294 294
 					__(
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
 	 * @return bool
312 312
 	 * @throws \EE_Error
313 313
 	 */
314
-	public function is_valid( $throw_exceptions = false ) {
315
-		if ( $this->valid_messenger( $throw_exceptions ) && $this->valid_message_type( $throw_exceptions ) ) {
314
+	public function is_valid($throw_exceptions = false) {
315
+		if ($this->valid_messenger($throw_exceptions) && $this->valid_message_type($throw_exceptions)) {
316 316
 			return true;
317 317
 		}
318 318
 		return false;
@@ -333,16 +333,16 @@  discard block
 block discarded – undo
333 333
 	 * @param bool $throw_exceptions
334 334
 	 * @return bool
335 335
 	 */
336
-	public function is_valid_for_sending_or_generation( $throw_exceptions = false ) {
336
+	public function is_valid_for_sending_or_generation($throw_exceptions = false) {
337 337
 		$valid = false;
338
-		if ( $this->is_valid( $throw_exceptions ) ) {
338
+		if ($this->is_valid($throw_exceptions)) {
339 339
 			/** @var EE_Message_Resource_Manager $message_resource_manager */
340
-			$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
341
-			$valid = $message_resource_manager->is_message_type_active_for_messenger( $this->messenger(), $this->message_type() );
342
-			if ( ! $valid && $throw_exceptions ) {
340
+			$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
341
+			$valid = $message_resource_manager->is_message_type_active_for_messenger($this->messenger(), $this->message_type());
342
+			if ( ! $valid && $throw_exceptions) {
343 343
 				throw new EE_Error(
344 344
 					sprintf(
345
-						__( 'The %1$s message type is not a valid message type for the %2$s messenger so it will not be sent.', 'event_espresso' ),
345
+						__('The %1$s message type is not a valid message type for the %2$s messenger so it will not be sent.', 'event_espresso'),
346 346
 						$this->message_type(),
347 347
 						$this->messenger()
348 348
 					)
@@ -362,10 +362,10 @@  discard block
 block discarded – undo
362 362
 	 * @param   bool    $plural whether to return the plural label or not.
363 363
 	 * @return string
364 364
 	 */
365
-	public function message_type_label( $plural = false ) {
365
+	public function message_type_label($plural = false) {
366 366
 		$label_type = $plural ? 'plural' : 'singular';
367 367
 		$message_type = $this->message_type_object();
368
-		return $message_type instanceof EE_message_type ? $message_type->label[ $label_type ] : $this->message_type();
368
+		return $message_type instanceof EE_message_type ? $message_type->label[$label_type] : $this->message_type();
369 369
 	}
370 370
 
371 371
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 * @return string
377 377
 	 */
378 378
 	public function context() {
379
-		return $this->get( 'MSG_context' );
379
+		return $this->get('MSG_context');
380 380
 	}
381 381
 
382 382
 
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
 	 */
391 391
 	public function context_label() {
392 392
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
393
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
393
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
394 394
 		$contexts = $message_resource_manager->get_all_contexts();
395
-		return isset( $contexts[ $this->context() ] ) ? $contexts[ $this->context() ] : $this->context();
395
+		return isset($contexts[$this->context()]) ? $contexts[$this->context()] : $this->context();
396 396
 	}
397 397
 
398 398
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 	 *
403 403
 	 * @param string $context
404 404
 	 */
405
-	public function set_context( $context ) {
406
-		$this->set( 'MSG_context', $context );
405
+	public function set_context($context) {
406
+		$this->set('MSG_context', $context);
407 407
 	}
408 408
 
409 409
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	 * @return int
415 415
 	 */
416 416
 	public function recipient_ID() {
417
-		return $this->get( 'MSG_recipient_ID' );
417
+		return $this->get('MSG_recipient_ID');
418 418
 	}
419 419
 
420 420
 
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 	 *
425 425
 	 * @param string $recipient_ID
426 426
 	 */
427
-	public function set_recipient_ID( $recipient_ID ) {
428
-		$this->set( 'MSG_recipient_ID', $recipient_ID );
427
+	public function set_recipient_ID($recipient_ID) {
428
+		$this->set('MSG_recipient_ID', $recipient_ID);
429 429
 	}
430 430
 
431 431
 
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 	 * @return string
437 437
 	 */
438 438
 	public function recipient_type() {
439
-		return $this->get( 'MSG_recipient_type' );
439
+		return $this->get('MSG_recipient_type');
440 440
 	}
441 441
 
442 442
 
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
 	 * @return EE_Base_Class | null
449 449
 	 */
450 450
 	public function recipient_object() {
451
-		if ( ! $this->recipient_type() || ! $this->recipient_ID() ) {
451
+		if ( ! $this->recipient_type() || ! $this->recipient_ID()) {
452 452
 			return null;
453 453
 		}
454 454
 
455
-		return $this->get_first_related( $this->recipient_type() );
455
+		return $this->get_first_related($this->recipient_type());
456 456
 	}
457 457
 
458 458
 
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
 	 *
463 463
 	 * @param string $recipient_type
464 464
 	 */
465
-	public function set_recipient_type( $recipient_type ) {
466
-		$this->set( 'MSG_recipient_type', $recipient_type );
465
+	public function set_recipient_type($recipient_type) {
466
+		$this->set('MSG_recipient_type', $recipient_type);
467 467
 	}
468 468
 
469 469
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	 * @return string
475 475
 	 */
476 476
 	public function content() {
477
-		return $this->get( 'MSG_content' );
477
+		return $this->get('MSG_content');
478 478
 	}
479 479
 
480 480
 
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	 *
485 485
 	 * @param string $content
486 486
 	 */
487
-	public function set_content( $content ) {
488
-		$this->set( 'MSG_content', $content );
487
+	public function set_content($content) {
488
+		$this->set('MSG_content', $content);
489 489
 	}
490 490
 
491 491
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 * @return string
497 497
 	 */
498 498
 	public function subject() {
499
-		return $this->get( 'MSG_subject' );
499
+		return $this->get('MSG_subject');
500 500
 	}
501 501
 
502 502
 
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 	 *
507 507
 	 * @param string $subject
508 508
 	 */
509
-	public function set_subject( $subject ) {
510
-		$this->set( 'MSG_subject', $subject );
509
+	public function set_subject($subject) {
510
+		$this->set('MSG_subject', $subject);
511 511
 	}
512 512
 
513 513
 
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
 	 * @return string
519 519
 	 */
520 520
 	public function to() {
521
-		$to = $this->get( 'MSG_to' );
522
-		return empty( $to ) ? __( 'No recipient', 'event_espresso' ) : $to;
521
+		$to = $this->get('MSG_to');
522
+		return empty($to) ? __('No recipient', 'event_espresso') : $to;
523 523
 	}
524 524
 
525 525
 
@@ -529,8 +529,8 @@  discard block
 block discarded – undo
529 529
 	 *
530 530
 	 * @param string $to
531 531
 	 */
532
-	public function set_to( $to ) {
533
-		$this->set( 'MSG_to', $to );
532
+	public function set_to($to) {
533
+		$this->set('MSG_to', $to);
534 534
 	}
535 535
 
536 536
 
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 	 * @return string
542 542
 	 */
543 543
 	public function from() {
544
-		return $this->get( 'MSG_from' );
544
+		return $this->get('MSG_from');
545 545
 	}
546 546
 
547 547
 
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 	 *
552 552
 	 * @param string $from
553 553
 	 */
554
-	public function set_from( $from ) {
555
-		$this->set( 'MSG_from', $from );
554
+	public function set_from($from) {
555
+		$this->set('MSG_from', $from);
556 556
 	}
557 557
 
558 558
 
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 	 * @return int
566 566
 	 */
567 567
 	public function priority() {
568
-		return $this->get( 'MSG_priority' );
568
+		return $this->get('MSG_priority');
569 569
 	}
570 570
 
571 571
 
@@ -578,9 +578,9 @@  discard block
 block discarded – undo
578 578
 	 *
579 579
 	 * @param int $priority
580 580
 	 */
581
-	public function set_priority( $priority ) {
581
+	public function set_priority($priority) {
582 582
 		$priority = $this->send_now() ? EEM_Message::priority_high : $priority;
583
-		parent::set( 'MSG_priority', $priority );
583
+		parent::set('MSG_priority', $priority);
584 584
 	}
585 585
 
586 586
 
@@ -592,11 +592,11 @@  discard block
 block discarded – undo
592 592
 	 * @param bool   $use_default
593 593
 	 * @throws EE_Error
594 594
 	 */
595
-	public function set( $field_name, $field_value, $use_default = false ) {
596
-		if ( $field_name === 'MSG_priority' ) {
597
-			$this->set_priority( $field_value );
595
+	public function set($field_name, $field_value, $use_default = false) {
596
+		if ($field_name === 'MSG_priority') {
597
+			$this->set_priority($field_value);
598 598
 		}
599
-		parent::set( $field_name, $field_value, $use_default );
599
+		parent::set($field_name, $field_value, $use_default);
600 600
 	}
601 601
 
602 602
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 	 * @return string
619 619
 	 */
620 620
 	public function STS_ID() {
621
-		return $this->get( 'STS_ID' );
621
+		return $this->get('STS_ID');
622 622
 	}
623 623
 
624 624
 
@@ -628,8 +628,8 @@  discard block
 block discarded – undo
628 628
 	 *
629 629
 	 * @param string $STS_ID
630 630
 	 */
631
-	public function set_STS_ID( $STS_ID ) {
632
-		$this->set( 'STS_ID', $STS_ID );
631
+	public function set_STS_ID($STS_ID) {
632
+		$this->set('STS_ID', $STS_ID);
633 633
 	}
634 634
 
635 635
 
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 	 * @return string
641 641
 	 */
642 642
 	public function created() {
643
-		return $this->get( 'MSG_created' );
643
+		return $this->get('MSG_created');
644 644
 	}
645 645
 
646 646
 
@@ -650,8 +650,8 @@  discard block
 block discarded – undo
650 650
 	 *
651 651
 	 * @param string $created
652 652
 	 */
653
-	public function set_created( $created ) {
654
-		$this->set( 'MSG_created', $created );
653
+	public function set_created($created) {
654
+		$this->set('MSG_created', $created);
655 655
 	}
656 656
 
657 657
 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	 * @return string
663 663
 	 */
664 664
 	public function modified() {
665
-		return $this->get( 'MSG_modified' );
665
+		return $this->get('MSG_modified');
666 666
 	}
667 667
 
668 668
 
@@ -672,8 +672,8 @@  discard block
 block discarded – undo
672 672
 	 *
673 673
 	 * @param string $modified
674 674
 	 */
675
-	public function set_modified( $modified ) {
676
-		$this->set( 'MSG_modified', $modified );
675
+	public function set_modified($modified) {
676
+		$this->set('MSG_modified', $modified);
677 677
 	}
678 678
 
679 679
 
@@ -683,8 +683,8 @@  discard block
 block discarded – undo
683 683
 	 * Sets generation data for this message.
684 684
 	 * @param mixed $data
685 685
 	 */
686
-	public function set_generation_data( $data ) {
687
-		$this->set_field_or_extra_meta( 'MSG_generation_data', $data );
686
+	public function set_generation_data($data) {
687
+		$this->set_field_or_extra_meta('MSG_generation_data', $data);
688 688
 	}
689 689
 
690 690
 
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 	 * @return mixed|null
697 697
 	 */
698 698
 	public function get_generation_data() {
699
-		return $this->get_field_or_extra_meta( 'MSG_generation_data' );
699
+		return $this->get_field_or_extra_meta('MSG_generation_data');
700 700
 	}
701 701
 
702 702
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	 * @return mixed|null
708 708
 	 */
709 709
 	public function error_message() {
710
-		return $this->get_field_or_extra_meta( 'MSG_error' );
710
+		return $this->get_field_or_extra_meta('MSG_error');
711 711
 	}
712 712
 
713 713
 
@@ -716,8 +716,8 @@  discard block
 block discarded – undo
716 716
 	 * @param $message
717 717
 	 * @return bool|int
718 718
 	 */
719
-	public function set_error_message( $message ) {
720
-		return $this->set_field_or_extra_meta( 'MSG_error', $message );
719
+	public function set_error_message($message) {
720
+		return $this->set_field_or_extra_meta('MSG_error', $message);
721 721
 	}
722 722
 
723 723
 
@@ -731,13 +731,13 @@  discard block
 block discarded – undo
731 731
 		/**
732 732
 		 * This is deprecated functionality that will be removed eventually but included here now for backward compat.
733 733
 		 */
734
-		if ( ! empty( $this->template_pack ) ) {
734
+		if ( ! empty($this->template_pack)) {
735 735
 			return $this->template_pack;
736 736
 		}
737 737
 		/** @type EE_Message_Template_Group $grp */
738
-		$grp = $this->get_first_related( 'Message_Template_Group' );
738
+		$grp = $this->get_first_related('Message_Template_Group');
739 739
 		//if no group then let's try to get the first related group by internal messenger and message type (will use global grp).
740
-		if ( ! $grp instanceof EE_Message_Template_Group ) {
740
+		if ( ! $grp instanceof EE_Message_Template_Group) {
741 741
 			$grp = EEM_Message_Template_Group::instance()->get_one(
742 742
 				array(
743 743
 					array(
@@ -763,15 +763,15 @@  discard block
 block discarded – undo
763 763
 		/**
764 764
 		 * This is deprecated functionality that will be removed eventually but included here now for backward compat.
765 765
 		 */
766
-		if ( ! empty( $this->template_variation ) ) {
766
+		if ( ! empty($this->template_variation)) {
767 767
 			return $this->template_variation;
768 768
 		}
769 769
 
770 770
 		/** @type EE_Message_Template_Group $grp */
771
-		$grp = $this->get_first_related( 'Message_Template_Group' );
771
+		$grp = $this->get_first_related('Message_Template_Group');
772 772
 
773 773
 		//if no group then let's try to get the first related group by internal messenger and message type (will use global grp).
774
-		if ( ! $grp instanceof EE_Message_Template_Group ) {
774
+		if ( ! $grp instanceof EE_Message_Template_Group) {
775 775
 			$grp = EEM_Message_Template_Group::instance()->get_one(
776 776
 				array(
777 777
 					array(
@@ -791,15 +791,15 @@  discard block
 block discarded – undo
791 791
 	 * @return string
792 792
 	 */
793 793
 	public function get_admin_details_link() {
794
-		EE_Registry::instance()->load_helper( 'URL' );
795
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
796
-		switch ( $this->STS_ID() ) {
794
+		EE_Registry::instance()->load_helper('URL');
795
+		EE_Registry::instance()->load_helper('MSG_Template');
796
+		switch ($this->STS_ID()) {
797 797
 			case EEM_Message::status_failed :
798
-				return EEH_MSG_Template::generate_error_display_trigger( $this );
798
+				return EEH_MSG_Template::generate_error_display_trigger($this);
799 799
 				break;
800 800
 
801 801
 			case EEM_Message::status_sent :
802
-				return EEH_MSG_Template::generate_browser_trigger( $this );
802
+				return EEH_MSG_Template::generate_browser_trigger($this);
803 803
 				break;
804 804
 
805 805
 			default :
@@ -820,13 +820,13 @@  discard block
 block discarded – undo
820 820
 	 * @return string
821 821
 	 */
822 822
 	public function get_admin_settings_link() {
823
-		EE_Registry::instance()->load_helper( 'URL' );
823
+		EE_Registry::instance()->load_helper('URL');
824 824
 		return EEH_URL::add_query_args_and_nonce(
825 825
 			array(
826 826
 				'page' => 'espresso_messages',
827 827
 				'action' => 'settings',
828 828
 			),
829
-			admin_url( 'admin.php' )
829
+			admin_url('admin.php')
830 830
 		);
831 831
 	}
832 832
 
@@ -835,13 +835,13 @@  discard block
 block discarded – undo
835 835
 	 * @return string
836 836
 	 */
837 837
 	public function get_admin_overview_link() {
838
-		EE_Registry::instance()->load_helper( 'URL' );
838
+		EE_Registry::instance()->load_helper('URL');
839 839
 		return EEH_URL::add_query_args_and_nonce(
840 840
 			array(
841 841
 				'page' => 'espresso_messages',
842 842
 				'action' => 'default',
843 843
 			),
844
-			admin_url( 'admin.php' )
844
+			admin_url('admin.php')
845 845
 		);
846 846
 	}
847 847
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -704,7 +704,7 @@
 block discarded – undo
704 704
 
705 705
 	/**
706 706
 	 * Gets any error message.
707
-	 * @return mixed|null
707
+	 * @return string
708 708
 	 */
709 709
 	public function error_message() {
710 710
 		return $this->get_field_or_extra_meta( 'MSG_error' );
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Default_Where_Conditions.strategy.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  *
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @since		 	    4.6.0
16 16
  *
17 17
  */
18
-class EE_Default_Where_Conditions{
18
+class EE_Default_Where_Conditions {
19 19
 
20 20
 	/**
21 21
 	 * This const can be used in EE_Default_Where_Conditions values, and at the time of querying it will be
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * onto any field names
49 49
 	 * @param array $custom_where_conditions
50 50
 	 */
51
-	public function __construct( $custom_where_conditions = array() ) {
51
+	public function __construct($custom_where_conditions = array()) {
52 52
 		$this->_where_conditions_provided = $custom_where_conditions;
53 53
 	}
54 54
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 * for querying of the model.
60 60
 	 * @param EEM_Base $model
61 61
 	 */
62
-	function _finalize_construct(EEM_Base $model){
62
+	function _finalize_construct(EEM_Base $model) {
63 63
 		$this->_model = $model;
64 64
 	}
65 65
 
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 * @param string $model_relation_chain
81 81
 	 * @return array like what's expected in EEM_Base::get_all()'s $query_params[0]
82 82
 	 */
83
-	function get_default_where_conditions( $model_relation_chain = '' ){
84
-		return $this->prepare_where_conditions_for_querying( array_merge( $this->_get_default_where_conditions(), $this->get_where_conditions_provided() ), $model_relation_chain );
83
+	function get_default_where_conditions($model_relation_chain = '') {
84
+		return $this->prepare_where_conditions_for_querying(array_merge($this->_get_default_where_conditions(), $this->get_where_conditions_provided()), $model_relation_chain);
85 85
 	}
86 86
 
87 87
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * Adding model relation chains is handled by the public method get_default_where_conditions
92 92
 	 * @return array
93 93
 	 */
94
-	protected function _get_default_where_conditions(){
94
+	protected function _get_default_where_conditions() {
95 95
 		return array();
96 96
 	}
97 97
 
@@ -105,36 +105,36 @@  discard block
 block discarded – undo
105 105
 	 * @return array
106 106
 	 * @throws \EE_Error
107 107
 	 */
108
-	public function prepare_where_conditions_for_querying( $where_conditions, $model_relation_chain ) {
108
+	public function prepare_where_conditions_for_querying($where_conditions, $model_relation_chain) {
109 109
 		$where_conditions_with_model_relation_chain_prefixes = array();
110
-		if ( ! is_array( $where_conditions ) ) {
110
+		if ( ! is_array($where_conditions)) {
111 111
 			$where_conditions = array();
112 112
 		}
113
-		foreach ( $where_conditions as $key => $value ) {
113
+		foreach ($where_conditions as $key => $value) {
114 114
 			if (
115
-				in_array( $key, array( 'OR', 'AND', 'NOT' ) )
116
-				|| strpos( $key, 'OR*' ) !== false
117
-				|| strpos( $key, 'AND*' ) !== false
118
-				|| strpos( $key, 'NOT*' ) !== false
115
+				in_array($key, array('OR', 'AND', 'NOT'))
116
+				|| strpos($key, 'OR*') !== false
117
+				|| strpos($key, 'AND*') !== false
118
+				|| strpos($key, 'NOT*') !== false
119 119
 			) {
120
-				$where_conditions_with_model_relation_chain_prefixes[ $key ] = $this->prepare_where_conditions_for_querying(
120
+				$where_conditions_with_model_relation_chain_prefixes[$key] = $this->prepare_where_conditions_for_querying(
121 121
 					$value,
122 122
 					$model_relation_chain
123 123
 				);
124 124
 			} else {
125 125
 				if (
126 126
 					$model_relation_chain != ''
127
-					&& $model_relation_chain[ strlen( $model_relation_chain ) - 1 ] != '.'
127
+					&& $model_relation_chain[strlen($model_relation_chain) - 1] != '.'
128 128
 				) {
129
-					$model_relation_chain = $model_relation_chain . ".";
129
+					$model_relation_chain = $model_relation_chain.".";
130 130
 				}
131 131
 				//check for the current user id place holder, and if present change it
132
-				if ( $value === self::current_user_placeholder ) {
132
+				if ($value === self::current_user_placeholder) {
133 133
 					$value = get_current_user_id();
134 134
 				}
135 135
 				//check for user field placeholder
136
-				if ( $key == self::user_field_name_placeholder ) {
137
-					if ( ! $this->_model->wp_user_field_name() ) {
136
+				if ($key == self::user_field_name_placeholder) {
137
+					if ( ! $this->_model->wp_user_field_name()) {
138 138
 						throw new EE_Error(
139 139
 							sprintf(
140 140
 								__(
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 					}
148 148
 					$key = $this->_model->wp_user_field_name();
149 149
 				}
150
-				$where_conditions_with_model_relation_chain_prefixes[ $model_relation_chain . $key ] = $value;
150
+				$where_conditions_with_model_relation_chain_prefixes[$model_relation_chain.$key] = $value;
151 151
 			}
152 152
 		}
153 153
 		return $where_conditions_with_model_relation_chain_prefixes;
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 /**
6 6
  *
7 7
  * Class EE_Default_Where_Conditions
8
-  *
8
+ *
9 9
  * Strategy to be used for getting default where conditions for EEM_Base children.
10 10
  * Should be initialized and set on construction of model
11 11
  *
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Generated_From_Token.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	 *                                                This is then used to populate the properties in here.
37 37
 	 * @param   EE_Message_Resource_Manager $message_resource_manager
38 38
 	 */
39
-	public function __construct( $token, $sending_messenger_slug = 'html', EE_Message_Resource_Manager $message_resource_manager ) {
39
+	public function __construct($token, $sending_messenger_slug = 'html', EE_Message_Resource_Manager $message_resource_manager) {
40 40
 		$this->token = $token;
41
-		$this->_sending_messenger = $this->_set_sending_messenger( $sending_messenger_slug, $message_resource_manager );
41
+		$this->_sending_messenger = $this->_set_sending_messenger($sending_messenger_slug, $message_resource_manager);
42 42
 		$this->_message = $this->_generate_message();
43 43
 		//set params for parent from the message object
44 44
 		parent::__construct(
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		$sending_messenger_slug,
62 62
 		EE_Message_Resource_Manager $message_resource_manager
63 63
 	) {
64
-		$sending_messenger = $message_resource_manager->get_active_messenger( $sending_messenger_slug );
64
+		$sending_messenger = $message_resource_manager->get_active_messenger($sending_messenger_slug);
65 65
 		return $sending_messenger instanceof EE_messenger ? $sending_messenger : $sending_messenger_slug;
66 66
 	}
67 67
 
@@ -83,27 +83,27 @@  discard block
 block discarded – undo
83 83
 	 * @return EE_Message
84 84
 	 * @throws \EE_Error
85 85
 	 */
86
-	protected function _generate_message( $properties = array() ) {
86
+	protected function _generate_message($properties = array()) {
87 87
 		// a message was generated immediately but the parent class will call this again
88
-		if ( $this->_message instanceof EE_Message ) {
88
+		if ($this->_message instanceof EE_Message) {
89 89
 			return $this->_message;
90 90
 		}
91
-		$message = EEM_Message::instance()->get_one_by_token( $this->token );
92
-		if ( ! $message instanceof EE_Message ) {
91
+		$message = EEM_Message::instance()->get_one_by_token($this->token);
92
+		if ( ! $message instanceof EE_Message) {
93 93
 			throw new EE_Error(
94 94
 				sprintf(
95
-					__( 'Unable to retrieve generated message from DB using given token: "%1$s"', 'event_espresso' ),
95
+					__('Unable to retrieve generated message from DB using given token: "%1$s"', 'event_espresso'),
96 96
 					$this->token
97 97
 				)
98 98
 			);
99 99
 		}
100
-		$message->set_STS_ID( EEM_Message::status_idle );
100
+		$message->set_STS_ID(EEM_Message::status_idle);
101 101
 
102
-		if ( ! $this->_sending_messenger instanceof EE_messenger ) {
103
-			$message->set_STS_ID( EEM_Message::status_failed );
102
+		if ( ! $this->_sending_messenger instanceof EE_messenger) {
103
+			$message->set_STS_ID(EEM_Message::status_failed);
104 104
 			$message->set_error_message(
105 105
 				sprintf(
106
-					__( 'Unable to send message because the "%1$s" messenger is not active or not installed', 'event_espresso' ),
106
+					__('Unable to send message because the "%1$s" messenger is not active or not installed', 'event_espresso'),
107 107
 					$this->_sending_messenger
108 108
 				)
109 109
 			);
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Repository.lib.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('No direct script access allowed');
4 4
 
5 5
 
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @return bool
34 34
 	 */
35
-	public function add( $message, $info = null ) {
36
-		$attached = parent::add( $message );
35
+	public function add($message, $info = null) {
36
+		$attached = parent::add($message);
37 37
 		//ensure $info is an array if not already
38 38
 		$info = $info === null ? $info = array() : (array) $info;
39
-		$data = $this->_init_data( $info, $attached, $message );
40
-		if ( $attached ) {
41
-			$this->set_info( $message, $data );
39
+		$data = $this->_init_data($info, $attached, $message);
40
+		if ($attached) {
41
+			$this->set_info($message, $data);
42 42
 		}
43 43
 		return $attached;
44 44
 	}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @param EE_Message $message
52 52
 	 * @return array
53 53
 	 */
54
-	protected function _init_data( $info, $attached, $message ) {
54
+	protected function _init_data($info, $attached, $message) {
55 55
 		$data = array(
56 56
 			'test_send' => false,
57 57
 			'preview' => false,
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
 				'MSG_generation_data' => array()
61 61
 			)
62 62
 		);
63
-		if ( isset( $info['preview'] ) ) {
63
+		if (isset($info['preview'])) {
64 64
 			$data['preview'] = $info['preview'];
65
-			unset( $info['preview'] );
65
+			unset($info['preview']);
66 66
 		}
67
-		if ( isset( $info['test_send'] ) ) {
67
+		if (isset($info['test_send'])) {
68 68
 			$data['test_send'] = $info['test_send'];
69
-			unset( $info['test_send'] );
69
+			unset($info['test_send']);
70 70
 		}
71
-		if ( isset( $info['data_handler_class_name'] ) ) {
71
+		if (isset($info['data_handler_class_name'])) {
72 72
 			$data['data_handler_class_name'] = $info['data_handler_class_name'];
73
-			unset( $info['data_handler_class_name'] );
73
+			unset($info['data_handler_class_name']);
74 74
 		}
75
-		if ( $attached && $message->STS_ID() === EEM_Message::status_incomplete ) {
76
-			$generation_data = isset( $info['MSG_generation_data'] ) ? $info['MSG_generation_data'] : array();
75
+		if ($attached && $message->STS_ID() === EEM_Message::status_incomplete) {
76
+			$generation_data = isset($info['MSG_generation_data']) ? $info['MSG_generation_data'] : array();
77 77
 			//if data isn't in $info...let's see if its available via the message object
78 78
 			$generation_data = ! $generation_data ? $message->get_generation_data() : $generation_data;
79 79
 			//still empty then let's just use info
@@ -96,19 +96,19 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function saveAll() {
98 98
 		$this->rewind();
99
-		$save_tracking = array( 'updated' => 0, 'notupdated' => 0, 'errors' => array() );
99
+		$save_tracking = array('updated' => 0, 'notupdated' => 0, 'errors' => array());
100 100
 
101 101
 		//exit early if there is nothing to save.
102
-		if ( ! $this->count() > 0 ) {
102
+		if ( ! $this->count() > 0) {
103 103
 			return $save_tracking;
104 104
 		}
105 105
 
106
-		while( $this->valid() ) {
106
+		while ($this->valid()) {
107 107
 
108 108
 			$saved = $this->current()->save();
109
-			if ( $saved === false ) {
109
+			if ($saved === false) {
110 110
 				$save_tracking['errors'][] = $this->current()->MSG_token();
111
-			} elseif ( $saved ) {
111
+			} elseif ($saved) {
112 112
 				$save_tracking['updated']++;
113 113
 			} else {
114 114
 				$save_tracking['notupdated']++;
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 	 * @param string   $token   Token.
133 133
 	 * @return EE_Message | null
134 134
 	 */
135
-	public function getMessageByToken( $token ) {
135
+	public function getMessageByToken($token) {
136 136
 		$this->rewind();
137
-		while( $this->valid() ) {
138
-			if ( $this->current()->MSG_token() === $token ) {
137
+		while ($this->valid()) {
138
+			if ($this->current()->MSG_token() === $token) {
139 139
 				$message = $this->current();
140 140
 				$this->rewind();
141 141
 				return $message;
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	public function get_generation_data() {
158 158
 		//first verify we're at a valid iterator point.
159
-		if ( ! $this->valid() ) {
159
+		if ( ! $this->valid()) {
160 160
 			return array();
161 161
 		}
162 162
 		$info = $this->getInfo();
163
-		return isset( $info['data'] ) && isset( $info['data']['MSG_generation_data'] ) ? $info['data']['MSG_generation_data'] : array();
163
+		return isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array();
164 164
 	}
165 165
 
166 166
 
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	 * @return string
172 172
 	 */
173 173
 	public function get_data_handler() {
174
-		if ( ! $this->valid() ) {
174
+		if ( ! $this->valid()) {
175 175
 			return '';
176 176
 		}
177 177
 		$info = $this->getInfo();
178
-		return isset( $info['data_handler_class_name'] ) ? $info['data_handler_class_name'] : '';
178
+		return isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : '';
179 179
 	}
180 180
 
181 181
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * @return bool
186 186
 	 */
187 187
 	public function is_preview() {
188
-		if ( ! $this->valid() ) {
188
+		if ( ! $this->valid()) {
189 189
 			return false;
190 190
 		}
191 191
 		$info = $this->getInfo();
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @return bool
199 199
 	 */
200 200
 	public function is_test_send() {
201
-		if ( ! $this->valid() ) {
201
+		if ( ! $this->valid()) {
202 202
 			return false;
203 203
 		}
204 204
 		$info = $this->getInfo();
@@ -213,16 +213,16 @@  discard block
 block discarded – undo
213 213
 	 *  data is attached for later retrieval (batch generation).
214 214
 	 */
215 215
 	protected function _maybe_persist_attached_data() {
216
-		if ( ! $this->valid() ) {
216
+		if ( ! $this->valid()) {
217 217
 			return;
218 218
 		}
219 219
 
220 220
 		$info = $this->getInfo();
221
-		$data_handler_class_name = isset( $info['data_handler_class_name'] ) ? $info['data_handler_class_name'] : '';
222
-		$data = isset( $info['data'] ) && isset( $info['data']['MSG_generation_data'] ) ? $info['data']['MSG_generation_data'] : array();
223
-		if ( $data && $this->current()->STS_ID() === EEM_Message::status_incomplete ) {
224
-			$this->current()->set_generation_data( $data );
225
-			$this->current()->set_field_or_extra_meta( 'data_handler_class_name', $data_handler_class_name );
221
+		$data_handler_class_name = isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : '';
222
+		$data = isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array();
223
+		if ($data && $this->current()->STS_ID() === EEM_Message::status_incomplete) {
224
+			$this->current()->set_generation_data($data);
225
+			$this->current()->set_field_or_extra_meta('data_handler_class_name', $data_handler_class_name);
226 226
 		}
227 227
 	}
228 228
 
@@ -235,15 +235,15 @@  discard block
 block discarded – undo
235 235
 	 * @param array $status the optional status(es) that will also be filtered by when priority matches.
236 236
 	 * @return int  count of messages in the queue matching the conditions.
237 237
 	 */
238
-	public function count_by_priority_and_status( $priority, $status = array() ) {
239
-		if ( ! empty( $status ) ) {
240
-			$status = is_array( $status ) ? $status : array( $status );
238
+	public function count_by_priority_and_status($priority, $status = array()) {
239
+		if ( ! empty($status)) {
240
+			$status = is_array($status) ? $status : array($status);
241 241
 		}
242 242
 
243 243
 		$count = 0;
244 244
 		$this->rewind();
245
-		while ( $this->valid() ) {
246
-			if ( $this->current()->priority() === $priority && ( ( $status && in_array( $this->current()->STS_ID(), $status ) ) || ! $status ) ) {
245
+		while ($this->valid()) {
246
+			if ($this->current()->priority() === $priority && (($status && in_array($this->current()->STS_ID(), $status)) || ! $status)) {
247 247
 				$count++;
248 248
 			}
249 249
 			$this->next();
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Template_Group_Collection.lib.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 	 *                       indexing the template by key.
29 29
 	 * @return bool
30 30
 	 */
31
-	public function add( $message_template_group, $EVT_ID = null ) {
32
-		if ( $message_template_group instanceof $this->interface ) {
33
-			$data[ 'key' ] = $this->get_key(
31
+	public function add($message_template_group, $EVT_ID = null) {
32
+		if ($message_template_group instanceof $this->interface) {
33
+			$data['key'] = $this->get_key(
34 34
 				$message_template_group->messenger(),
35 35
 				$message_template_group->message_type(),
36 36
 				$EVT_ID
37 37
 			);
38
-			return parent::add( $message_template_group, $data );
38
+			return parent::add($message_template_group, $data);
39 39
 		}
40 40
 		return false;
41 41
 	}
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	 * @param $GRP_ID
49 49
 	 * @return EE_Message_Template_Group | null
50 50
 	 */
51
-	public function get_by_ID( $GRP_ID ) {
51
+	public function get_by_ID($GRP_ID) {
52 52
 		$this->rewind();
53
-		while ( $this->valid() ) {
54
-			if ( $this->current()->ID() === $GRP_ID ) {
53
+		while ($this->valid()) {
54
+			if ($this->current()->ID() === $GRP_ID) {
55 55
 				$grp = $this->current();
56 56
 				$this->rewind();
57 57
 				return $grp;
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string
75 75
 	 */
76
-	public function get_key( $messenger, $message_type, $EVT_ID = 0 ) {
77
-		return md5( $messenger.$message_type.$EVT_ID );
76
+	public function get_key($messenger, $message_type, $EVT_ID = 0) {
77
+		return md5($messenger.$message_type.$EVT_ID);
78 78
 	}
79 79
 
80 80
 
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return null|EE_Message_Template_Group
88 88
 	 */
89
-	public function get_by_key( $key ) {
89
+	public function get_by_key($key) {
90 90
 		$this->rewind();
91
-		while ( $this->valid() ) {
91
+		while ($this->valid()) {
92 92
 			$data = $this->getInfo();
93
-			if ( isset( $data['key'] ) && $data['key'] === $key ) {
93
+			if (isset($data['key']) && $data['key'] === $key) {
94 94
 				$handler = $this->current();
95 95
 				$this->rewind();
96 96
 				return $handler;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 
46 46
 	/**
47 47
 	 * This retrieves any EE_Message_Template_Group in the repo by its ID.
48
-	 * @param $GRP_ID
48
+	 * @param integer $GRP_ID
49 49
 	 * @return EE_Message_Template_Group | null
50 50
 	 */
51 51
 	public function get_by_ID( $GRP_ID ) {
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_To_Generate_From_Queue.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 	 * @param EE_Messages_Queue $queue
26 26
 	 * @param string            $custom_subject  Used if a custom subject is desired for the generated aggregate EE_Message object
27 27
 	 */
28
-	public function __construct( $messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '' ) {
28
+	public function __construct($messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '') {
29 29
 		$this->queue = $queue;
30
-		parent::__construct( $messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle );
31
-		if ( $this->valid() ) {
32
-			$this->_message->set_content( $this->_get_content() );
33
-			$this->_message->set_subject( $this->_get_subject( $custom_subject ) );
30
+		parent::__construct($messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle);
31
+		if ($this->valid()) {
32
+			$this->_message->set_content($this->_get_content());
33
+			$this->_message->set_subject($this->_get_subject($custom_subject));
34 34
 		}
35 35
 	}
36 36
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	protected function _get_content() {
45 45
 		$content = '';
46 46
 		$this->queue->get_queue()->rewind();
47
-		while ( $this->queue->get_queue()->valid() ) {
47
+		while ($this->queue->get_queue()->valid()) {
48 48
 			$content .= $this->queue->get_queue()->current()->content();
49 49
 			$this->queue->get_queue()->next();
50 50
 		}
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return string
60 60
 	 */
61
-	protected function _get_subject( $custom_subject = '' ) {
62
-		if ( ! empty( $custom_subject ) ) {
61
+	protected function _get_subject($custom_subject = '') {
62
+		if ( ! empty($custom_subject)) {
63 63
 			return $custom_subject;
64 64
 		}
65 65
 		$this->queue->get_queue()->rewind();
66 66
 		$count_of_items = $this->queue->get_queue()->count();
67 67
 
68 68
 		//if $count of items in queue == 1, then let's just return the subject for that item.
69
-		if ( $count_of_items === 1 ) {
69
+		if ($count_of_items === 1) {
70 70
 			return $this->queue->get_queue()->current()->subject();
71 71
 		}
72 72
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Type_Collection_Loader.lib.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 *
32 32
 	 * @param EE_Message_Type_Collection $message_types
33 33
 	 */
34
-	public function __construct( EE_Message_Type_Collection $message_types ) {
35
-		$this->set_message_type_collection( $message_types );
34
+	public function __construct(EE_Message_Type_Collection $message_types) {
35
+		$this->set_message_type_collection($message_types);
36 36
 	}
37 37
 
38 38
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	/**
50 50
 	 * @param mixed $message_types
51 51
 	 */
52
-	public function set_message_type_collection( EE_Message_Type_Collection $message_types ) {
52
+	public function set_message_type_collection(EE_Message_Type_Collection $message_types) {
53 53
 		$this->_message_type_collection = $message_types;
54 54
 	}
55 55
 
@@ -62,41 +62,41 @@  discard block
 block discarded – undo
62 62
 	 * @param  string $folder
63 63
 	 * @throws \EE_Error
64 64
 	 */
65
-	public function load_message_types_from_folder( $folder = '' ) {
65
+	public function load_message_types_from_folder($folder = '') {
66 66
 		//make sure autoloaders are set (fail-safe)
67 67
 		EED_Messages::set_autoloaders();
68
-		$folder = ! empty( $folder ) ? $folder : EE_LIBRARIES . 'messages' . DS . 'message_type';
69
-		$folder .= $folder[ strlen( $folder ) - 1 ] != DS ? DS : '';
68
+		$folder = ! empty($folder) ? $folder : EE_LIBRARIES.'messages'.DS.'message_type';
69
+		$folder .= $folder[strlen($folder) - 1] != DS ? DS : '';
70 70
 		// get all the files in that folder that end in ".class.php
71 71
 		$filepaths = apply_filters(
72 72
 			'FHEE__EE_messages__get_installed__messagetype_files',
73
-			glob( $folder . '*.class.php' )
73
+			glob($folder.'*.class.php')
74 74
 		);
75
-		if ( empty( $filepaths ) ) {
75
+		if (empty($filepaths)) {
76 76
 			return;
77 77
 		}
78
-		foreach ( (array) $filepaths as $file_path ) {
78
+		foreach ((array) $filepaths as $file_path) {
79 79
 			// extract filename from path
80
-			$file_path = basename( $file_path );
80
+			$file_path = basename($file_path);
81 81
 			// now remove any file extensions
82
-			$message_type_class_name = substr( $file_path, 0, strpos( $file_path, '.' ) );
82
+			$message_type_class_name = substr($file_path, 0, strpos($file_path, '.'));
83 83
 
84 84
 			//if this class name doesn't represent a message type class, then we just skip.
85
-			if ( strpos( strtolower( $message_type_class_name ), 'message_type' ) === false ) {
85
+			if (strpos(strtolower($message_type_class_name), 'message_type') === false) {
86 86
 				continue;
87 87
 			}
88 88
 
89
-			if ( ! class_exists( $message_type_class_name ) ) {
89
+			if ( ! class_exists($message_type_class_name)) {
90 90
 				throw new EE_Error(
91 91
 					sprintf(
92
-						__( 'The "%1$s" message type class can\'t be loaded from %2$s. Likely there is a typo in the class name or the file name.', 'event_espresso' ),
92
+						__('The "%1$s" message type class can\'t be loaded from %2$s. Likely there is a typo in the class name or the file name.', 'event_espresso'),
93 93
 						$message_type_class_name,
94 94
 						$file_path
95 95
 					)
96 96
 				);
97 97
 			}
98 98
 
99
-			$this->_load_message_type( new $message_type_class_name );
99
+			$this->_load_message_type(new $message_type_class_name);
100 100
 		}
101 101
 	}
102 102
 
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 * @param EE_message_type $message_type
107 107
 	 * @return bool
108 108
 	 */
109
-	protected function _load_message_type( EE_message_type $message_type ) {
110
-		if ( $this->message_type_collection()->has_by_name( $message_type->name ) ) {
109
+	protected function _load_message_type(EE_message_type $message_type) {
110
+		if ($this->message_type_collection()->has_by_name($message_type->name)) {
111 111
 			return true;
112 112
 		}
113 113
 		return $this->message_type_collection()->add(
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 
48 48
 
49 49
 	/**
50
-	 * @param mixed $message_types
50
+	 * @param EE_Message_Type_Collection $message_types
51 51
 	 */
52 52
 	public function set_message_type_collection( EE_Message_Type_Collection $message_types ) {
53 53
 		$this->_message_type_collection = $message_types;
Please login to merge, or discard this patch.
core/libraries/messages/EE_Messages_Base.lib.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
 	 * @access protected
185 185
 	 * @param string $messenger
186 186
 	 */
187
-	protected function _set_existing_admin_settings( $messenger = '' ) {
187
+	protected function _set_existing_admin_settings($messenger = '') {
188 188
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
189
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
189
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
190 190
 		$active_messengers = $Message_Resource_Manager->get_active_messengers_option();
191 191
 		$settings_to_use = $active_messengers;
192 192
 
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 		 * This determines what will be used for the getting the settings.
195 195
 		 */
196 196
 		if (
197
-			! empty( $messenger )
198
-			&& $Message_Resource_Manager->is_message_type_active_for_messenger( $messenger, $this->name )
197
+			! empty($messenger)
198
+			&& $Message_Resource_Manager->is_message_type_active_for_messenger($messenger, $this->name)
199 199
 		) {
200
-			$settings_to_use = $active_messengers[ $messenger ]['settings'][ $messenger . '-message_types' ];
200
+			$settings_to_use = $active_messengers[$messenger]['settings'][$messenger.'-message_types'];
201 201
 		}
202 202
 
203
-		$this->_existing_admin_settings = isset( $settings_to_use[ $this->name ]['settings'] )
204
-			? $settings_to_use[ $this->name ]['settings']
203
+		$this->_existing_admin_settings = isset($settings_to_use[$this->name]['settings'])
204
+			? $settings_to_use[$this->name]['settings']
205 205
 			: null;
206 206
 	}
207 207
 
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 	 * @param string $messenger
219 219
 	 * @return array          settings
220 220
 	 */
221
-	public function get_existing_admin_settings( $messenger = '' ) {
221
+	public function get_existing_admin_settings($messenger = '') {
222 222
 		// if admin_settings property empty lets try setting it.
223
-		if ( method_exists($this, '_set_existing_admin_settings') && empty( $this->_existing_admin_settings ) ) {
224
-			$this->_set_existing_admin_settings( $messenger );
223
+		if (method_exists($this, '_set_existing_admin_settings') && empty($this->_existing_admin_settings)) {
224
+			$this->_set_existing_admin_settings($messenger);
225 225
 		}
226
-		return property_exists( $this, '_existing_admin_settings' )
226
+		return property_exists($this, '_existing_admin_settings')
227 227
 			? $this->_existing_admin_settings
228 228
 			: null;
229 229
 	}
@@ -239,12 +239,12 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	public function get_valid_shortcodes() {
241 241
 		$valid_shortcodes = apply_filters(
242
-			'FHEE__' . get_class( $this ) . '__get_valid_shortcodes',
242
+			'FHEE__'.get_class($this).'__get_valid_shortcodes',
243 243
 			$this->_valid_shortcodes,
244 244
 			$this
245 245
 		);
246 246
 		//The below filter applies to ALL messengers and message types so use with care!
247
-		$valid_shortcodes = apply_filters( 'FHEE__EE_Messages_Base__get_valid_shortcodes', $valid_shortcodes, $this );
247
+		$valid_shortcodes = apply_filters('FHEE__EE_Messages_Base__get_valid_shortcodes', $valid_shortcodes, $this);
248 248
 		return $valid_shortcodes;
249 249
 	}
250 250
 
@@ -278,23 +278,23 @@  discard block
 block discarded – undo
278 278
 	 * @access protected
279 279
 	 * @return string $content for page.
280 280
 	 */
281
-	protected function _get_admin_page_content( $page, $action, $extra, $actives ) {
281
+	protected function _get_admin_page_content($page, $action, $extra, $actives) {
282 282
 		//we can also further refine the context by action (if present).
283
-		if ( !empty($action) ) {
284
-			$page = $page . '_' . $action;
283
+		if ( ! empty($action)) {
284
+			$page = $page.'_'.$action;
285 285
 		}
286 286
 
287
-		if ( !isset( $this->admin_registered_pages[$page]) ){
287
+		if ( ! isset($this->admin_registered_pages[$page])) {
288 288
 			// todo: a place to throw an exception?
289 289
 			// We need to indicate there is no registered page so this function is not being called correctly.
290 290
 			return false;
291 291
 		}
292 292
 		//k made it here so let's call the method
293 293
 		$content = call_user_func_array(
294
-			array( $this, '_get_admin_content_' . $page ),
295
-			array( $actives, $extra )
294
+			array($this, '_get_admin_content_'.$page),
295
+			array($actives, $extra)
296 296
 		);
297
-		if ( $content === false ) {
297
+		if ($content === false) {
298 298
 			// todo this needs to be an exception once we've got exceptions in place.
299 299
 			return false;
300 300
 		}
Please login to merge, or discard this patch.