Completed
Branch BETA-4.9-messages-queue-fixed (941081)
by
unknown
17:38 queued 10s
created
core/libraries/batch/JobHandlerBaseClasses/JobHandlerFile.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 
17 17
 use EventEspressoBatchRequest\Helpers\BatchRequestException;
18 18
 
19
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
20
-	exit( 'No direct script access allowed' );
19
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
20
+	exit('No direct script access allowed');
21 21
 }
22 22
 
23 23
 
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @param \EEHI_File|null $file_helper
41 41
 	 */
42
-	public function __construct( \EEHI_File $file_helper = null ) {
43
-		if( ! $file_helper ) {
42
+	public function __construct(\EEHI_File $file_helper = null) {
43
+		if ( ! $file_helper) {
44 44
 			$this->_file_helper = new \EEH_File();
45 45
 		}
46 46
 	}
@@ -56,39 +56,39 @@  discard block
 block discarded – undo
56 56
 	 * @return string
57 57
 	 * @throws \EventEspressoBatchRequest\Helpers\BatchRequestException
58 58
 	 */
59
-	public function create_file_from_job_with_name( $job_id, $filename, $filetype = 'application/ms-excel' ) {
59
+	public function create_file_from_job_with_name($job_id, $filename, $filetype = 'application/ms-excel') {
60 60
 		$filepath = '';
61
-		try{
61
+		try {
62 62
 			$success = $this->_file_helper->ensure_folder_exists_and_is_writable(
63
-				EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name
63
+				EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name
64 64
 			);
65
-			if ( $success ) {
65
+			if ($success) {
66 66
 				$success = $this->_file_helper->ensure_folder_exists_and_is_writable(
67
-					EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id
67
+					EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id
68 68
 				);
69 69
 			}
70
-			if( $success ) {
71
-				$filepath = EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id . DS. $filename;
72
-				$success = $this->_file_helper->ensure_file_exists_and_is_writable( $filepath );
70
+			if ($success) {
71
+				$filepath = EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id.DS.$filename;
72
+				$success = $this->_file_helper->ensure_file_exists_and_is_writable($filepath);
73 73
 			}
74 74
 			//let's add the .htaccess file so safari will open the file properly
75
-			if( $success ) {
76
-				$extension = \EEH_File::get_file_extension( $filepath );
75
+			if ($success) {
76
+				$extension = \EEH_File::get_file_extension($filepath);
77 77
 				\EEH_File::write_to_file(
78
-					EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id . DS . '.htaccess',
79
-					'AddType ' . $filetype . ' ' . $extension,
78
+					EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id.DS.'.htaccess',
79
+					'AddType '.$filetype.' '.$extension,
80 80
 					'.htaccess'
81 81
 				);
82 82
 			}
83 83
 			//those methods normally fail with an exception, but if not, let's do it
84
-			if( ! $success ) {
85
-				throw new \EE_Error( 'could_not_create_temp_file',
86
-				__( 'An unknown error occurred', 'event_espresso' ));
84
+			if ( ! $success) {
85
+				throw new \EE_Error('could_not_create_temp_file',
86
+				__('An unknown error occurred', 'event_espresso'));
87 87
 			}
88
-		} catch( \EE_Error $e ) {
88
+		} catch (\EE_Error $e) {
89 89
 			throw new BatchRequestException(
90 90
 				sprintf(
91
-					__( 'Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso' ),
91
+					__('Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso'),
92 92
 					$job_id,
93 93
 					$e->getMessage()
94 94
 				),
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 * @param string $filepath
105 105
 	 * @return string url to file
106 106
 	 */
107
-	public function get_url_to_file( $filepath ) {
108
-		return str_replace( EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath );
107
+	public function get_url_to_file($filepath) {
108
+		return str_replace(EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath);
109 109
 	}
110 110
 }
111 111
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_messenger.lib.php 1 patch
Spacing   +96 added lines, -96 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
 /**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 * @return void
290 290
 	 */
291 291
 	public function enqueue_scripts_styles() {
292
-		do_action( 'AHEE__EE_messenger__enqueue_scripts_styles');
292
+		do_action('AHEE__EE_messenger__enqueue_scripts_styles');
293 293
 	}
294 294
 
295 295
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
 		$this->_supports_labels->template_variation_description = __('These are different styles to choose from for the selected template structure.  Usually these affect things like font style, color, borders etc.  In some cases the styles will also make minor layout changes.');
361 361
 
362
-		$this->_supports_labels = apply_filters( 'FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this );
362
+		$this->_supports_labels = apply_filters('FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this);
363 363
 	}
364 364
 
365 365
 
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 	 * @return stdClass
375 375
 	 */
376 376
 	public function get_supports_labels() {
377
-		if ( empty( $this->_supports_labels->template_pack ) || empty( $this->_supports_labels->template_variation) ) {
377
+		if (empty($this->_supports_labels->template_pack) || empty($this->_supports_labels->template_variation)) {
378 378
 			$this->_set_supports_labels_defaults();
379 379
 		}
380
-		return apply_filters( 'FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this );
380
+		return apply_filters('FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this);
381 381
 	}
382 382
 
383 383
 
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
 	 *
398 398
 	 * @return string                    path or url for the requested variation.
399 399
 	 */
400
-	public function get_variation( EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE ) {
400
+	public function get_variation(EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE) {
401 401
 		$this->_tmp_pack = $pack;
402
-		$variation_path = apply_filters( 'EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters );
403
-		$variation_path = empty( $variation_path ) ? $this->_tmp_pack->get_variation( $this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters ) : $variation_path;
402
+		$variation_path = apply_filters('EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters);
403
+		$variation_path = empty($variation_path) ? $this->_tmp_pack->get_variation($this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters) : $variation_path;
404 404
 		return $variation_path;
405 405
 
406 406
 	}
@@ -418,13 +418,13 @@  discard block
 block discarded – undo
418 418
 	 * @return array
419 419
 	 */
420 420
 	public function get_default_message_types() {
421
-		$class = get_class( $this );
421
+		$class = get_class($this);
422 422
 
423 423
 		//messenger specific filter
424
-		$default_types = apply_filters( 'FHEE__' . $class . '__get_default_message_types__default_types', $this->_default_message_types, $this );
424
+		$default_types = apply_filters('FHEE__'.$class.'__get_default_message_types__default_types', $this->_default_message_types, $this);
425 425
 
426 426
 		//all messengers filter
427
-		$default_types = apply_filters( 'FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this );
427
+		$default_types = apply_filters('FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this);
428 428
 		return $default_types;
429 429
 	}
430 430
 
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
 	 * @return array
440 440
 	 */
441 441
 	public function get_valid_message_types() {
442
-		$class = get_class( $this );
442
+		$class = get_class($this);
443 443
 
444 444
 		//messenger specific filter
445 445
 		//messenger specific filter
446
-		$valid_types = apply_filters( 'FHEE__' . $class . '__get_valid_message_types__valid_types', $this->_valid_message_types, $this );
446
+		$valid_types = apply_filters('FHEE__'.$class.'__get_valid_message_types__valid_types', $this->_valid_message_types, $this);
447 447
 
448 448
 		//all messengers filter
449
-		$valid_types = apply_filters( 'FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this );
449
+		$valid_types = apply_filters('FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this);
450 450
 		return $valid_types;
451 451
 	}
452 452
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	 * @access public
461 461
 	 * @param array $new_config Whatever is put in here will reset the _validator_config property
462 462
 	 */
463
-	public function set_validator_config( $new_config ) {
463
+	public function set_validator_config($new_config) {
464 464
 		$this->_validator_config = $new_config;
465 465
 	}
466 466
 
@@ -476,8 +476,8 @@  discard block
 block discarded – undo
476 476
 	public function get_validator_config() {
477 477
 		$class = get_class($this);
478 478
 
479
-		$config = apply_filters( 'FHEE__' . $class . '__get_validator_config', $this->_validator_config, $this );
480
-		$config = apply_filters( 'FHEE__EE_messenger__get_validator_config', $config, $this );
479
+		$config = apply_filters('FHEE__'.$class.'__get_validator_config', $this->_validator_config, $this);
480
+		$config = apply_filters('FHEE__EE_messenger__get_validator_config', $config, $this);
481 481
 		return $config;
482 482
 	}
483 483
 
@@ -494,8 +494,8 @@  discard block
 block discarded – undo
494 494
 	 * @access public
495 495
 	 * @return string content for page
496 496
 	 */
497
-	public function get_messenger_admin_page_content( $page, $action = null, $extra = array(), $message_types = array() ) {
498
-		return $this->_get_admin_page_content( $page, $action, $extra, $message_types );
497
+	public function get_messenger_admin_page_content($page, $action = null, $extra = array(), $message_types = array()) {
498
+		return $this->_get_admin_page_content($page, $action, $extra, $message_types);
499 499
 	}
500 500
 
501 501
 
@@ -505,69 +505,69 @@  discard block
 block discarded – undo
505 505
 	 * @param array $extra
506 506
 	 * @return mixed|string
507 507
 	 */
508
-	protected function _get_admin_content_events_edit( $message_types, $extra ) {
508
+	protected function _get_admin_content_events_edit($message_types, $extra) {
509 509
 		//defaults
510 510
 		$template_args = array();
511 511
 		$selector_rows = '';
512 512
 
513 513
 		//we don't need message types here so we're just going to ignore. we do, however, expect the event id here. The event id is needed to provide a link to setup a custom template for this event.
514
-		$event_id = isset( $extra['event'] ) ? $extra['event'] : NULL;
514
+		$event_id = isset($extra['event']) ? $extra['event'] : NULL;
515 515
 
516
-		$template_wrapper_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
517
-		$template_row_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_row.template.php';
516
+		$template_wrapper_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
517
+		$template_row_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_row.template.php';
518 518
 
519 519
 		//array of template objects for global and custom (non-trashed) (but remember just for this messenger!)
520
-		$global_templates = EEM_Message_Template_Group::instance()->get_all( array( array('MTP_messenger' => $this->name, 'MTP_is_global' => TRUE, 'MTP_is_active' => TRUE ) ) );
521
-		$templates_for_event = EEM_Message_Template_Group::instance()->get_all_custom_templates_by_event( $event_id, array( 'MTP_messenger' => $this->name, 'MTP_is_active' => TRUE ) );
522
-		$templates_for_event = !empty( $templates_for_event ) ? $templates_for_event : array();
520
+		$global_templates = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_messenger' => $this->name, 'MTP_is_global' => TRUE, 'MTP_is_active' => TRUE)));
521
+		$templates_for_event = EEM_Message_Template_Group::instance()->get_all_custom_templates_by_event($event_id, array('MTP_messenger' => $this->name, 'MTP_is_active' => TRUE));
522
+		$templates_for_event = ! empty($templates_for_event) ? $templates_for_event : array();
523 523
 
524 524
 		//so we need to setup the rows for the selectors and we use the global mtpgs (cause those will the active message template groups)
525
-		foreach ( $global_templates as $mtpgID => $mtpg ) {
526
-			if ( $mtpg instanceof EE_Message_Template_Group ) {
525
+		foreach ($global_templates as $mtpgID => $mtpg) {
526
+			if ($mtpg instanceof EE_Message_Template_Group) {
527 527
 				//verify this message type is supposed to show on this page
528 528
 				$mtp_obj = $mtpg->message_type_obj();
529
-				if ( ! $mtp_obj instanceof EE_message_type ) {
529
+				if ( ! $mtp_obj instanceof EE_message_type) {
530 530
 					continue;
531 531
 				}
532
-				$mtp_obj->admin_registered_pages = (array)$mtp_obj->admin_registered_pages;
533
-				if ( ! in_array( 'events_edit', $mtp_obj->admin_registered_pages ) ) {
532
+				$mtp_obj->admin_registered_pages = (array) $mtp_obj->admin_registered_pages;
533
+				if ( ! in_array('events_edit', $mtp_obj->admin_registered_pages)) {
534 534
 					continue;
535 535
 				}
536 536
 				$select_values = array();
537
-				$select_values[ $mtpgID ] = __( 'Global', 'event_espresso' );
538
-				$default_value = array_key_exists( $mtpgID, $templates_for_event ) && ! $mtpg->get( 'MTP_is_override' ) ? $mtpgID : null;
537
+				$select_values[$mtpgID] = __('Global', 'event_espresso');
538
+				$default_value = array_key_exists($mtpgID, $templates_for_event) && ! $mtpg->get('MTP_is_override') ? $mtpgID : null;
539 539
 				//if the override has been set for the global template, then that means even if there are custom templates already created we ignore them because of the set override.
540
-				if ( ! $mtpg->get( 'MTP_is_override' ) ) {
540
+				if ( ! $mtpg->get('MTP_is_override')) {
541 541
 					//any custom templates for this message type?
542
-					$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt( $this->name, $mtpg->message_type() );
543
-					foreach ( $custom_templates as $cmtpgID => $cmtpg ) {
544
-						$select_values[ $cmtpgID ] = $cmtpg->name();
545
-						$default_value = array_key_exists( $cmtpgID, $templates_for_event ) ? $cmtpgID : $default_value;
542
+					$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt($this->name, $mtpg->message_type());
543
+					foreach ($custom_templates as $cmtpgID => $cmtpg) {
544
+						$select_values[$cmtpgID] = $cmtpg->name();
545
+						$default_value = array_key_exists($cmtpgID, $templates_for_event) ? $cmtpgID : $default_value;
546 546
 					}
547 547
 				}
548 548
 				//if there is no $default_value then we set it as the global
549
-				$default_value = empty( $default_value ) ? $mtpgID : $default_value;
550
-				$edit_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value ), admin_url( 'admin.php' ) );
551
-				$create_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value ), admin_url( 'admin.php' ) );
552
-				$st_args[ 'mt_name' ] = ucwords( $mtp_obj->label[ 'singular' ] );
553
-				$st_args[ 'mt_slug' ] = $mtpg->message_type();
554
-				$st_args[ 'messenger_slug' ] = $this->name;
555
-				$st_args[ 'selector' ] = EEH_Form_Fields::select_input( 'event_message_templates_relation[' . $mtpgID . ']', $select_values, $default_value, 'data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '"', 'message-template-selector' );
549
+				$default_value = empty($default_value) ? $mtpgID : $default_value;
550
+				$edit_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value), admin_url('admin.php'));
551
+				$create_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value), admin_url('admin.php'));
552
+				$st_args['mt_name'] = ucwords($mtp_obj->label['singular']);
553
+				$st_args['mt_slug'] = $mtpg->message_type();
554
+				$st_args['messenger_slug'] = $this->name;
555
+				$st_args['selector'] = EEH_Form_Fields::select_input('event_message_templates_relation['.$mtpgID.']', $select_values, $default_value, 'data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'"', 'message-template-selector');
556 556
 				//note that  message template group that has override_all_custom set will remove the ability to set a custom message template based off of the global (and that also in turn overrides any other custom templates).
557
-				$st_args[ 'create_button' ] = $mtpg->get( 'MTP_is_override' ) ? '' : '<a data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $create_url . '" class="button button-small create-mtpg-button">' . __( 'Create New Custom', 'event_espresso' ) . '</a>';
558
-				$st_args[ 'create_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messsages_add_new_message_template' ) ? $st_args[ 'create_button' ] : '';
559
-				$st_args[ 'edit_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID ) ? '<a data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $edit_url . '" class="button button-small edit-mtpg-button">' . __( 'Edit', 'event_espresso' ) . '</a>' : '';
560
-				$selector_rows .= EEH_Template::display_template( $template_row_path, $st_args, true );
557
+				$st_args['create_button'] = $mtpg->get('MTP_is_override') ? '' : '<a data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$create_url.'" class="button button-small create-mtpg-button">'.__('Create New Custom', 'event_espresso').'</a>';
558
+				$st_args['create_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messsages_add_new_message_template') ? $st_args['create_button'] : '';
559
+				$st_args['edit_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID) ? '<a data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$edit_url.'" class="button button-small edit-mtpg-button">'.__('Edit', 'event_espresso').'</a>' : '';
560
+				$selector_rows .= EEH_Template::display_template($template_row_path, $st_args, true);
561 561
 			}
562 562
 		}
563 563
 
564 564
 		//if no selectors present then get out.
565
-		if ( empty( $selector_rows ) ) {
565
+		if (empty($selector_rows)) {
566 566
 			return '';
567 567
 		}
568 568
 
569 569
 		$template_args['selector_rows'] = $selector_rows;
570
-		return EEH_Template::display_template( $template_wrapper_path, $template_args, TRUE );
570
+		return EEH_Template::display_template($template_wrapper_path, $template_args, TRUE);
571 571
 	}
572 572
 
573 573
 
@@ -582,8 +582,8 @@  discard block
 block discarded – undo
582 582
 	 * @return array $this->_template_fields
583 583
 	 */
584 584
 	public function get_template_fields() {
585
-		$template_fields = apply_filters( 'FHEE__' . get_class($this) . '__get_template_fields', $this->_template_fields, $this );
586
-		$template_fields = apply_filters( 'FHEE__EE_messenger__get_template_fields', $template_fields, $this );
585
+		$template_fields = apply_filters('FHEE__'.get_class($this).'__get_template_fields', $this->_template_fields, $this);
586
+		$template_fields = apply_filters('FHEE__EE_messenger__get_template_fields', $template_fields, $this);
587 587
 		return $template_fields;
588 588
 	}
589 589
 
@@ -597,9 +597,9 @@  discard block
 block discarded – undo
597 597
 	 * @param mixed $value
598 598
 	 */
599 599
 	protected function _set_template_value($item, $value) {
600
-		if ( array_key_exists($item, $this->_template_fields) ) {
601
-			$prop = '_' . $item;
602
-			$this->$prop= $value;
600
+		if (array_key_exists($item, $this->_template_fields)) {
601
+			$prop = '_'.$item;
602
+			$this->$prop = $value;
603 603
 		}
604 604
 	}
605 605
 
@@ -610,8 +610,8 @@  discard block
 block discarded – undo
610 610
 	 * @return bool Very important that all messengers return bool for successful send or not.  Error messages can be
611 611
 	 *              added to EE_Error.
612 612
 	 */
613
-	public function send_message( $message, EE_message_type $message_type ) {
614
-		$this->_validate_and_setup( $message );
613
+	public function send_message($message, EE_message_type $message_type) {
614
+		$this->_validate_and_setup($message);
615 615
 		$this->_incoming_message_type = $message_type;
616 616
 		return $this->_send_message();
617 617
 	}
@@ -625,28 +625,28 @@  discard block
 block discarded – undo
625 625
 	 * @param  bool   $send    true we will actually use the _send method (for test sends). FALSE we just return preview
626 626
 	 * @return string          return the message html content
627 627
 	 */
628
-	public function get_preview( EE_Message $message, EE_message_type $message_type, $send = false ) {
629
-		$this->_validate_and_setup( $message );
628
+	public function get_preview(EE_Message $message, EE_message_type $message_type, $send = false) {
629
+		$this->_validate_and_setup($message);
630 630
 
631 631
 		$this->_incoming_message_type = $message_type;
632 632
 
633
-		if ( $send ) {
633
+		if ($send) {
634 634
 			//are we overriding any existing template fields?
635 635
 			$settings = $this->get_existing_test_settings();
636
-			if ( !empty( $settings ) ) {
637
-				foreach( $settings as $field => $value ) {
638
-					$this->_set_template_value( $field, $value );
636
+			if ( ! empty($settings)) {
637
+				foreach ($settings as $field => $value) {
638
+					$this->_set_template_value($field, $value);
639 639
 				}
640 640
 			}
641 641
 		}
642 642
 
643 643
 		//enqueue preview js so that any links/buttons on the page are disabled.
644
-		if ( ! $send ) {
644
+		if ( ! $send) {
645 645
 			// the below may seem like duplication.  However, typically if a messenger enqueues scripts/styles,
646 646
 			// it deregisters all existing wp scripts and styles first.  So the second hook ensures our previewer still gets setup.
647
-			add_action( 'admin_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
648
-			add_action( 'wp_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
649
-			add_action( 'AHEE__EE_messenger__enqueue_scripts_styles', array( $this, 'add_preview_script' ), 10 );
647
+			add_action('admin_enqueue_scripts', array($this, 'add_preview_script'), 10);
648
+			add_action('wp_enqueue_scripts', array($this, 'add_preview_script'), 10);
649
+			add_action('AHEE__EE_messenger__enqueue_scripts_styles', array($this, 'add_preview_script'), 10);
650 650
 		}
651 651
 
652 652
 		return $send ? $this->_send_message() : $this->_preview();
@@ -664,10 +664,10 @@  discard block
 block discarded – undo
664 664
 	 */
665 665
 	public function add_preview_script() {
666 666
 		//error message
667
-		EE_Registry::$i18n_js_strings[ 'links_disabled' ] = __( 'All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso' );
668
-		wp_register_script( 'ee-messages-preview-js', EE_LIBRARIES_URL . 'messages/messenger/assets/js/ee-messages-preview.js', array( 'jquery' ), EVENT_ESPRESSO_VERSION, true );
669
-		wp_localize_script( 'ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings );
670
-		wp_enqueue_script( 'ee-messages-preview-js' );
667
+		EE_Registry::$i18n_js_strings['links_disabled'] = __('All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso');
668
+		wp_register_script('ee-messages-preview-js', EE_LIBRARIES_URL.'messages/messenger/assets/js/ee-messages-preview.js', array('jquery'), EVENT_ESPRESSO_VERSION, true);
669
+		wp_localize_script('ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings);
670
+		wp_enqueue_script('ee-messages-preview-js');
671 671
 	}
672 672
 
673 673
 
@@ -678,13 +678,13 @@  discard block
 block discarded – undo
678 678
 	 * @param  EE_Message $message
679 679
 	 * @throws EE_Error
680 680
 	 */
681
-	protected function _validate_and_setup( EE_Message $message ) {
681
+	protected function _validate_and_setup(EE_Message $message) {
682 682
 		$template_pack = $message->get_template_pack();
683 683
 		$variation = $message->get_template_pack_variation();
684 684
 
685 685
 		//verify we have the required template pack value on the $message object.
686
-		if ( ! $template_pack instanceof EE_Messages_Template_Pack ) {
687
-			throw new EE_Error( __('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso' ) );
686
+		if ( ! $template_pack instanceof EE_Messages_Template_Pack) {
687
+			throw new EE_Error(__('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso'));
688 688
 		}
689 689
 
690 690
 		$this->_tmp_pack = $template_pack;
@@ -693,11 +693,11 @@  discard block
 block discarded – undo
693 693
 
694 694
 		$template_fields = $this->get_template_fields();
695 695
 
696
-		foreach ( $template_fields as $template => $value ) {
697
-			if ( $template !== 'extra' ) {
698
-				$column_value = $message->get_field_or_extra_meta( 'MSG_' . $template );
696
+		foreach ($template_fields as $template => $value) {
697
+			if ($template !== 'extra') {
698
+				$column_value = $message->get_field_or_extra_meta('MSG_'.$template);
699 699
 				$message_template_value = $column_value ? $column_value : null;
700
-				$this->_set_template_value( $template, $message_template_value );
700
+				$this->_set_template_value($template, $message_template_value);
701 701
 			}
702 702
 		}
703 703
 	}
@@ -712,21 +712,21 @@  discard block
 block discarded – undo
712 712
 	 * @return string
713 713
 	 * @throws \EE_Error
714 714
 	 */
715
-	protected function _get_main_template( $preview = FALSE ) {
715
+	protected function _get_main_template($preview = FALSE) {
716 716
 		$type = $preview ? 'preview' : 'main';
717 717
 
718
-		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type );
718
+		$wrapper_template = $this->_tmp_pack->get_wrapper($this->name, $type);
719 719
 
720 720
 		//check file exists and is readable
721
-		if ( !is_readable( $wrapper_template ) )
722
-			throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) );
721
+		if ( ! is_readable($wrapper_template))
722
+			throw new EE_Error(sprintf(__('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso'), ucwords($this->label['singular']), $wrapper_template));
723 723
 
724 724
 		//add message type to template args
725 725
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
726 726
 
727 727
 		//require template helper
728
-		EE_Registry::instance()->load_helper( 'Template' );
729
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE );
728
+		EE_Registry::instance()->load_helper('Template');
729
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE);
730 730
 	}
731 731
 
732 732
 
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 	 */
763 763
 	public function get_existing_test_settings() {
764 764
 		$settings = EEH_MSG_Template::get_active_messengers_in_db();
765
-		return isset( $settings[$this->name]['test_settings'] ) ? $settings[$this->name]['test_settings'] : array();
765
+		return isset($settings[$this->name]['test_settings']) ? $settings[$this->name]['test_settings'] : array();
766 766
 	}
767 767
 
768 768
 
@@ -774,10 +774,10 @@  discard block
 block discarded – undo
774 774
 	 * @param $settings
775 775
 	 * @return bool success/fail
776 776
 	 */
777
-	public function set_existing_test_settings( $settings ) {
777
+	public function set_existing_test_settings($settings) {
778 778
 		$existing = EEH_MSG_Template::get_active_messengers_in_db();
779 779
 		$existing[$this->name]['test_settings'] = $settings;
780
-		return EEH_MSG_Template::update_active_messengers_in_db( $existing );
780
+		return EEH_MSG_Template::update_active_messengers_in_db($existing);
781 781
 	}
782 782
 
783 783
 
@@ -790,21 +790,21 @@  discard block
 block discarded – undo
790 790
 	 * @param string $field The field to retrieve the label for
791 791
 	 * @return string        	  The label
792 792
 	 */
793
-	public function get_field_label( $field ) {
793
+	public function get_field_label($field) {
794 794
 		//first let's see if the field requests is in the top level array.
795
-		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) )
795
+		if (isset($this->_template_fields[$field]) && ! empty($this->_template_fields[$field]['label']))
796 796
 			return $this->_template[$field]['label'];
797 797
 
798 798
 		//nope so let's look in the extra array to see if it's there HOWEVER if the field exists as a top level index in the extra array then we know the label is in the 'main' index.
799
-		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  )
799
+		if (isset($this->_template_fields['extra']) && ! empty($this->_template_fields['extra'][$field]) && ! empty($this->_template_fields['extra'][$field]['main']['label']))
800 800
 			return $this->_template_fields['extra'][$field]['main']['label'];
801 801
 
802 802
 		//now it's possible this field may just be existing in any of the extra array items.
803
-		if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) {
804
-			foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) {
805
-				if ( !is_array( $subfields ) )
803
+		if ( ! empty($this->_template_fields['extra']) && is_array($this->_template_fields['extra'])) {
804
+			foreach ($this->_template_fields['extra'] as $main_field => $subfields) {
805
+				if ( ! is_array($subfields))
806 806
 					continue;
807
-				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) )
807
+				if (isset($subfields[$field]) && ! empty($subfields[$field]['label']))
808 808
 					return $subfields[$field]['label'];
809 809
 			}
810 810
 		}
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 	 *
826 826
 	 * @return void
827 827
 	 */
828
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
828
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
829 829
 		return;
830 830
 	}
831 831
 
Please login to merge, or discard this patch.
core/libraries/messages/messenger/EE_Email_messenger.class.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * This sets up the email messenger for the EE_messages (notifications) subsystem in EE.
31 31
  */
32
-class EE_Email_messenger extends EE_messenger  {
32
+class EE_Email_messenger extends EE_messenger {
33 33
 
34 34
 	/**
35 35
 	 * The following are the properties that email requires for the message going out.
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	protected function _set_valid_shortcodes() {
76 76
 		//remember by leaving the other fields not set, those fields will inherit the valid shortcodes from the message type.
77 77
 		$this->_valid_shortcodes = array(
78
-			'to' => array('email','event_author', 'primary_registration_details', 'recipient_details'),
78
+			'to' => array('email', 'event_author', 'primary_registration_details', 'recipient_details'),
79 79
 			'from' => array('email', 'event_author', 'primary_registration_details', 'recipient_details')
80 80
 			);
81 81
 	}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				'shortcodes' => array('organization', 'primary_registration_details', 'event_author', 'primary_registration_details', 'recipient_details')
110 110
 				),
111 111
 			'content' => array(
112
-				'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list', 'transaction', 'messenger')
112
+				'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list', 'transaction', 'messenger')
113 113
 				),
114 114
 			'attendee_list' => array(
115 115
 				'shortcodes' => array('attendee', 'event_list', 'ticket_list'),
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 				'required' => array('[EVENT_LIST]')
121 121
 				),
122 122
 			'ticket_list' => array(
123
-				'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list','primary_registration_details', 'recipient_details'),
123
+				'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'),
124 124
 				'required' => array('[TICKET_LIST]')
125 125
 				),
126 126
 			'datetime_list' => array(
@@ -139,21 +139,21 @@  discard block
 block discarded – undo
139 139
 	 *
140 140
 	 * @since 4.5.0
141 141
 	 */
142
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
143
-		if ( $sending_messenger_name = 'html' ) {
144
-			add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10, 8 );
142
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
143
+		if ($sending_messenger_name = 'html') {
144
+			add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8);
145 145
 		}
146 146
 	}
147 147
 
148 148
 
149 149
 
150 150
 
151
-	public function add_email_css( $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack ) {
151
+	public function add_email_css($variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack) {
152 152
 		//prevent recursion on this callback.
153
-		remove_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10 );
154
-		$variation = $this->get_variation( $template_pack, $message_type, $url, 'main', $variation, FALSE  );
153
+		remove_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10);
154
+		$variation = $this->get_variation($template_pack, $message_type, $url, 'main', $variation, FALSE);
155 155
 
156
-		add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10, 8 );
156
+		add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8);
157 157
 		return $variation;
158 158
 	}
159 159
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 				'required' => FALSE,
186 186
 				'validation' => FALSE,
187 187
 				'format' => '%s',
188
-				'value' => sprintf( __('Test email sent from %s', 'event_espresso'), get_bloginfo('name') ),
188
+				'value' => sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name')),
189 189
 				'default'=> '',
190 190
 				'css_class' => ''
191 191
 				)
@@ -347,16 +347,16 @@  discard block
 block discarded – undo
347 347
 	 * @return bool | WP_Error  true if message delivered, false if it didn't deliver OR bubble up any error object if present.
348 348
 	 */
349 349
 	protected function _send_message() {
350
-		$success =  wp_mail(
351
-			html_entity_decode( $this->_to, ENT_QUOTES, "UTF-8" ),
352
-			stripslashes( html_entity_decode( $this->_subject, ENT_QUOTES, "UTF-8" )),
350
+		$success = wp_mail(
351
+			html_entity_decode($this->_to, ENT_QUOTES, "UTF-8"),
352
+			stripslashes(html_entity_decode($this->_subject, ENT_QUOTES, "UTF-8")),
353 353
 			$this->_body(),
354 354
 			$this->_headers()
355 355
 		);
356
-		if ( ! $success ) {
356
+		if ( ! $success) {
357 357
 			EE_Error::add_error(
358 358
 				sprintf(
359
-					__( 'The email did not send successfully. The WordPress wp_mail function is used for sending mails but does not give any useful information when an email fails to send.
359
+					__('The email did not send successfully. The WordPress wp_mail function is used for sending mails but does not give any useful information when an email fails to send.
360 360
 				It is possible the "to" address (%s) or "from" address (%s) is invalid.', 'event_espresso'),
361 361
 					$this->_to,
362 362
 					$this->_from
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 * @return string html body of the message content and the related css.
376 376
 	 */
377 377
 	protected function _preview() {
378
-		return $this->_body( true );
378
+		return $this->_body(true);
379 379
 	}
380 380
 
381 381
 
@@ -389,18 +389,18 @@  discard block
 block discarded – undo
389 389
 	 * @return string formatted header for email
390 390
 	 */
391 391
 	protected function _headers() {
392
-		$from = stripslashes_deep( html_entity_decode($this->_from,  ENT_QUOTES,"UTF-8" ) );
392
+		$from = stripslashes_deep(html_entity_decode($this->_from, ENT_QUOTES, "UTF-8"));
393 393
 		$headers = array(
394 394
 			'MIME-Version: 1.0',
395
-			'From:' . $from,
396
-			'Reply-To:' . $from,
395
+			'From:'.$from,
396
+			'Reply-To:'.$from,
397 397
 			'Content-Type:text/html; charset=utf-8'
398 398
 			);
399 399
 
400 400
 		//but wait!  Header's for the from is NOT reliable because some plugins don't respect From: as set in the header.
401
-		add_filter( 'wp_mail_from',  array( $this, 'set_from_address' ), 100 );
402
-		add_filter( 'wp_mail_from_name', array( $this, 'set_from_name' ), 100 );
403
-		return apply_filters( 'FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this );
401
+		add_filter('wp_mail_from', array($this, 'set_from_address'), 100);
402
+		add_filter('wp_mail_from_name', array($this, 'set_from_name'), 100);
403
+		return apply_filters('FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this);
404 404
 	}
405 405
 
406 406
 
@@ -416,19 +416,19 @@  discard block
 block discarded – undo
416 416
 	 * @return array
417 417
 	 */
418 418
 	private function _parse_from() {
419
-		if ( strpos( $this->_from, '<' ) !== false ) {
420
-			$from_name = substr( $this->_from, 0, strpos( $this->_from, '<' ) - 1 );
421
-			$from_name = str_replace( '"', '', $from_name );
422
-			$from_name = trim( $from_name );
423
-
424
-			$from_email = substr( $this->_from, strpos( $this->_from, '<' ) + 1 );
425
-			$from_email = str_replace( '>', '', $from_email );
426
-			$from_email = trim( $from_email );
419
+		if (strpos($this->_from, '<') !== false) {
420
+			$from_name = substr($this->_from, 0, strpos($this->_from, '<') - 1);
421
+			$from_name = str_replace('"', '', $from_name);
422
+			$from_name = trim($from_name);
423
+
424
+			$from_email = substr($this->_from, strpos($this->_from, '<') + 1);
425
+			$from_email = str_replace('>', '', $from_email);
426
+			$from_email = trim($from_email);
427 427
 		} else {
428 428
 			$from_name = '';
429
-			$from_email = trim( $this->_from );
429
+			$from_email = trim($this->_from);
430 430
 		}
431
-		return array( $from_name, $from_email );
431
+		return array($from_name, $from_email);
432 432
 	}
433 433
 
434 434
 
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 	 *
442 442
 	 * @param string $from_email What the original from_email is.
443 443
 	 */
444
-	public function set_from_address( $from_email ) {
444
+	public function set_from_address($from_email) {
445 445
 		$parsed_from = $this->_parse_from();
446 446
 		return $parsed_from[1];
447 447
 	}
@@ -456,13 +456,13 @@  discard block
 block discarded – undo
456 456
 	 *
457 457
 	 * @param string $from_name The original from_name.
458 458
 	 */
459
-	public function set_from_name( $from_name ) {
459
+	public function set_from_name($from_name) {
460 460
 		$parsed_from = $this->_parse_from();
461
-		if ( is_array( $parsed_from) && ! empty( $parsed_from[0] ) ) {
462
-			$from_name =  $parsed_from[0];
461
+		if (is_array($parsed_from) && ! empty($parsed_from[0])) {
462
+			$from_name = $parsed_from[0];
463 463
 		}
464 464
 
465
-		return stripslashes_deep( html_entity_decode($from_name,  ENT_QUOTES,"UTF-8" ) );
465
+		return stripslashes_deep(html_entity_decode($from_name, ENT_QUOTES, "UTF-8"));
466 466
 	}
467 467
 
468 468
 
@@ -473,14 +473,14 @@  discard block
 block discarded – undo
473 473
 	 * @param bool $preview will determine whether this is preview template or not.
474 474
 	 * @return string formatted body for email.
475 475
 	 */
476
-	protected function _body( $preview = false ) {
476
+	protected function _body($preview = false) {
477 477
 		//setup template args!
478 478
 		$this->_template_args = array(
479 479
 			'subject' => $this->_subject,
480 480
 			'from' => $this->_from,
481
-			'main_body' => wpautop(stripslashes_deep( html_entity_decode($this->_content,  ENT_QUOTES,"UTF-8" ) ))
481
+			'main_body' => wpautop(stripslashes_deep(html_entity_decode($this->_content, ENT_QUOTES, "UTF-8")))
482 482
 			);
483
-		$body =  $this->_get_main_template( $preview );
483
+		$body = $this->_get_main_template($preview);
484 484
 
485 485
 		/**
486 486
 		 * This filter allows one to bypass the CSSToInlineStyles tool and leave the body untouched.
@@ -488,17 +488,17 @@  discard block
 block discarded – undo
488 488
 		 * @type    bool    $preview    Indicates whether a preview is being generated or not.
489 489
 		 * @return  bool    true  indicates to use the inliner, false bypasses it.
490 490
 		 */
491
-		if ( apply_filters( 'FHEE__EE_Email_messenger__apply_CSSInliner ', true, $preview ) ) {
491
+		if (apply_filters('FHEE__EE_Email_messenger__apply_CSSInliner ', true, $preview)) {
492 492
 
493 493
 			//require CssToInlineStyles library and its dependencies via composer autoloader
494
-			require_once EE_THIRD_PARTY . 'cssinliner/vendor/autoload.php';
494
+			require_once EE_THIRD_PARTY.'cssinliner/vendor/autoload.php';
495 495
 
496 496
 			//now if this isn't a preview, let's setup the body so it has inline styles
497
-			if ( ! $preview || ( $preview && defined( 'DOING_AJAX' ) ) ) {
498
-				$style = file_get_contents( $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, FALSE, 'main', $this->_variation ), TRUE );
499
-				$CSS = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles( $body, $style );
500
-				$body = ltrim( $CSS->convert( true ), ">\n" ); //for some reason the library has a bracket and new line at the beginning.  This takes care of that.
501
-				$body = ltrim( $body, "<?" ); //see https://events.codebasehq.com/projects/event-espresso/tickets/8609
497
+			if ( ! $preview || ($preview && defined('DOING_AJAX'))) {
498
+				$style = file_get_contents($this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, FALSE, 'main', $this->_variation), TRUE);
499
+				$CSS = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles($body, $style);
500
+				$body = ltrim($CSS->convert(true), ">\n"); //for some reason the library has a bracket and new line at the beginning.  This takes care of that.
501
+				$body = ltrim($body, "<?"); //see https://events.codebasehq.com/projects/event-espresso/tickets/8609
502 502
 			}
503 503
 
504 504
 		}
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 	public function get_existing_test_settings() {
518 518
 		$settings = parent::get_existing_test_settings();
519 519
 		//override subject if present because we always want it to be fresh.
520
-		if ( is_array( $settings ) && ! empty( $settings['subject'] ) ) {
521
-			$settings['subject'] = sprintf( __('Test email sent from %s', 'event_espresso'), get_bloginfo('name') );
520
+		if (is_array($settings) && ! empty($settings['subject'])) {
521
+			$settings['subject'] = sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name'));
522 522
 		}
523 523
 		return $settings;
524 524
 	}
Please login to merge, or discard this patch.
core/EE_Capabilities.core.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  * @package Event Espresso
8 8
  * @subpackage core, capabilities
9 9
  */
10
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
11
-	exit( 'No direct script access allowed' );
10
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
11
+	exit('No direct script access allowed');
12 12
 }
13 13
 
14 14
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public static function instance() {
71 71
 		//check if instantiated, and if not do so.
72
-		if ( ! self::$_instance instanceof EE_Capabilities ) {
72
+		if ( ! self::$_instance instanceof EE_Capabilities) {
73 73
 			self::$_instance = new self();
74 74
 		}
75 75
 		return self::$_instance;
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 	 * @since 4.5.0
99 99
 	 * @return void
100 100
 	 */
101
-	public function init_caps( $reset = false ) {
102
-		if ( EE_Maintenance_Mode::instance()->models_can_query() ){
101
+	public function init_caps($reset = false) {
102
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
103 103
 			$this->_caps_map = $this->_init_caps_map();
104
-			$this->init_role_caps( $reset );
104
+			$this->init_role_caps($reset);
105 105
 			$this->_set_meta_caps();
106 106
 		}
107 107
 	}
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 		//make sure we're only ever initializing the default _meta_caps array once if it's empty.
121 121
 		$this->_meta_caps = $this->_get_default_meta_caps_array();
122 122
 
123
-		$this->_meta_caps = apply_filters( 'FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps );
123
+		$this->_meta_caps = apply_filters('FHEE__EE_Capabilities___set_meta_caps__meta_caps', $this->_meta_caps);
124 124
 
125 125
 		//add filter for map_meta_caps but only if models can query.
126
-		if ( EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ) ) ) {
127
-			add_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10, 4 );
126
+		if (EE_Maintenance_Mode::instance()->models_can_query() && ! has_filter('map_meta_cap', array($this, 'map_meta_caps'))) {
127
+			add_filter('map_meta_cap', array($this, 'map_meta_caps'), 10, 4);
128 128
 		}
129 129
 	}
130 130
 
@@ -137,37 +137,37 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	private function _get_default_meta_caps_array() {
139 139
 		static $default_meta_caps = array();
140
-		if ( empty( $default_meta_caps ) ) {
140
+		if (empty($default_meta_caps)) {
141 141
 			$default_meta_caps = array(
142 142
 				//edits
143
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_event', array( 'Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events' ) ),
144
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_venue', array( 'Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues' ) ),
145
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_registration', array( 'Registration', '', 'ee_edit_others_registrations', '' ) ),
146
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_checkin', array( 'Registration', '', 'ee_edit_others_checkins', '' ) ),
147
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_edit_message', array( 'Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages' ) ),
148
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_default_ticket', array( 'Ticket', '', 'ee_edit_others_default_tickets', '' ) ),
149
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question', array( 'Question', '', '', 'ee_edit_system_questions' ) ),
150
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_edit_question_group', array( 'Question_Group', '', '', 'ee_edit_system_question_groups' ) ),
151
-				new EE_Meta_Capability_Map_Edit( 'ee_edit_payment_method', array( 'Payment_Method', '', 'ee_edit_others_payment_methods', '' ) ),
143
+				new EE_Meta_Capability_Map_Edit('ee_edit_event', array('Event', 'ee_edit_published_events', 'ee_edit_others_events', 'ee_edit_private_events')),
144
+				new EE_Meta_Capability_Map_Edit('ee_edit_venue', array('Venue', 'ee_edit_published_venues', 'ee_edit_others_venues', 'ee_edit_private_venues')),
145
+				new EE_Meta_Capability_Map_Edit('ee_edit_registration', array('Registration', '', 'ee_edit_others_registrations', '')),
146
+				new EE_Meta_Capability_Map_Edit('ee_edit_checkin', array('Registration', '', 'ee_edit_others_checkins', '')),
147
+				new EE_Meta_Capability_Map_Messages_Cap('ee_edit_message', array('Message_Template_Group', '', 'ee_edit_others_messages', 'ee_edit_global_messages')),
148
+				new EE_Meta_Capability_Map_Edit('ee_edit_default_ticket', array('Ticket', '', 'ee_edit_others_default_tickets', '')),
149
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question', array('Question', '', '', 'ee_edit_system_questions')),
150
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_edit_question_group', array('Question_Group', '', '', 'ee_edit_system_question_groups')),
151
+				new EE_Meta_Capability_Map_Edit('ee_edit_payment_method', array('Payment_Method', '', 'ee_edit_others_payment_methods', '')),
152 152
 				//reads
153
-				new EE_Meta_Capability_Map_Read( 'ee_read_event', array( 'Event', '', 'ee_read_others_events', 'ee_read_private_events' ) ),
154
-				new EE_Meta_Capability_Map_Read( 'ee_read_venue', array( 'Venue', '', 'ee_read_others_venues', 'ee_read_private_venues' ) ),
155
-				new EE_Meta_Capability_Map_Read( 'ee_read_registration', array( 'Registration', '', '', 'ee_edit_others_registrations' ) ),
156
-				new EE_Meta_Capability_Map_Read( 'ee_read_checkin', array( 'Registration', '', '', 'ee_read_others_checkins' ) ),
157
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_read_message', array( 'Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages' ) ),
158
-				new EE_Meta_Capability_Map_Read( 'ee_read_default_ticket', array( 'Ticket', '', '', 'ee_read_others_default_tickets' ) ),
159
-				new EE_Meta_Capability_Map_Read( 'ee_read_payment_method', array( 'Payment_Method', '', '', 'ee_read_others_payment_methods' ) ),
153
+				new EE_Meta_Capability_Map_Read('ee_read_event', array('Event', '', 'ee_read_others_events', 'ee_read_private_events')),
154
+				new EE_Meta_Capability_Map_Read('ee_read_venue', array('Venue', '', 'ee_read_others_venues', 'ee_read_private_venues')),
155
+				new EE_Meta_Capability_Map_Read('ee_read_registration', array('Registration', '', '', 'ee_edit_others_registrations')),
156
+				new EE_Meta_Capability_Map_Read('ee_read_checkin', array('Registration', '', '', 'ee_read_others_checkins')),
157
+				new EE_Meta_Capability_Map_Messages_Cap('ee_read_message', array('Message_Template_Group', '', 'ee_read_others_messages', 'ee_read_global_messages')),
158
+				new EE_Meta_Capability_Map_Read('ee_read_default_ticket', array('Ticket', '', '', 'ee_read_others_default_tickets')),
159
+				new EE_Meta_Capability_Map_Read('ee_read_payment_method', array('Payment_Method', '', '', 'ee_read_others_payment_methods')),
160 160
 
161 161
 				//deletes
162
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_event', array( 'Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events' ) ),
163
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_venue', array( 'Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues' ) ),
164
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_registration', array( 'Registration', '', 'ee_delete_others_registrations', '' ) ),
165
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_checkin', array( 'Registration', '', 'ee_delete_others_checkins', '' ) ),
166
-				new EE_Meta_Capability_Map_Messages_Cap( 'ee_delete_message', array( 'Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages' ) ),
167
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_default_ticket', array( 'Ticket', '', 'ee_delete_others_default_tickets', '' ) ),
168
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question', array( 'Question', '', '', 'delete_system_questions' ) ),
169
-				new EE_Meta_Capability_Map_Registration_Form_Cap( 'ee_delete_question_group', array( 'Question_Group', '', '', 'delete_system_question_groups' ) ),
170
-				new EE_Meta_Capability_Map_Delete( 'ee_delete_payment_method', array( 'Payment_Method', '', 'ee_delete_others_payment_methods', '' ) ),
162
+				new EE_Meta_Capability_Map_Delete('ee_delete_event', array('Event', 'ee_delete_published_events', 'ee_delete_others_events', 'ee_delete_private_events')),
163
+				new EE_Meta_Capability_Map_Delete('ee_delete_venue', array('Venue', 'ee_delete_published_venues', 'ee_delete_others_venues', 'ee_delete_private_venues')),
164
+				new EE_Meta_Capability_Map_Delete('ee_delete_registration', array('Registration', '', 'ee_delete_others_registrations', '')),
165
+				new EE_Meta_Capability_Map_Delete('ee_delete_checkin', array('Registration', '', 'ee_delete_others_checkins', '')),
166
+				new EE_Meta_Capability_Map_Messages_Cap('ee_delete_message', array('Message_Template_Group', '', 'ee_delete_others_messages', 'ee_delete_global_messages')),
167
+				new EE_Meta_Capability_Map_Delete('ee_delete_default_ticket', array('Ticket', '', 'ee_delete_others_default_tickets', '')),
168
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question', array('Question', '', '', 'delete_system_questions')),
169
+				new EE_Meta_Capability_Map_Registration_Form_Cap('ee_delete_question_group', array('Question_Group', '', '', 'delete_system_question_groups')),
170
+				new EE_Meta_Capability_Map_Delete('ee_delete_payment_method', array('Payment_Method', '', 'ee_delete_others_payment_methods', '')),
171 171
 			);
172 172
 		}
173 173
 		return $default_meta_caps;
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return array   actual users capabilities
193 193
 	 */
194
-	public function map_meta_caps( $caps, $cap, $user_id, $args ) {
194
+	public function map_meta_caps($caps, $cap, $user_id, $args) {
195 195
 		//loop through our _meta_caps array
196
-		foreach ( $this->_meta_caps as $meta_map ) {
197
-			if ( ! $meta_map instanceof EE_Meta_Capability_Map ) {
196
+		foreach ($this->_meta_caps as $meta_map) {
197
+			if ( ! $meta_map instanceof EE_Meta_Capability_Map) {
198 198
 				continue;
199 199
 			}
200 200
 			$meta_map->ensure_is_model();
201 201
 
202
-			$caps = $meta_map->map_meta_caps( $caps, $cap, $user_id, $args );
202
+			$caps = $meta_map->map_meta_caps($caps, $cap, $user_id, $args);
203 203
 		}
204 204
 		return $caps;
205 205
 	}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 				)
365 365
 			);
366 366
 
367
-		$caps = apply_filters( 'FHEE__EE_Capabilities__init_caps_map__caps', $caps );
367
+		$caps = apply_filters('FHEE__EE_Capabilities__init_caps_map__caps', $caps);
368 368
 		return $caps;
369 369
 	}
370 370
 
@@ -381,26 +381,26 @@  discard block
 block discarded – undo
381 381
 	 *
382 382
 	 * @return void
383 383
 	 */
384
-	public function init_role_caps( $reset = false, $custom_map = array() ) {
384
+	public function init_role_caps($reset = false, $custom_map = array()) {
385 385
 
386
-		$caps_map = empty( $custom_map ) ? $this->_caps_map : $custom_map;
386
+		$caps_map = empty($custom_map) ? $this->_caps_map : $custom_map;
387 387
 
388 388
 		//first let's determine if these caps have already been set.
389
-		$caps_set_before = get_option( self::option_name, array() );
389
+		$caps_set_before = get_option(self::option_name, array());
390 390
 		//if not reset, see what caps are new for each role. if they're new, add them.
391
-		foreach ( $caps_map as $role => $caps_for_role ) {
392
-			foreach ( $caps_for_role as $cap ) {
391
+		foreach ($caps_map as $role => $caps_for_role) {
392
+			foreach ($caps_for_role as $cap) {
393 393
 				//first check we haven't already added this cap before, or it's a reset
394
-				if ( $reset || ! isset( $caps_set_before[ $role ] ) || ! in_array( $cap, $caps_set_before[ $role ] ) ) {
395
-					$this->add_cap_to_role( $role, $cap );
396
-					$caps_set_before[ $role ][] = $cap;
394
+				if ($reset || ! isset($caps_set_before[$role]) || ! in_array($cap, $caps_set_before[$role])) {
395
+					$this->add_cap_to_role($role, $cap);
396
+					$caps_set_before[$role][] = $cap;
397 397
 				}
398 398
 			}
399 399
 		}
400 400
 
401 401
 		//now let's just save the cap that has been set.
402
-		update_option( self::option_name, $caps_set_before );
403
-		do_action( 'AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before );
402
+		update_option(self::option_name, $caps_set_before);
403
+		do_action('AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before);
404 404
 	}
405 405
 
406 406
 
@@ -419,10 +419,10 @@  discard block
 block discarded – undo
419 419
 	 * @param bool $grant  Whether to grant access to this cap on this role.
420 420
 	 * @return void
421 421
 	 */
422
-	public function add_cap_to_role( $role, $cap, $grant = true ) {
423
-		$role = get_role( $role );
424
-		if ( $role instanceof WP_Role ) {
425
-			$role->add_cap( $cap, $grant );
422
+	public function add_cap_to_role($role, $cap, $grant = true) {
423
+		$role = get_role($role);
424
+		if ($role instanceof WP_Role) {
425
+			$role->add_cap($cap, $grant);
426 426
 		}
427 427
 	}
428 428
 
@@ -442,10 +442,10 @@  discard block
 block discarded – undo
442 442
 	 *
443 443
 	 * @return void
444 444
 	 */
445
-	public function remove_cap_from_role( $role, $cap ) {
446
-		$role = get_role( $role );
447
-		if ( $role instanceof WP_Role ) {
448
-			$role->remove_cap( $cap );
445
+	public function remove_cap_from_role($role, $cap) {
446
+		$role = get_role($role);
447
+		if ($role instanceof WP_Role) {
448
+			$role->remove_cap($cap);
449 449
 		}
450 450
 	}
451 451
 
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
 	 *
467 467
 	 * @return bool  Whether user can or not.
468 468
 	 */
469
-	public function current_user_can( $cap, $context, $id = 0 ) {
469
+	public function current_user_can($cap, $context, $id = 0) {
470 470
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
471
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap__' . $context,  $cap, $id );
472
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id );
473
-		return ! empty( $id ) ? current_user_can( $filtered_cap, $id ) : current_user_can( $filtered_cap );
471
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap__'.$context, $cap, $id);
472
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__current_user_can__cap', $filtered_cap, $context, $cap, $id);
473
+		return ! empty($id) ? current_user_can($filtered_cap, $id) : current_user_can($filtered_cap);
474 474
 	}
475 475
 
476 476
 
@@ -487,11 +487,11 @@  discard block
 block discarded – undo
487 487
 	 *
488 488
 	 * @return bool Whether user can or not.
489 489
 	 */
490
-	public function user_can( $user, $cap, $context, $id = 0 ) {
490
+	public function user_can($user, $cap, $context, $id = 0) {
491 491
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
492
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap__' . $context, $cap, $user, $id );
493
-		$filtered_cap = apply_filters( 'FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user,  $id );
494
-		return ! empty( $id ) ? user_can( $user, $filtered_cap, $id ) : user_can( $user, $filtered_cap );
492
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap__'.$context, $cap, $user, $id);
493
+		$filtered_cap = apply_filters('FHEE__EE_Capabilities__user_can__cap', $filtered_cap, $context, $cap, $user, $id);
494
+		return ! empty($id) ? user_can($user, $filtered_cap, $id) : user_can($user, $filtered_cap);
495 495
 	}
496 496
 
497 497
 
@@ -511,12 +511,12 @@  discard block
 block discarded – undo
511 511
 	 *
512 512
 	 * @return bool  Whether user can or not.
513 513
 	 */
514
-	public function current_user_can_for_blog( $blog_id, $cap, $context, $id = 0 ) {
515
-		$user_can = ! empty( $id ) ? current_user_can_for_blog( $blog_id, $cap, $id ) : current_user_can( $blog_id, $cap );
514
+	public function current_user_can_for_blog($blog_id, $cap, $context, $id = 0) {
515
+		$user_can = ! empty($id) ? current_user_can_for_blog($blog_id, $cap, $id) : current_user_can($blog_id, $cap);
516 516
 
517 517
 		//apply filters (both a global on just the cap, and context specific.  Global overrides context specific)
518
-		$user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can__' . $context, $user_can, $blog_id, $cap, $id );
519
-		$user_can = apply_filters( 'FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id );
518
+		$user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can__'.$context, $user_can, $blog_id, $cap, $id);
519
+		$user_can = apply_filters('FHEE__EE_Capabilities__current_user_can_for_blog__user_can', $user_can, $context, $blog_id, $cap, $id);
520 520
 		return $user_can;
521 521
 	}
522 522
 
@@ -532,12 +532,12 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return array
534 534
 	 */
535
-	public function get_ee_capabilities( $role = 'administrator' ) {
535
+	public function get_ee_capabilities($role = 'administrator') {
536 536
 		$capabilities = $this->_init_caps_map();
537
-		if ( empty( $role ) ) {
537
+		if (empty($role)) {
538 538
 			return $capabilities;
539 539
 		}
540
-		return isset( $capabilities[ $role ] ) ? $capabilities[ $role ] : array();
540
+		return isset($capabilities[$role]) ? $capabilities[$role] : array();
541 541
 	}
542 542
 }
543 543
 
@@ -585,11 +585,11 @@  discard block
 block discarded – undo
585 585
 	 * 	}
586 586
 	 * @throws EE_Error
587 587
 	 */
588
-	public function __construct( $meta_cap, $map_values ) {
588
+	public function __construct($meta_cap, $map_values) {
589 589
 		$this->meta_cap = $meta_cap;
590 590
 		//verify there are four args in the $map_values array;
591
-		if ( count( $map_values ) !== 4 ) {
592
-			throw new EE_Error( sprintf( __( 'Incoming $map_values array should have a count of four values in it.  This is what was given: %s', 'event_espresso' ), '<br>' . print_r( $map_values, true ) ) );
591
+		if (count($map_values) !== 4) {
592
+			throw new EE_Error(sprintf(__('Incoming $map_values array should have a count of four values in it.  This is what was given: %s', 'event_espresso'), '<br>'.print_r($map_values, true)));
593 593
 		}
594 594
 
595 595
 		//set properties
@@ -603,8 +603,8 @@  discard block
 block discarded – undo
603 603
 	/**
604 604
 	 * Makes it so this object stops filtering caps
605 605
 	 */
606
-	public function remove_filters(){
607
-		remove_filter( 'map_meta_cap', array( $this, 'map_meta_caps' ), 10 );
606
+	public function remove_filters() {
607
+		remove_filter('map_meta_cap', array($this, 'map_meta_caps'), 10);
608 608
 	}
609 609
 
610 610
 
@@ -619,19 +619,19 @@  discard block
 block discarded – undo
619 619
 	 */
620 620
 	public function ensure_is_model() {
621 621
 		//is it already instantiated?
622
-		if ( $this->_model instanceof EEM_Base ) {
622
+		if ($this->_model instanceof EEM_Base) {
623 623
 			return;
624 624
 		}
625 625
 
626 626
 		//ensure model name is string
627 627
 		$this->_model_name = (string) $this->_model_name;
628 628
 		//error proof if the name has EEM in it
629
-		$this->_model_name = str_replace( 'EEM', '', $this->_model_name );
629
+		$this->_model_name = str_replace('EEM', '', $this->_model_name);
630 630
 
631
-		$this->_model = EE_Registry::instance()->load_model( $this->_model_name );
631
+		$this->_model = EE_Registry::instance()->load_model($this->_model_name);
632 632
 
633
-		if ( ! $this->_model instanceof EEM_Base ) {
634
-			throw new EE_Error( sprintf( __( 'This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class.   Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso' ), get_class( $this ), $this->_model ) );
633
+		if ( ! $this->_model instanceof EEM_Base) {
634
+			throw new EE_Error(sprintf(__('This string passed in to %s to represent a EEM_Base model class was not able to be used to instantiate the class.   Please ensure that the string is a match for the EEM_Base model name (not including the EEM_ part). This was given: %s', 'event_espresso'), get_class($this), $this->_model));
635 635
 		}
636 636
 	}
637 637
 
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
 	 *
648 648
 	 * @return array
649 649
 	 */
650
-	public function map_meta_caps( $caps, $cap, $user_id, $args ) {
651
-		return $this->_map_meta_caps( $caps, $cap, $user_id, $args );
650
+	public function map_meta_caps($caps, $cap, $user_id, $args) {
651
+		return $this->_map_meta_caps($caps, $cap, $user_id, $args);
652 652
 	}
653 653
 
654 654
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	 *
667 667
 	 * @return array   actual users capabilities
668 668
 	 */
669
-	abstract protected function _map_meta_caps( $caps, $cap, $user_id, $args );
669
+	abstract protected function _map_meta_caps($caps, $cap, $user_id, $args);
670 670
 }
671 671
 
672 672
 
@@ -698,28 +698,28 @@  discard block
 block discarded – undo
698 698
 	 *
699 699
 	 * @return array   actual users capabilities
700 700
 	 */
701
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
701
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
702 702
 		//only process if we're checking our mapped_cap
703
-		if ( $cap !== $this->meta_cap ) {
703
+		if ($cap !== $this->meta_cap) {
704 704
 			return $caps;
705 705
 		}
706 706
 
707
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
707
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
708 708
 
709 709
 		//if no obj then let's just do cap
710
-		if ( ! $obj instanceof EE_Base_Class ) {
710
+		if ( ! $obj instanceof EE_Base_Class) {
711 711
 			$caps[] = $cap;
712 712
 			return $caps;
713 713
 		}
714 714
 
715
-		if ( $obj instanceof EE_CPT_Base ) {
715
+		if ($obj instanceof EE_CPT_Base) {
716 716
 			//if the item author is set and the user is the author...
717
-			if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
718
-				if ( empty( $this->published_cap ) ) {
717
+			if ($obj->wp_user() && $user_id == $obj->wp_user()) {
718
+				if (empty($this->published_cap)) {
719 719
 					$caps[] = $cap;
720 720
 				} else {
721 721
 					//if obj is published...
722
-					if ( $obj->status() == 'publish' ) {
722
+					if ($obj->status() == 'publish') {
723 723
 						$caps[] = $this->published_cap;
724 724
 					} else {
725 725
 						$caps[] = $cap;
@@ -727,21 +727,21 @@  discard block
 block discarded – undo
727 727
 				}
728 728
 			} else {
729 729
 				//the user is trying to edit someone else's obj
730
-				if ( ! empty( $this->others_cap ) ) {
730
+				if ( ! empty($this->others_cap)) {
731 731
 					$caps[] = $this->others_cap;
732 732
 				}
733
-				if ( ! empty( $this->published_cap ) && $obj->status() == 'publish' ) {
733
+				if ( ! empty($this->published_cap) && $obj->status() == 'publish') {
734 734
 					$caps[] = $this->published_cap;
735
-				} elseif ( ! empty( $this->private_cap ) && $obj->status() == 'private' ) {
735
+				} elseif ( ! empty($this->private_cap) && $obj->status() == 'private') {
736 736
 					$caps[] = $this->private_cap;
737 737
 				}
738 738
 			}
739 739
 		} else {
740 740
 			//not a cpt object so handled differently
741
-			if ( method_exists( $obj, 'wp_user' ) && $obj->wp_user() && $user_id == $obj->wp_user() ) {
741
+			if (method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user()) {
742 742
 				$caps[] = $cap;
743 743
 			} else {
744
-				if ( ! empty( $this->others_cap ) ) {
744
+				if ( ! empty($this->others_cap)) {
745 745
 					$caps[] = $this->others_cap;
746 746
 				}
747 747
 			}
@@ -778,8 +778,8 @@  discard block
 block discarded – undo
778 778
 	 *
779 779
 	 * @return array   actual users capabilities
780 780
 	 */
781
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
782
-		return parent::_map_meta_caps( $caps, $cap, $user_id, $args );
781
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
782
+		return parent::_map_meta_caps($caps, $cap, $user_id, $args);
783 783
 	}
784 784
 }
785 785
 
@@ -811,45 +811,45 @@  discard block
 block discarded – undo
811 811
 	 *
812 812
 	 * @return array   actual users capabilities
813 813
 	 */
814
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
814
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
815 815
 		//only process if we're checking our mapped cap;
816
-		if ( $cap !== $this->meta_cap ) {
816
+		if ($cap !== $this->meta_cap) {
817 817
 			return $caps;
818 818
 		}
819 819
 
820
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
820
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
821 821
 
822 822
 		//if no obj then let's just do cap
823
-		if ( ! $obj instanceof EE_Base_Class ) {
823
+		if ( ! $obj instanceof EE_Base_Class) {
824 824
 			$caps[] = $cap;
825 825
 			return $caps;
826 826
 		}
827 827
 
828
-		if ( $obj instanceof EE_CPT_Base ) {
829
-			$status_obj = get_post_status_object( $obj->status() );
830
-			if ( $status_obj->public ) {
828
+		if ($obj instanceof EE_CPT_Base) {
829
+			$status_obj = get_post_status_object($obj->status());
830
+			if ($status_obj->public) {
831 831
 				$caps[] = $cap;
832 832
 				return $caps;
833 833
 			}
834 834
 
835 835
 			//if the item author is set and the user is the author...
836
-			if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
836
+			if ($obj->wp_user() && $user_id == $obj->wp_user()) {
837 837
 				$caps[] = $cap;
838
-			} elseif ( $status_obj->private && ! empty( $this->private_cap ) ) {
838
+			} elseif ($status_obj->private && ! empty($this->private_cap)) {
839 839
 				//the user is trying to view someone else's obj
840 840
 				$caps[] = $this->private_cap;
841
-			} elseif ( ! empty( $this->others_cap ) ) {
841
+			} elseif ( ! empty($this->others_cap)) {
842 842
 				$caps[] = $this->others_cap;
843 843
 			} else {
844 844
 				$caps[] = $cap;
845 845
 			}
846 846
 		} else {
847 847
 			//not a cpt object so handled differently
848
-			if ( method_exists( $obj, 'wp_user' ) && $obj->wp_user() && $user_id == $obj->wp_user() ) {
848
+			if (method_exists($obj, 'wp_user') && $obj->wp_user() && $user_id == $obj->wp_user()) {
849 849
 				$caps[] = $cap;
850
-			} elseif ( ! empty( $this->private_cap ) ) {
850
+			} elseif ( ! empty($this->private_cap)) {
851 851
 				$caps[] = $this->private_cap;
852
-			} elseif ( ! empty( $this->others_cap ) ) {
852
+			} elseif ( ! empty($this->others_cap)) {
853 853
 				$caps[] = $this->others_cap;
854 854
 			} else {
855 855
 				$caps[] = $cap;
@@ -886,30 +886,30 @@  discard block
 block discarded – undo
886 886
 	 *
887 887
 	 * @return array   actual users capabilities
888 888
 	 */
889
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
889
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
890 890
 		//only process if we're checking our mapped_cap
891
-		if ( $cap !== $this->meta_cap ) {
891
+		if ($cap !== $this->meta_cap) {
892 892
 			return $caps;
893 893
 		}
894 894
 
895
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
895
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
896 896
 
897 897
 		//if no obj then let's just do cap
898
-		if ( ! $obj instanceof EE_Message_Template_Group ) {
898
+		if ( ! $obj instanceof EE_Message_Template_Group) {
899 899
 			$caps[] = $cap;
900 900
 			return $caps;
901 901
 		}
902 902
 
903 903
 		$is_global = $obj->is_global();
904 904
 
905
-		if ( $obj->wp_user() && $user_id == $obj->wp_user() ) {
906
-			if ( $is_global ) {
907
-				$caps[]  = $this->private_cap;
905
+		if ($obj->wp_user() && $user_id == $obj->wp_user()) {
906
+			if ($is_global) {
907
+				$caps[] = $this->private_cap;
908 908
 			} else {
909 909
 				$caps[] = $cap;
910 910
 			}
911 911
 		} else {
912
-			if ( $is_global ) {
912
+			if ($is_global) {
913 913
 				$caps[] = $this->private_cap;
914 914
 			} else {
915 915
 				$caps[] = $this->others_cap;
@@ -947,16 +947,16 @@  discard block
 block discarded – undo
947 947
 	 *
948 948
 	 * @return array   actual users capabilities
949 949
 	 */
950
-	protected function _map_meta_caps( $caps, $cap, $user_id, $args ) {
950
+	protected function _map_meta_caps($caps, $cap, $user_id, $args) {
951 951
 		//only process if we're checking our mapped_cap
952
-		if ( $cap !== $this->meta_cap ) {
952
+		if ($cap !== $this->meta_cap) {
953 953
 			return $caps;
954 954
 		}
955 955
 
956
-		$obj = ! empty( $args[0] ) ? $this->_model->get_one_by_ID( $args[0] ) : null;
956
+		$obj = ! empty($args[0]) ? $this->_model->get_one_by_ID($args[0]) : null;
957 957
 
958 958
 		//if no obj then let's just do cap
959
-		if ( ! $obj instanceof EE_Base_Class ) {
959
+		if ( ! $obj instanceof EE_Base_Class) {
960 960
 			$caps[] = $cap;
961 961
 			return $caps;
962 962
 		}
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 		$is_system = $obj instanceof EE_Question_Group ? $obj->system_group() : false;
965 965
 		$is_system = $obj instanceof EE_Question ? $obj->is_system_question() : $is_system;
966 966
 
967
-		if ( $is_system ) {
967
+		if ($is_system) {
968 968
 			$caps[] = $this->private_cap;
969 969
 		} else {
970 970
 			$caps[] = $cap;
Please login to merge, or discard this patch.
core/EE_Error.core.php 1 patch
Spacing   +236 added lines, -236 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE );
3
-if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) {
4
-	set_error_handler( array( 'EE_Error', 'error_handler' ));
5
-	register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' ));
3
+if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) {
4
+	set_error_handler(array('EE_Error', 'error_handler'));
5
+	register_shutdown_function(array('EE_Error', 'fatal_error_handler'));
6 6
 }
7 7
 /**
8 8
  *
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	* 	@access	private
65 65
     *	@var boolean
66 66
 	*/
67
-	private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE );
67
+	private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE);
68 68
 
69 69
 
70 70
 
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 	*	@access public
76 76
 	*	@echo string
77 77
 	*/
78
-	function __construct( $message, $code = 0, Exception $previous = NULL ) {
79
-		if ( version_compare( phpversion(), '5.3.0', '<' )) {
80
-			parent::__construct( $message, $code );
78
+	function __construct($message, $code = 0, Exception $previous = NULL) {
79
+		if (version_compare(phpversion(), '5.3.0', '<')) {
80
+			parent::__construct($message, $code);
81 81
 		} else {
82
-			parent::__construct( $message, $code, $previous );
82
+			parent::__construct($message, $code, $previous);
83 83
 		}
84 84
 	}
85 85
 
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 	 * @param $line
95 95
 	 * @return void
96 96
 	 */
97
-	public static function error_handler( $code, $message, $file, $line ) {
98
-		$type = EE_Error::error_type( $code );
97
+	public static function error_handler($code, $message, $file, $line) {
98
+		$type = EE_Error::error_type($code);
99 99
 		$site = site_url();
100
-		switch ( $site ) {
100
+		switch ($site) {
101 101
 			case 'http://ee4.eventespresso.com/' :
102 102
 			case 'http://ee4decaf.eventespresso.com/' :
103 103
 			case 'http://ee4hf.eventespresso.com/' :
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 				$to = '[email protected]';
111 111
 				break;
112 112
 			default :
113
-				$to = get_option( 'admin_email' );
113
+				$to = get_option('admin_email');
114 114
 		}
115
-		$subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url();
116
-		$msg = EE_Error::_format_error( $type, $message, $file, $line );
117
-		if ( function_exists( 'wp_mail' )) {
118
-			add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));
119
-			wp_mail( $to, $subject, $msg );
115
+		$subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url();
116
+		$msg = EE_Error::_format_error($type, $message, $file, $line);
117
+		if (function_exists('wp_mail')) {
118
+			add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type'));
119
+			wp_mail($to, $subject, $msg);
120 120
 		}
121 121
 		echo '<div id="message" class="espresso-notices error"><p>';
122
-		echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line;
122
+		echo $type.': '.$message.'<br />'.$file.' line '.$line;
123 123
 		echo '<br /></p></div>';
124 124
 	}
125 125
 
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param $code
133 133
 	 * @return string
134 134
 	 */
135
-	public static function error_type( $code ) {
136
-		switch( $code ) {
135
+	public static function error_type($code) {
136
+		switch ($code) {
137 137
 			case E_ERROR: // 1 //
138 138
 			return 'E_ERROR';
139 139
 			case E_WARNING: // 2 //
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	*/
180 180
 	public static function fatal_error_handler() {
181 181
 		$last_error = error_get_last();
182
-		if ( $last_error['type'] === E_ERROR ) {
183
-			EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] );
182
+		if ($last_error['type'] === E_ERROR) {
183
+			EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
184 184
 		}
185 185
 	}
186 186
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @param $line
196 196
 	 * @return string
197 197
 	 */
198
-	private static function _format_error( $code, $message, $file, $line ) {
198
+	private static function _format_error($code, $message, $file, $line) {
199 199
 		$html  = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>";
200 200
 		$html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>";
201 201
 		$html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>";
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @param $content_type
214 214
 	 * @return string
215 215
 	 */
216
-	public static function set_content_type( $content_type ) {
216
+	public static function set_content_type($content_type) {
217 217
 		return 'text/html';
218 218
 	}
219 219
 
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	*/
228 228
     public function get_error() {
229 229
 
230
-		if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){
230
+		if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) {
231 231
 			throw $this;
232 232
 		}
233 233
 		// get separate user and developer messages if they exist
234
-		$msg = explode( '||', $this->getMessage() );
234
+		$msg = explode('||', $this->getMessage());
235 235
 		$user_msg = $msg[0];
236
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
236
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
237 237
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
238 238
 
239 239
 		// add details to _all_exceptions array
240 240
 		$x_time = time();
241
-		self::$_all_exceptions[ $x_time ]['name'] 	= get_class( $this );
242
-		self::$_all_exceptions[ $x_time ]['file'] 		= $this->getFile();
243
-		self::$_all_exceptions[ $x_time ]['line'] 		= $this->getLine();
244
-		self::$_all_exceptions[ $x_time ]['msg'] 	= $msg;
245
-		self::$_all_exceptions[ $x_time ]['code'] 	= $this->getCode();
246
-		self::$_all_exceptions[ $x_time ]['trace'] 	= $this->getTrace();
247
-		self::$_all_exceptions[ $x_time ]['string'] 	= $this->getTraceAsString();
241
+		self::$_all_exceptions[$x_time]['name'] = get_class($this);
242
+		self::$_all_exceptions[$x_time]['file'] 		= $this->getFile();
243
+		self::$_all_exceptions[$x_time]['line'] 		= $this->getLine();
244
+		self::$_all_exceptions[$x_time]['msg'] = $msg;
245
+		self::$_all_exceptions[$x_time]['code'] = $this->getCode();
246
+		self::$_all_exceptions[$x_time]['trace'] 	= $this->getTrace();
247
+		self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString();
248 248
 		self::$_error_count++;
249 249
 
250 250
 		//add_action( 'shutdown', array( $this, 'display_errors' ));
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	*	@access public
260 260
 	*	@return boolean
261 261
 	*/
262
-    public static function has_error(){
262
+    public static function has_error() {
263 263
 		return self::$_error_count ? TRUE : FALSE;
264 264
 	}
265 265
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	*	@access public
271 271
 	*	@echo string
272 272
 	*/
273
-    public function display_errors(){
273
+    public function display_errors() {
274 274
 
275 275
 		$trace_details = '';
276 276
 
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
 </style>
332 332
 <div id="ee-error-message" class="error">';
333 333
 
334
-		if ( ! WP_DEBUG ) {
334
+		if ( ! WP_DEBUG) {
335 335
 			$output .= '
336 336
 	<p>';
337 337
 		}
338 338
 
339 339
 		// cycle thru errors
340
-		foreach ( self::$_all_exceptions as $time => $ex ) {
340
+		foreach (self::$_all_exceptions as $time => $ex) {
341 341
 
342 342
 			// process trace info
343
-			if ( empty( $ex['trace'] )) {
343
+			if (empty($ex['trace'])) {
344 344
 
345
-	            $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
345
+	            $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso');
346 346
 
347 347
 			} else {
348 348
 
@@ -357,50 +357,50 @@  discard block
 block discarded – undo
357 357
 					<th scope="col" align="left">Method( arguments )</th>
358 358
 				</tr>';
359 359
 
360
-				$last_on_stack = count( $ex['trace'] ) - 1;
360
+				$last_on_stack = count($ex['trace']) - 1;
361 361
 				// reverse array so that stack is in proper chronological order
362
-				$sorted_trace = array_reverse( $ex['trace'] );
362
+				$sorted_trace = array_reverse($ex['trace']);
363 363
 
364
-				foreach ( $sorted_trace as $nmbr => $trace ) {
364
+				foreach ($sorted_trace as $nmbr => $trace) {
365 365
 
366
-					$file = isset( $trace['file'] ) ? $trace['file'] : '' ;
367
-					$class = isset( $trace['class'] ) ? $trace['class'] : '';
368
-					$type = isset( $trace['type'] ) ? $trace['type'] : '';
369
-					$function = isset( $trace['function'] ) ? $trace['function'] : '';
370
-					$args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : '';
371
-					$line = isset( $trace['line'] ) ? $trace['line'] : '';
366
+					$file = isset($trace['file']) ? $trace['file'] : '';
367
+					$class = isset($trace['class']) ? $trace['class'] : '';
368
+					$type = isset($trace['type']) ? $trace['type'] : '';
369
+					$function = isset($trace['function']) ? $trace['function'] : '';
370
+					$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
371
+					$line = isset($trace['line']) ? $trace['line'] : '';
372 372
 					$zebra = $nmbr % 2 ? ' odd' : '';
373 373
 
374
-					if ( empty( $file ) && ! empty( $class )) {
375
-						$a = new ReflectionClass( $class );
374
+					if (empty($file) && ! empty($class)) {
375
+						$a = new ReflectionClass($class);
376 376
 						$file = $a->getFileName();
377
-						if ( empty( $line ) && ! empty( $function )) {
378
-							$b = new ReflectionMethod( $class, $function );
377
+						if (empty($line) && ! empty($function)) {
378
+							$b = new ReflectionMethod($class, $function);
379 379
 							$line = $b->getStartLine();
380 380
 						}
381 381
 					}
382 382
 
383
-					if ( $nmbr == $last_on_stack ) {
383
+					if ($nmbr == $last_on_stack) {
384 384
 						$file = $ex['file'] != '' ? $ex['file'] : $file;
385 385
 						$line = $ex['line'] != '' ? $ex['line'] : $line;
386
-						$error_code = self::generate_error_code ( $file, $trace['function'], $line );
386
+						$error_code = self::generate_error_code($file, $trace['function'], $line);
387 387
 					}
388 388
 
389
-					$nmbr_dsply = ! empty( $nmbr ) ? $nmbr : '&nbsp;';
390
-					$line_dsply = ! empty( $line ) ? $line : '&nbsp;';
391
-					$file_dsply = ! empty( $file ) ? $file : '&nbsp;';
392
-					$class_dsply = ! empty( $class ) ? $class : '&nbsp;';
393
-					$type_dsply = ! empty( $type ) ? $type : '&nbsp;';
394
-					$function_dsply = ! empty( $function ) ? $function : '&nbsp;';
395
-					$args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : '';
389
+					$nmbr_dsply = ! empty($nmbr) ? $nmbr : '&nbsp;';
390
+					$line_dsply = ! empty($line) ? $line : '&nbsp;';
391
+					$file_dsply = ! empty($file) ? $file : '&nbsp;';
392
+					$class_dsply = ! empty($class) ? $class : '&nbsp;';
393
+					$type_dsply = ! empty($type) ? $type : '&nbsp;';
394
+					$function_dsply = ! empty($function) ? $function : '&nbsp;';
395
+					$args_dsply = ! empty($args) ? '( '.$args.' )' : '';
396 396
 
397 397
 		              $trace_details .= '
398 398
 					<tr>
399
-						<td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td>
400
-						<td align="right" class="' . $zebra . '">' . $line_dsply . '</td>
401
-						<td align="left" class="' . $zebra . '">' . $file_dsply . '</td>
402
-						<td align="left" class="' . $zebra . '">' . $class_dsply . '</td>
403
-						<td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td>
399
+						<td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td>
400
+						<td align="right" class="' . $zebra.'">'.$line_dsply.'</td>
401
+						<td align="left" class="' . $zebra.'">'.$file_dsply.'</td>
402
+						<td align="left" class="' . $zebra.'">'.$class_dsply.'</td>
403
+						<td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td>
404 404
 					</tr>';
405 405
 
406 406
 
@@ -415,9 +415,9 @@  discard block
 block discarded – undo
415 415
 			$ex['code'] = $ex['code'] ? $ex['code'] : $error_code;
416 416
 
417 417
 			// add generic non-identifying messages for non-privileged uesrs
418
-			if ( ! WP_DEBUG ) {
418
+			if ( ! WP_DEBUG) {
419 419
 
420
-				$output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] )  . '</span> &nbsp; <sup>' . $ex['code'] . '</sup><br />';
420
+				$output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> &nbsp; <sup>'.$ex['code'].'</sup><br />';
421 421
 
422 422
 			} else {
423 423
 
@@ -425,24 +425,24 @@  discard block
 block discarded – undo
425 425
 				$output .= '
426 426
 		<div class="ee-error-dev-msg-dv">
427 427
 			<p class="ee-error-dev-msg-pg">
428
-				<strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong>  &nbsp; <span>code: ' . $ex['code'] . '</span><br />
429
-				<span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/>
430
-				<a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '">
431
-					' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . '
428
+				<strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong>  &nbsp; <span>code: '.$ex['code'].'</span><br />
429
+				<span class="big-text">"' . trim($ex['msg']).'"</span><br/>
430
+				<a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'">
431
+					' . __('click to view backtrace and class/method details', 'event_espresso').'
432 432
 				</a><br />
433 433
 				<span class="small-text lt-grey-text">'.$ex['file'].' &nbsp; ( line no: '.$ex['line'].' )</span>
434 434
 			</p>
435
-			<div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;">
435
+			<div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;">
436 436
 				' . $trace_details;
437 437
 
438
-				if ( ! empty( $class )) {
438
+				if ( ! empty($class)) {
439 439
 					$output .= '
440 440
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;">
441 441
 					<div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;">
442 442
 						<h3>Class Details</h3>';
443
-						$a = new ReflectionClass( $class );
443
+						$a = new ReflectionClass($class);
444 444
 						$output .= '
445
-						<pre>' . $a . '</pre>
445
+						<pre>' . $a.'</pre>
446 446
 					</div>
447 447
 				</div>';
448 448
 				}
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 
455 455
 			}
456 456
 
457
-			$this->write_to_error_log( $time, $ex );
457
+			$this->write_to_error_log($time, $ex);
458 458
 
459 459
 		}
460 460
 
461 461
 		// remove last linebreak
462
-		$output = substr( $output, 0, ( count( $output ) - 7 ));
462
+		$output = substr($output, 0, (count($output) - 7));
463 463
 
464
-		if ( ! WP_DEBUG ) {
464
+		if ( ! WP_DEBUG) {
465 465
 			$output .= '
466 466
 	</p>';
467 467
 		}
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 		$output .= '
470 470
 </div>';
471 471
 
472
-		$output .= self::_print_scripts( TRUE );
472
+		$output .= self::_print_scripts(TRUE);
473 473
 
474
-		if ( defined( 'DOING_AJAX' )) {
475
-			echo json_encode( array( 'error' => $output ));
474
+		if (defined('DOING_AJAX')) {
475
+			echo json_encode(array('error' => $output));
476 476
 			exit();
477 477
 		}
478 478
 
@@ -492,29 +492,29 @@  discard block
 block discarded – undo
492 492
 	*	@ param array $arguments
493 493
 	*	@ return string
494 494
 	*/
495
-	private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) {
495
+	private function _convert_args_to_string($arguments = array(), $array = FALSE) {
496 496
 
497 497
 		$arg_string = '';
498
-		if ( ! empty( $arguments )) {
498
+		if ( ! empty($arguments)) {
499 499
 
500 500
 			$args = array();
501 501
 
502
-			foreach ( $arguments as $arg ) {
502
+			foreach ($arguments as $arg) {
503 503
 
504
-				if ( ! empty( $arg )) {
504
+				if ( ! empty($arg)) {
505 505
 
506
-					if ( is_string( $arg )) {
507
-						$args[] = " '" . $arg . "'";
508
-					} elseif ( is_array( $arg )) {
509
-						$args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE );
510
-					} elseif ( is_null( $arg )) {
506
+					if (is_string($arg)) {
507
+						$args[] = " '".$arg."'";
508
+					} elseif (is_array($arg)) {
509
+						$args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE);
510
+					} elseif (is_null($arg)) {
511 511
 						$args[] = ' NULL';
512
-					} elseif ( is_bool( $arg )) {
513
-						$args[] = ( $arg ) ? ' TRUE' : ' FALSE';
514
-					} elseif ( is_object( $arg )) {
515
-						$args[] = ' OBJECT ' . get_class( $arg );
516
-					} elseif ( is_resource( $arg )) {
517
-						$args[] = get_resource_type( $arg );
512
+					} elseif (is_bool($arg)) {
513
+						$args[] = ($arg) ? ' TRUE' : ' FALSE';
514
+					} elseif (is_object($arg)) {
515
+						$args[] = ' OBJECT '.get_class($arg);
516
+					} elseif (is_resource($arg)) {
517
+						$args[] = get_resource_type($arg);
518 518
 					} else {
519 519
 						$args[] = $arg;
520 520
 					}
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 				}
523 523
 
524 524
 			}
525
-			$arg_string = implode( ', ', $args );
525
+			$arg_string = implode(', ', $args);
526 526
 		}
527
-		if ( $array ) {
527
+		if ($array) {
528 528
 			$arg_string .= ' )';
529 529
 		}
530 530
 		return $arg_string;
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
545 545
 	* 	@return 		void
546 546
 	*/
547
-	public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
548
-		self::_add_notice ( 'errors', $msg, $file, $func, $line );
547
+	public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
548
+		self::_add_notice('errors', $msg, $file, $func, $line);
549 549
 		self::$_error_count++;
550 550
 	}
551 551
 
@@ -563,8 +563,8 @@  discard block
 block discarded – undo
563 563
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
564 564
 	* 	@return 		void
565 565
 	*/
566
-	public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
567
-		self::_add_notice ( 'success', $msg, $file, $func, $line );
566
+	public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
567
+		self::_add_notice('success', $msg, $file, $func, $line);
568 568
 	}
569 569
 
570 570
 
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
582 582
 	* 	@return 		void
583 583
 	*/
584
-	public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
585
-		self::_add_notice ( 'attention', $msg, $file, $func, $line );
584
+	public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
585
+		self::_add_notice('attention', $msg, $file, $func, $line);
586 586
 	}
587 587
 
588 588
 
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
601 601
 	* 	@return 		void
602 602
 	*/
603
-	private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
604
-		if ( empty( $msg )) {
603
+	private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
604
+		if (empty($msg)) {
605 605
 			EE_Error::doing_it_wrong(
606
-				'EE_Error::add_' . $type . '()',
606
+				'EE_Error::add_'.$type.'()',
607 607
 				sprintf(
608
-					__( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ),
608
+					__('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'),
609 609
 					$type,
610 610
 					$file,
611 611
 					$line
@@ -613,27 +613,27 @@  discard block
 block discarded – undo
613 613
 				EVENT_ESPRESSO_VERSION
614 614
 			);
615 615
 		}
616
-		if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) {
616
+		if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) {
617 617
 			EE_Error::doing_it_wrong(
618 618
 				'EE_Error::add_error()',
619
-				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ),
619
+				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'),
620 620
 				EVENT_ESPRESSO_VERSION
621 621
 			);
622 622
 		}
623 623
 		// get separate user and developer messages if they exist
624
-		$msg = explode( '||', $msg );
624
+		$msg = explode('||', $msg);
625 625
 		$user_msg = $msg[0];
626
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
626
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
627 627
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
628 628
 		// add notice if message exists
629
-		if ( ! empty( $msg )) {
629
+		if ( ! empty($msg)) {
630 630
 			// get error code, but only on error
631
-			if ( WP_DEBUG && $type == 'errors' ) {
632
-				$msg .= '<br/><span class="tiny-text">' . EE_Error::generate_error_code( $file, $func, $line ) . '</span>';
631
+			if (WP_DEBUG && $type == 'errors') {
632
+				$msg .= '<br/><span class="tiny-text">'.EE_Error::generate_error_code($file, $func, $line).'</span>';
633 633
 			}
634 634
 			// add notice
635
-			self::$_espresso_notices[ $type ][] = $msg;
636
-			add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 );
635
+			self::$_espresso_notices[$type][] = $msg;
636
+			add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1);
637 637
 		}
638 638
 
639 639
 	}
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 	*	@access private
688 688
 	*	@return void
689 689
 	*/
690
-	public static function reset_notices(){
690
+	public static function reset_notices() {
691 691
     	self::$_espresso_notices['success'] = FALSE;
692 692
     	self::$_espresso_notices['attention'] = FALSE;
693 693
     	self::$_espresso_notices['errors'] = FALSE;
@@ -700,14 +700,14 @@  discard block
 block discarded – undo
700 700
 	*	@access public
701 701
 	*	@return int
702 702
 	*/
703
-    public static function has_notices(){
703
+    public static function has_notices() {
704 704
 		$has_notices = 0;
705 705
 		// check for success messages
706
-		$has_notices = self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] ) ? 3 : $has_notices;
706
+		$has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices;
707 707
 		// check for attention messages
708
-		$has_notices = self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ? 2 : $has_notices;
708
+		$has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices;
709 709
 		// check for error messages
710
-		$has_notices = self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ? 1 : $has_notices;
710
+		$has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices;
711 711
 		return $has_notices;
712 712
 	}
713 713
 
@@ -722,9 +722,9 @@  discard block
 block discarded – undo
722 722
 	 */
723 723
 	public static function get_vanilla_notices() {
724 724
 		return array(
725
-			'success' => isset( self::$_espresso_notices['success'] ) ? self::$_espresso_notices['success'] : array(),
726
-			'attention' => isset( self::$_espresso_notices['attention'] )  ? self::$_espresso_notices['attention'] : array(),
727
-			'errors' => isset( self::$_espresso_notices['errors'] ) ? self::$_espresso_notices['errors'] : array(),
725
+			'success' => isset(self::$_espresso_notices['success']) ? self::$_espresso_notices['success'] : array(),
726
+			'attention' => isset(self::$_espresso_notices['attention']) ? self::$_espresso_notices['attention'] : array(),
727
+			'errors' => isset(self::$_espresso_notices['errors']) ? self::$_espresso_notices['errors'] : array(),
728 728
 		);
729 729
 	}
730 730
 
@@ -739,8 +739,8 @@  discard block
 block discarded – undo
739 739
 	* 	@param		boolean		$remove_empty		whether or not to unset empty messages
740 740
 	* 	@return 		array
741 741
 	*/
742
-	public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) {
743
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
742
+	public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) {
743
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
744 744
 
745 745
 		$success_messages = '';
746 746
 		$attention_messages = '';
@@ -750,44 +750,44 @@  discard block
 block discarded – undo
750 750
 		// EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
751 751
 
752 752
 		// either save notices to the db
753
-		if ( $save_to_transient ) {
754
-			update_option( 'ee_notices', self::$_espresso_notices );
753
+		if ($save_to_transient) {
754
+			update_option('ee_notices', self::$_espresso_notices);
755 755
 			return;
756 756
 		}
757 757
 		// grab any notices that have been previously saved
758
-		if ( $notices = get_option( 'ee_notices', FALSE )) {
759
-			foreach ( $notices as $type => $notice ) {
760
-				if ( is_array( $notice ) && ! empty( $notice )) {
758
+		if ($notices = get_option('ee_notices', FALSE)) {
759
+			foreach ($notices as $type => $notice) {
760
+				if (is_array($notice) && ! empty($notice)) {
761 761
 					// make sure that existsing notice type is an array
762
-					self::$_espresso_notices[ $type ] =  is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array();
762
+					self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array();
763 763
 					// merge stored notices with any newly created ones
764
-					self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice );
764
+					self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice);
765 765
 					$print_scripts = TRUE;
766 766
 				}
767 767
 			}
768 768
 			// now clear any stored notices
769
-			update_option( 'ee_notices', FALSE );
769
+			update_option('ee_notices', FALSE);
770 770
 		}
771 771
 
772 772
 		// check for success messages
773
-		if ( self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] )) {
773
+		if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) {
774 774
 			// combine messages
775
-			$success_messages .= implode( self::$_espresso_notices['success'], '<br />' );
775
+			$success_messages .= implode(self::$_espresso_notices['success'], '<br />');
776 776
 			$print_scripts = TRUE;
777 777
 		}
778 778
 
779 779
 		// check for attention messages
780
-		if ( self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ) {
780
+		if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) {
781 781
 			// combine messages
782
-			$attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' );
782
+			$attention_messages .= implode(self::$_espresso_notices['attention'], '<br />');
783 783
 			$print_scripts = TRUE;
784 784
 		}
785 785
 
786 786
 		// check for error messages
787
-		if ( self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ) {
788
-			$error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' );
787
+		if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) {
788
+			$error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso');
789 789
 			// combine messages
790
-			$error_messages .= implode( self::$_espresso_notices['errors'], '<br />' );
790
+			$error_messages .= implode(self::$_espresso_notices['errors'], '<br />');
791 791
 			$print_scripts = TRUE;
792 792
 		}
793 793
 
@@ -801,21 +801,21 @@  discard block
 block discarded – undo
801 801
 				$css_id = is_admin() ? 'message' : 'espresso-notices-success';
802 802
 				$css_class = is_admin() ? 'updated fade' : 'success fade-away';
803 803
 				//showMessage( $success_messages );
804
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>';
804
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>';
805 805
 			}
806 806
 
807 807
 			if ($attention_messages != '') {
808 808
 				$css_id = is_admin() ? 'message' : 'espresso-notices-attention';
809 809
 				$css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away';
810 810
 				//showMessage( $error_messages, TRUE );
811
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>';
811
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>';
812 812
 			}
813 813
 
814 814
 			if ($error_messages != '') {
815 815
 				$css_id = is_admin() ? 'message' : 'espresso-notices-error';
816 816
 				$css_class = is_admin() ? 'error' : 'error fade-away';
817 817
 				//showMessage( $error_messages, TRUE );
818
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>';
818
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>';
819 819
 			}
820 820
 
821 821
 			$notices .= '</div>';
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 					'errors' => $error_messages
829 829
 			);
830 830
 
831
-			if ( $remove_empty ) {
831
+			if ($remove_empty) {
832 832
 				// remove empty notices
833 833
 				foreach ($notices as $type => $notice) {
834 834
 					if (empty($notice)) {
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 			}
839 839
 		}
840 840
 
841
-		if ( $print_scripts ) {
841
+		if ($print_scripts) {
842 842
 			self::_print_scripts();
843 843
 		}
844 844
 
@@ -858,17 +858,17 @@  discard block
 block discarded – undo
858 858
 	* 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
859 859
 	* 	@return 		void
860 860
 	*/
861
-	public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) {
862
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
863
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
861
+	public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) {
862
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
863
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
864 864
 			//maybe initialize persistent_admin_notices
865
-			if ( empty( $persistent_admin_notices )) {
866
-				add_option( 'ee_pers_admin_notices', array(), '', 'no' );
865
+			if (empty($persistent_admin_notices)) {
866
+				add_option('ee_pers_admin_notices', array(), '', 'no');
867 867
 			}
868
-			$pan_name = sanitize_key( $pan_name );
869
-			if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) {
870
-				$persistent_admin_notices[ $pan_name ] = $pan_message;
871
-				update_option( 'ee_pers_admin_notices', $persistent_admin_notices );
868
+			$pan_name = sanitize_key($pan_name);
869
+			if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) {
870
+				$persistent_admin_notices[$pan_name] = $pan_message;
871
+				update_option('ee_pers_admin_notices', $persistent_admin_notices);
872 872
 			}
873 873
 		}
874 874
 	}
@@ -884,34 +884,34 @@  discard block
 block discarded – undo
884 884
 	 * @param bool          $return_immediately
885 885
 	 * @return        void
886 886
 	 */
887
-	public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) {
888
-		$pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name;
889
-		if ( ! empty( $pan_name )) {
890
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
887
+	public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) {
888
+		$pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name;
889
+		if ( ! empty($pan_name)) {
890
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
891 891
 			// check if notice we wish to dismiss is actually in the $persistent_admin_notices array
892
-			if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) {
892
+			if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) {
893 893
 				// completely delete nag notice, or just NULL message so that it can NOT be added again ?
894
-				if ( $purge ) {
895
-					unset( $persistent_admin_notices[ $pan_name ] );
894
+				if ($purge) {
895
+					unset($persistent_admin_notices[$pan_name]);
896 896
 				} else {
897
-					$persistent_admin_notices[ $pan_name ] = NULL;
897
+					$persistent_admin_notices[$pan_name] = NULL;
898 898
 				}
899
-				if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) {
900
-					EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ );
899
+				if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) {
900
+					EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__);
901 901
 				}
902 902
 			}
903 903
 		}
904
-		if ( $return_immediately ) {
904
+		if ($return_immediately) {
905 905
 			return;
906
-		} else if ( EE_Registry::instance()->REQ->ajax ) {
906
+		} else if (EE_Registry::instance()->REQ->ajax) {
907 907
 			// grab any notices and concatenate into string
908
-			echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE ))));
908
+			echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE))));
909 909
 			exit();
910 910
 		} else {
911 911
 			// save errors to a transient to be displayed on next request (after redirect)
912
-			EE_Error::get_notices( FALSE, TRUE );
913
-			$return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : '';
914
-			wp_safe_redirect( urldecode( $return_url ));
912
+			EE_Error::get_notices(FALSE, TRUE);
913
+			$return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : '';
914
+			wp_safe_redirect(urldecode($return_url));
915 915
 		}
916 916
 	}
917 917
 
@@ -926,20 +926,20 @@  discard block
 block discarded – undo
926 926
 	* 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
927 927
 	 *  	@return 		string
928 928
 	 */
929
-	public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) {
930
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
929
+	public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') {
930
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
931 931
 			$args = array(
932 932
 				'nag_notice' => $pan_name,
933
-				'return_url' => urlencode( $return_url ),
933
+				'return_url' => urlencode($return_url),
934 934
 				'ajax_url' => WP_AJAX_URL,
935
-				'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' )
935
+				'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso')
936 936
 			);
937
-			wp_localize_script( 'espresso_core', 'ee_dismiss', $args );
937
+			wp_localize_script('espresso_core', 'ee_dismiss', $args);
938 938
 			return '
939
-			<div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
940
-				<p>' . $pan_message . '</p>
941
-				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '">
942
-					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .'
939
+			<div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
940
+				<p>' . $pan_message.'</p>
941
+				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'">
942
+					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').'
943 943
 				</a>
944 944
 				<div style="clear:both;"></div>
945 945
 			</div>';
@@ -955,17 +955,17 @@  discard block
 block discarded – undo
955 955
 	 * @param string $return_url
956 956
 	 * @return    array
957 957
 	 */
958
-	public static function get_persistent_admin_notices( $return_url = '' ) {
958
+	public static function get_persistent_admin_notices($return_url = '') {
959 959
 		$notices = '';
960 960
 		// check for persistent admin notices
961
-		if ( $persistent_admin_notices = get_option( 'ee_pers_admin_notices', FALSE )) {
961
+		if ($persistent_admin_notices = get_option('ee_pers_admin_notices', FALSE)) {
962 962
 			// load scripts
963
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
964
-			wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE );
965
-			wp_enqueue_script( 'ee_error_js' );
963
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
964
+			wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE);
965
+			wp_enqueue_script('ee_error_js');
966 966
 			// and display notices
967
-			foreach( $persistent_admin_notices as $pan_name => $pan_message ) {
968
-				$notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url );
967
+			foreach ($persistent_admin_notices as $pan_name => $pan_message) {
968
+				$notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url);
969 969
 			}
970 970
 		}
971 971
 		return $notices;
@@ -980,26 +980,26 @@  discard block
 block discarded – undo
980 980
 	 * @param 	bool $force_print
981 981
 	 * @return 	void
982 982
 	 */
983
-	private static function _print_scripts( $force_print = FALSE ) {
984
-		if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) {
985
-			if ( wp_script_is( 'ee_error_js', 'enqueued' )) {
983
+	private static function _print_scripts($force_print = FALSE) {
984
+		if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) {
985
+			if (wp_script_is('ee_error_js', 'enqueued')) {
986 986
 				return;
987
-			} else if ( wp_script_is( 'ee_error_js', 'registered' )) {
988
-				add_filter( 'FHEE_load_css', '__return_true' );
989
-				add_filter( 'FHEE_load_js', '__return_true' );
990
-				wp_enqueue_script( 'ee_error_js' );
991
-				wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG ));
987
+			} else if (wp_script_is('ee_error_js', 'registered')) {
988
+				add_filter('FHEE_load_css', '__return_true');
989
+				add_filter('FHEE_load_js', '__return_true');
990
+				wp_enqueue_script('ee_error_js');
991
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG));
992 992
 			}
993 993
 		} else {
994 994
 			return '
995 995
 <script>
996 996
 /* <![CDATA[ */
997
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
997
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
998 998
 /* ]]> */
999 999
 </script>
1000
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
1001
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
1002
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
1000
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
1001
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
1002
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
1003 1003
 ';
1004 1004
 
1005 1005
 		}
@@ -1033,11 +1033,11 @@  discard block
 block discarded – undo
1033 1033
 	*	@ param string $line
1034 1034
 	*	@ return string
1035 1035
 	*/
1036
-	public static function generate_error_code ( $file = '', $func = '', $line = '' ) {
1037
-		$file = explode( '.', basename( $file ));
1038
-		$error_code = ! empty( $file[0] ) ? $file[0] : '';
1039
-		$error_code .= ! empty( $func ) ? ' - ' . $func : '';
1040
-		$error_code .= ! empty( $line ) ? ' - ' . $line : '';
1036
+	public static function generate_error_code($file = '', $func = '', $line = '') {
1037
+		$file = explode('.', basename($file));
1038
+		$error_code = ! empty($file[0]) ? $file[0] : '';
1039
+		$error_code .= ! empty($func) ? ' - '.$func : '';
1040
+		$error_code .= ! empty($line) ? ' - '.$line : '';
1041 1041
 		return $error_code;
1042 1042
 	}
1043 1043
 
@@ -1053,37 +1053,37 @@  discard block
 block discarded – undo
1053 1053
 	*	@ param object $ex
1054 1054
 	*	@ return void
1055 1055
 	*/
1056
-	public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) {
1056
+	public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) {
1057 1057
 
1058
-		if ( ! $ex ) {
1058
+		if ( ! $ex) {
1059 1059
 			return;
1060 1060
 		}
1061 1061
 
1062
-		if ( ! $time ) {
1062
+		if ( ! $time) {
1063 1063
 			$time = time();
1064 1064
 		}
1065 1065
 
1066
-		$exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL;
1067
-		$exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . ']  Exception Details' . PHP_EOL;
1068
-		$exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL;
1069
-		$exception_log .= 'Code: '. $ex['code'] . PHP_EOL;
1070
-		$exception_log .= 'File: '. $ex['file'] . PHP_EOL;
1071
-		$exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL;
1072
-		$exception_log .= 'Stack trace: ' . PHP_EOL;
1073
-		$exception_log .= $ex['string'] . PHP_EOL;
1074
-		$exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL;
1075
-
1076
-		EE_Registry::instance()->load_helper( 'File' );
1066
+		$exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL;
1067
+		$exception_log .= '['.date('Y-m-d H:i:s', $time).']  Exception Details'.PHP_EOL;
1068
+		$exception_log .= 'Message: '.$ex['msg'].PHP_EOL;
1069
+		$exception_log .= 'Code: '.$ex['code'].PHP_EOL;
1070
+		$exception_log .= 'File: '.$ex['file'].PHP_EOL;
1071
+		$exception_log .= 'Line No: '.$ex['line'].PHP_EOL;
1072
+		$exception_log .= 'Stack trace: '.PHP_EOL;
1073
+		$exception_log .= $ex['string'].PHP_EOL;
1074
+		$exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL;
1075
+
1076
+		EE_Registry::instance()->load_helper('File');
1077 1077
 		try {
1078
-			EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file );
1079
-			EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' ); 
1080
-			if ( ! $clear ) {
1078
+			EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file);
1079
+			EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs'); 
1080
+			if ( ! $clear) {
1081 1081
 				//get existing log file and append new log info
1082
-				$exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log;
1082
+				$exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log;
1083 1083
 			}
1084
-			EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log );
1085
-		} catch( EE_Error $e ){
1086
-			EE_Error::add_error( sprintf( __(  'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() ));
1084
+			EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log);
1085
+		} catch (EE_Error $e) {
1086
+			EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage()));
1087 1087
 			return;
1088 1088
 		}
1089 1089
 
@@ -1107,10 +1107,10 @@  discard block
 block discarded – undo
1107 1107
 	 * @param int     $error_type
1108 1108
 	 * @return void
1109 1109
 	 */
1110
-	public static function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) {
1111
-		if ( defined('WP_DEBUG') && WP_DEBUG ) {
1110
+	public static function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) {
1111
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1112 1112
 			EE_Registry::instance()->load_helper('Debug_Tools');
1113
-			EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $error_type );
1113
+			EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $error_type);
1114 1114
 		}
1115 1115
 	}
1116 1116
 
@@ -1130,13 +1130,13 @@  discard block
 block discarded – undo
1130 1130
  */
1131 1131
 function espresso_error_enqueue_scripts() {
1132 1132
 	// js for error handling
1133
-	wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE );
1134
-	wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE );
1133
+	wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE);
1134
+	wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE);
1135 1135
 }
1136
-if ( is_admin() ) {
1137
-	add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1136
+if (is_admin()) {
1137
+	add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1138 1138
 } else {
1139
-	add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1139
+	add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1140 1140
 }
1141 1141
 
1142 1142
 
Please login to merge, or discard this patch.
core/db_classes/EE_Datetime.class.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 *                             		    date_format and the second value is the time format
75 75
 	 * @return EE_Datetime
76 76
 	 */
77
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
78
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
79
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
77
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
78
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
79
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
80 80
 	}
81 81
 
82 82
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *                          		the website will be used.
88 88
 	 * @return EE_Datetime
89 89
 	 */
90
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
91
-		return new self( $props_n_values, TRUE, $timezone );
90
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
91
+		return new self($props_n_values, TRUE, $timezone);
92 92
 	}
93 93
 
94 94
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	/**
97 97
 	 * @param $name
98 98
 	 */
99
-	public function set_name( $name ) {
100
-		$this->set( 'DTT_name', $name );
99
+	public function set_name($name) {
100
+		$this->set('DTT_name', $name);
101 101
 	}
102 102
 
103 103
 
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 * @param $description
107 107
 	 */
108
-	public function set_description( $description ) {
109
-		$this->set( 'DTT_description', $description );
108
+	public function set_description($description) {
109
+		$this->set('DTT_description', $description);
110 110
 	}
111 111
 
112 112
 
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 * @access        public
120 120
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
121 121
 	 */
122
-	public function set_start_date( $date ) {
123
-		$this->_set_date_for( $date, 'DTT_EVT_start' );
122
+	public function set_start_date($date) {
123
+		$this->_set_date_for($date, 'DTT_EVT_start');
124 124
 	}
125 125
 
126 126
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @access        public
134 134
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
135 135
 	 */
136
-	public function set_start_time( $time ) {
137
-		$this->_set_time_for( $time, 'DTT_EVT_start' );
136
+	public function set_start_time($time) {
137
+		$this->_set_time_for($time, 'DTT_EVT_start');
138 138
 	}
139 139
 
140 140
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @access        public
148 148
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
149 149
 	 */
150
-	public function set_end_date( $date ) {
151
-		$this->_set_date_for( $date, 'DTT_EVT_end' );
150
+	public function set_end_date($date) {
151
+		$this->_set_date_for($date, 'DTT_EVT_end');
152 152
 	}
153 153
 
154 154
 
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 	 * @access        public
162 162
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
163 163
 	 */
164
-	public function set_end_time( $time ) {
165
-		$this->_set_time_for( $time, 'DTT_EVT_end' );
164
+	public function set_end_time($time) {
165
+		$this->_set_time_for($time, 'DTT_EVT_end');
166 166
 	}
167 167
 
168 168
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @access        public
176 176
 	 * @param        int $reg_limit
177 177
 	 */
178
-	public function set_reg_limit( $reg_limit ) {
179
-		$this->set( 'DTT_reg_limit', $reg_limit );
178
+	public function set_reg_limit($reg_limit) {
179
+		$this->set('DTT_reg_limit', $reg_limit);
180 180
 	}
181 181
 
182 182
 
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
 	 * @access        public
188 188
 	 * @param        int $sold
189 189
 	 */
190
-	public function set_sold( $sold ) {
190
+	public function set_sold($sold) {
191 191
 		// sold can not go below zero
192
-		$sold = max( 0, $sold );
193
-		$this->set( 'DTT_sold', $sold );
192
+		$sold = max(0, $sold);
193
+		$this->set('DTT_sold', $sold);
194 194
 	}
195 195
 
196 196
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 	 * increments sold by amount passed by $qty
200 200
 	 * @param int $qty
201 201
 	 */
202
-	function increase_sold( $qty = 1 ) {
202
+	function increase_sold($qty = 1) {
203 203
 		$sold = $this->sold() + $qty;
204
-		$this->set_sold( $sold );
204
+		$this->set_sold($sold);
205 205
 	}
206 206
 
207 207
 
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 	 * decrements (subtracts) sold amount passed by $qty
211 211
 	 * @param int $qty
212 212
 	 */
213
-	function decrease_sold( $qty = 1 ) {
213
+	function decrease_sold($qty = 1) {
214 214
 		$sold = $this->sold() - $qty;
215
-		$this->set_sold( $sold );
215
+		$this->set_sold($sold);
216 216
 	}
217 217
 
218 218
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * @return string
223 223
 	 */
224 224
 	public function name() {
225
-		return $this->get( 'DTT_name' );
225
+		return $this->get('DTT_name');
226 226
 	}
227 227
 
228 228
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return string
233 233
 	 */
234 234
 	public function description() {
235
-		return $this->get( 'DTT_description' );
235
+		return $this->get('DTT_description');
236 236
 	}
237 237
 
238 238
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 * @return boolean          TRUE if is primary, FALSE if not.
243 243
 	 */
244 244
 	public function is_primary() {
245
-		return $this->get( 'DTT_is_primary' );
245
+		return $this->get('DTT_is_primary');
246 246
 	}
247 247
 
248 248
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @return int         The order of the datetime for this event.
253 253
 	 */
254 254
 	public function order() {
255
-		return $this->get( 'DTT_order' );
255
+		return $this->get('DTT_order');
256 256
 	}
257 257
 
258 258
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @return int
263 263
 	 */
264 264
 	public function parent() {
265
-		return $this->get( 'DTT_parent' );
265
+		return $this->get('DTT_parent');
266 266
 	}
267 267
 
268 268
 
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 	 * @param    bool   $echo         - whether we echo or return (note echoing uses "pretty" formats, otherwise we use the standard formats)
279 279
 	 * @return    string|bool|void  string on success, FALSE on fail
280 280
 	 */
281
-	private function _show_datetime( $date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE ) {
281
+	private function _show_datetime($date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE) {
282 282
 		$field_name = "DTT_EVT_{$start_or_end}";
283
-		$dtt = $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo );
284
-		if ( ! $echo ) {
283
+		$dtt = $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo);
284
+		if ( ! $echo) {
285 285
 			return $dtt;
286 286
 		}
287 287
 		return '';
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
298 298
 	 * @return        mixed        string on success, FALSE on fail
299 299
 	 */
300
-	public function start_date( $dt_frmt = NULL ) {
301
-		return $this->_show_datetime( 'D', 'start', $dt_frmt );
300
+	public function start_date($dt_frmt = NULL) {
301
+		return $this->_show_datetime('D', 'start', $dt_frmt);
302 302
 	}
303 303
 
304 304
 
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
 	 * Echoes start_date()
308 308
 	 * @param string $dt_frmt
309 309
 	 */
310
-	public function e_start_date( $dt_frmt = NULL ) {
311
-		$this->_show_datetime( 'D', 'start', $dt_frmt, NULL, TRUE );
310
+	public function e_start_date($dt_frmt = NULL) {
311
+		$this->_show_datetime('D', 'start', $dt_frmt, NULL, TRUE);
312 312
 	}
313 313
 
314 314
 
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
322 322
 	 * @return        mixed        string on success, FALSE on fail
323 323
 	 */
324
-	public function end_date( $dt_frmt = NULL ) {
325
-		return $this->_show_datetime( 'D', 'end', $dt_frmt );
324
+	public function end_date($dt_frmt = NULL) {
325
+		return $this->_show_datetime('D', 'end', $dt_frmt);
326 326
 	}
327 327
 
328 328
 
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 	 * Echoes the end date. See end_date()
332 332
 	 * @param string $dt_frmt
333 333
 	 */
334
-	public function e_end_date( $dt_frmt = NULL ) {
335
-		$this->_show_datetime( 'D', 'end', $dt_frmt, NULL, TRUE );
334
+	public function e_end_date($dt_frmt = NULL) {
335
+		$this->_show_datetime('D', 'end', $dt_frmt, NULL, TRUE);
336 336
 	}
337 337
 
338 338
 
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 	 * @param        string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
346 346
 	 * @return        mixed        string on success, FALSE on fail
347 347
 	 */
348
-	public function date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
349
-		$dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : $this->_dt_frmt;
350
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $dt_frmt ) );
351
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end', $dt_frmt ) );
352
-		return $start != $end ? $start . $conjunction . $end : $start;
348
+	public function date_range($dt_frmt = NULL, $conjunction = ' - ') {
349
+		$dt_frmt = ! empty($dt_frmt) ? $dt_frmt : $this->_dt_frmt;
350
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $dt_frmt));
351
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $dt_frmt));
352
+		return $start != $end ? $start.$conjunction.$end : $start;
353 353
 	}
354 354
 
355 355
 
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
 	 * @param null   $dt_frmt
359 359
 	 * @param string $conjunction
360 360
 	 */
361
-	public function e_date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
362
-		echo $this->date_range( $dt_frmt, $conjunction );
361
+	public function e_date_range($dt_frmt = NULL, $conjunction = ' - ') {
362
+		echo $this->date_range($dt_frmt, $conjunction);
363 363
 	}
364 364
 
365 365
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
372 372
 	 * @return        mixed        string on success, FALSE on fail
373 373
 	 */
374
-	public function start_time( $tm_format = NULL ) {
375
-		return $this->_show_datetime( 'T', 'start', NULL, $tm_format );
374
+	public function start_time($tm_format = NULL) {
375
+		return $this->_show_datetime('T', 'start', NULL, $tm_format);
376 376
 	}
377 377
 
378 378
 
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
 	/**
381 381
 	 * @param null $tm_format
382 382
 	 */
383
-	public function e_start_time( $tm_format = NULL ) {
384
-		$this->_show_datetime( 'T', 'start', NULL, $tm_format, TRUE );
383
+	public function e_start_time($tm_format = NULL) {
384
+		$this->_show_datetime('T', 'start', NULL, $tm_format, TRUE);
385 385
 	}
386 386
 
387 387
 
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
394 394
 	 * @return        mixed        string on success, FALSE on fail
395 395
 	 */
396
-	public function end_time( $tm_format = NULL ) {
397
-		return $this->_show_datetime( 'T', 'end', NULL, $tm_format );
396
+	public function end_time($tm_format = NULL) {
397
+		return $this->_show_datetime('T', 'end', NULL, $tm_format);
398 398
 	}
399 399
 
400 400
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 	/**
403 403
 	 * @param null $tm_format
404 404
 	 */
405
-	public function e_end_time( $tm_format = NULL ) {
406
-		$this->_show_datetime( 'T', 'end', NULL, $tm_format, TRUE );
405
+	public function e_end_time($tm_format = NULL) {
406
+		$this->_show_datetime('T', 'end', NULL, $tm_format, TRUE);
407 407
 	}
408 408
 
409 409
 
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	 * @param        string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
417 417
 	 * @return        mixed        string on success, FALSE on fail
418 418
 	 */
419
-	public function time_range( $tm_format = NULL, $conjunction = ' - ' ) {
420
-		$tm_format = !empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
419
+	public function time_range($tm_format = NULL, $conjunction = ' - ') {
420
+		$tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt;
421 421
 
422
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $tm_format ) );
423
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end',  $tm_format ) );
424
-		return $start != $end ? $start . $conjunction . $end : $start;
422
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $tm_format));
423
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $tm_format));
424
+		return $start != $end ? $start.$conjunction.$end : $start;
425 425
 	}
426 426
 
427 427
 
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 	 * @param null   $tm_format
431 431
 	 * @param string $conjunction
432 432
 	 */
433
-	public function e_time_range( $tm_format = NULL, $conjunction = ' - ' ) {
434
-		echo $this->time_range( $tm_format, $conjunction );
433
+	public function e_time_range($tm_format = NULL, $conjunction = ' - ') {
434
+		echo $this->time_range($tm_format, $conjunction);
435 435
 	}
436 436
 
437 437
 
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 	 * @param 	string 	$tm_format - string representation of time format defaults to 'g:i a'
445 445
 	 * @return 	mixed 	string on success, FALSE on fail
446 446
 	 */
447
-	public function start_date_and_time( $dt_format = NULL, $tm_format = NULL ) {
448
-		return $this->_show_datetime( '', 'start', $dt_format, $tm_format );
447
+	public function start_date_and_time($dt_format = NULL, $tm_format = NULL) {
448
+		return $this->_show_datetime('', 'start', $dt_format, $tm_format);
449 449
 	}
450 450
 
451 451
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 * @param null $dt_frmt
455 455
 	 * @param null $tm_format
456 456
 	 */
457
-	public function e_start_date_and_time( $dt_frmt = NULL, $tm_format = NULL ) {
458
-		$this->_show_datetime( '', 'start', $dt_frmt, $tm_format, TRUE );
457
+	public function e_start_date_and_time($dt_frmt = NULL, $tm_format = NULL) {
458
+		$this->_show_datetime('', 'start', $dt_frmt, $tm_format, TRUE);
459 459
 	}
460 460
 
461 461
 
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 	 * @param bool   $round_up
470 470
 	 * @return float|int|mixed
471 471
 	 */
472
-	public function length( $units = 'seconds', $round_up = FALSE ) {
473
-		$start = $this->get_raw( 'DTT_EVT_start' );
474
-		$end = $this->get_raw( 'DTT_EVT_end' );
472
+	public function length($units = 'seconds', $round_up = FALSE) {
473
+		$start = $this->get_raw('DTT_EVT_start');
474
+		$end = $this->get_raw('DTT_EVT_end');
475 475
 		$length_in_units = $end - $start;
476
-		switch ( $units ) {
476
+		switch ($units) {
477 477
 			//NOTE: We purposefully don't use "break;" in order to chain the divisions
478 478
 			/** @noinspection PhpMissingBreakStatementInspection */
479 479
 			case 'days':
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
 				$length_in_units /= 60;
487 487
 			case 'seconds':
488 488
 			default:
489
-				$length_in_units = ceil( $length_in_units );
489
+				$length_in_units = ceil($length_in_units);
490 490
 		}
491
-		if ( $round_up ) {
492
-			$length_in_units = max( $length_in_units, 1 );
491
+		if ($round_up) {
492
+			$length_in_units = max($length_in_units, 1);
493 493
 		}
494 494
 		return $length_in_units;
495 495
 	}
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
 	 * @param bool | string 	$tm_format - string representation of time format defaults to 'g:i a'
505 505
 	 * @return 	mixed        		string on success, FALSE on fail
506 506
 	 */
507
-	public function end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
508
-		return $this->_show_datetime( '', 'end', $dt_frmt, $tm_format );
507
+	public function end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
508
+		return $this->_show_datetime('', 'end', $dt_frmt, $tm_format);
509 509
 	}
510 510
 
511 511
 
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 	 * @param bool $dt_frmt
515 515
 	 * @param bool $tm_format
516 516
 	 */
517
-	public function e_end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
518
-		$this->_show_datetime( '', 'end', $dt_frmt, $tm_format, TRUE );
517
+	public function e_end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
518
+		$this->_show_datetime('', 'end', $dt_frmt, $tm_format, TRUE);
519 519
 	}
520 520
 
521 521
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 * @return        int
528 528
 	 */
529 529
 	public function start() {
530
-		return $this->get_raw( 'DTT_EVT_start' );
530
+		return $this->get_raw('DTT_EVT_start');
531 531
 	}
532 532
 
533 533
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	 * @return        int
540 540
 	 */
541 541
 	public function end() {
542
-		return $this->get_raw( 'DTT_EVT_end' );
542
+		return $this->get_raw('DTT_EVT_end');
543 543
 	}
544 544
 
545 545
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 * @return        mixed        int on success, FALSE on fail
552 552
 	 */
553 553
 	public function reg_limit() {
554
-		return $this->get_raw( 'DTT_reg_limit' );
554
+		return $this->get_raw('DTT_reg_limit');
555 555
 	}
556 556
 
557 557
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	 * @return        mixed        int on success, FALSE on fail
564 564
 	 */
565 565
 	public function sold() {
566
-		return $this->get_raw( 'DTT_sold' );
566
+		return $this->get_raw('DTT_sold');
567 567
 	}
568 568
 
569 569
 
@@ -592,15 +592,15 @@  discard block
 block discarded – undo
592 592
 	 * 																	the spaces remaining for this particular datetime, hence the flag.
593 593
 	 * @return 	int
594 594
 	 */
595
-	public function spaces_remaining( $consider_tickets = FALSE ) {
595
+	public function spaces_remaining($consider_tickets = FALSE) {
596 596
 		// tickets remaining available for purchase
597 597
 		//no need for special checks for infinite, because if DTT_reg_limit == EE_INF, then EE_INF - x = EE_INF
598 598
 		$dtt_remaining = $this->reg_limit() - $this->sold();
599
-		if ( ! $consider_tickets ) {
599
+		if ( ! $consider_tickets) {
600 600
 			return $dtt_remaining;
601 601
 		}
602 602
 		$tickets_remaining = $this->tickets_remaining();
603
-		return min( $dtt_remaining, $tickets_remaining );
603
+		return min($dtt_remaining, $tickets_remaining);
604 604
 	}
605 605
 
606 606
 
@@ -611,19 +611,19 @@  discard block
 block discarded – undo
611 611
 	 * @param array $query_params like EEM_Base::get_all's
612 612
 	 * @return int
613 613
 	 */
614
-	public function tickets_remaining( $query_params = array() ) {
614
+	public function tickets_remaining($query_params = array()) {
615 615
 		$sum = 0;
616
-		$tickets = $this->tickets( $query_params );
617
-		if ( ! empty( $tickets ) ) {
618
-			foreach ( $tickets as $ticket ) {
619
-				if ( $ticket instanceof EE_Ticket ) {
616
+		$tickets = $this->tickets($query_params);
617
+		if ( ! empty($tickets)) {
618
+			foreach ($tickets as $ticket) {
619
+				if ($ticket instanceof EE_Ticket) {
620 620
 					// get the actual amount of tickets that can be sold
621
-					$qty = $ticket->qty( 'saleable' );
622
-					if ( $qty === EE_INF ) {
621
+					$qty = $ticket->qty('saleable');
622
+					if ($qty === EE_INF) {
623 623
 						return EE_INF;
624 624
 					}
625 625
 					// no negative ticket quantities plz
626
-					if ( $qty > 0 ) {
626
+					if ($qty > 0) {
627 627
 						$sum += $qty;
628 628
 					}
629 629
 				}
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 	 * @param array $query_params like EEM_Base::get_all's
641 641
 	 * @return int
642 642
 	 */
643
-	public function sum_tickets_initially_available( $query_params = array() ) {
644
-		return $this->sum_related( 'Ticket', $query_params, 'TKT_qty' );
643
+	public function sum_tickets_initially_available($query_params = array()) {
644
+		return $this->sum_related('Ticket', $query_params, 'TKT_qty');
645 645
 	}
646 646
 
647 647
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * @return int
654 654
 	 */
655 655
 	public function total_tickets_available_at_this_datetime() {
656
-		return $this->spaces_remaining( true );
656
+		return $this->spaces_remaining(true);
657 657
 	}
658 658
 
659 659
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	 * @return boolean
665 665
 	 */
666 666
 	public function is_upcoming() {
667
-		return ( $this->get_raw( 'DTT_EVT_start' ) > time() );
667
+		return ($this->get_raw('DTT_EVT_start') > time());
668 668
 	}
669 669
 
670 670
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 * @return boolean
675 675
 	 */
676 676
 	public function is_active() {
677
-		return ( $this->get_raw( 'DTT_EVT_start' ) < time() && $this->get_raw( 'DTT_EVT_end' ) > time() );
677
+		return ($this->get_raw('DTT_EVT_start') < time() && $this->get_raw('DTT_EVT_end') > time());
678 678
 	}
679 679
 
680 680
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 	 * @return boolean
685 685
 	 */
686 686
 	public function is_expired() {
687
-		return ( $this->get_raw( 'DTT_EVT_end' ) < time() );
687
+		return ($this->get_raw('DTT_EVT_end') < time());
688 688
 	}
689 689
 
690 690
 
@@ -695,16 +695,16 @@  discard block
 block discarded – undo
695 695
 	 */
696 696
 	public function get_active_status() {
697 697
 		$total_tickets_for_this_dtt = $this->total_tickets_available_at_this_datetime();
698
-		if ( $total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1 ) {
698
+		if ($total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1) {
699 699
 			return EE_Datetime::sold_out;
700 700
 		}
701
-		if ( $this->is_expired() ) {
701
+		if ($this->is_expired()) {
702 702
 			return EE_Datetime::expired;
703 703
 		}
704
-		if ( $this->is_upcoming() ) {
704
+		if ($this->is_upcoming()) {
705 705
 			return EE_Datetime::upcoming;
706 706
 		}
707
-		if ( $this->is_active() ) {
707
+		if ($this->is_active()) {
708 708
 			return EE_Datetime::active;
709 709
 		}
710 710
 		return NULL;
@@ -718,24 +718,24 @@  discard block
 block discarded – undo
718 718
 	 * @param  boolean $use_dtt_name if TRUE then we'll use DTT->name() if its not empty.
719 719
 	 * @return string
720 720
 	 */
721
-	public function get_dtt_display_name( $use_dtt_name = FALSE ) {
722
-		if ( $use_dtt_name ) {
721
+	public function get_dtt_display_name($use_dtt_name = FALSE) {
722
+		if ($use_dtt_name) {
723 723
 			$dtt_name = $this->name();
724
-			if ( !empty( $dtt_name ) ) {
724
+			if ( ! empty($dtt_name)) {
725 725
 				return $dtt_name;
726 726
 			}
727 727
 		}
728 728
 		//first condition is to see if the months are different
729
-		if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) ) {
730
-			$display_date = $this->start_date( 'M j\, Y g:i a' ) . ' - ' . $this->end_date( 'M j\, Y g:i a' );
729
+		if (date('m', $this->get_raw('DTT_EVT_start')) != date('m', $this->get_raw('DTT_EVT_end'))) {
730
+			$display_date = $this->start_date('M j\, Y g:i a').' - '.$this->end_date('M j\, Y g:i a');
731 731
 			//next condition is if its the same month but different day
732 732
 		}
733 733
 		else {
734
-			if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) == date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) && date( 'd', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'd', $this->get_raw( 'DTT_EVT_end' ) ) ) {
735
-				$display_date = $this->start_date( 'M j\, g:i a' ) . ' - ' . $this->end_date( 'M j\, g:i a Y' );
734
+			if (date('m', $this->get_raw('DTT_EVT_start')) == date('m', $this->get_raw('DTT_EVT_end')) && date('d', $this->get_raw('DTT_EVT_start')) != date('d', $this->get_raw('DTT_EVT_end'))) {
735
+				$display_date = $this->start_date('M j\, g:i a').' - '.$this->end_date('M j\, g:i a Y');
736 736
 			}
737 737
 			else {
738
-				$display_date = $this->start_date( 'F j\, Y' ) . ' @ ' . $this->start_date( 'g:i a' ) . ' - ' . $this->end_date( 'g:i a' );
738
+				$display_date = $this->start_date('F j\, Y').' @ '.$this->start_date('g:i a').' - '.$this->end_date('g:i a');
739 739
 			}
740 740
 		}
741 741
 		return $display_date;
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 *@param array $query_params see EEM_Base::get_all()
750 750
 	 * @return EE_Ticket[]
751 751
 	 */
752
-	public function tickets( $query_params = array() ) {
753
-		return $this->get_many_related( 'Ticket', $query_params );
752
+	public function tickets($query_params = array()) {
753
+		return $this->get_many_related('Ticket', $query_params);
754 754
 	}
755 755
 
756 756
 
@@ -760,21 +760,21 @@  discard block
 block discarded – undo
760 760
 	 * @param array $query_params like EEM_Base::get_all's
761 761
 	 * @return EE_Ticket[]
762 762
 	 */
763
-	public function ticket_types_available_for_purchase( $query_params = array() ) {
763
+	public function ticket_types_available_for_purchase($query_params = array()) {
764 764
 		// first check if datetime is valid
765
-		if ( ! ( $this->is_upcoming() || $this->is_active() ) || $this->sold_out() ) {
765
+		if ( ! ($this->is_upcoming() || $this->is_active()) || $this->sold_out()) {
766 766
 			return array();
767 767
 		}
768
-		if ( empty( $query_params ) ) {
768
+		if (empty($query_params)) {
769 769
 			$query_params = array(
770 770
 				array(
771
-					'TKT_start_date' => array( '<=', EEM_Ticket::instance()->current_time_for_query( 'TKT_start_date' ) ),
772
-					'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
771
+					'TKT_start_date' => array('<=', EEM_Ticket::instance()->current_time_for_query('TKT_start_date')),
772
+					'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
773 773
 					'TKT_deleted'    => false
774 774
 				)
775 775
 			);
776 776
 		}
777
-		return $this->tickets( $query_params );
777
+		return $this->tickets($query_params);
778 778
 	}
779 779
 
780 780
 
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 	 * @return EE_Event
785 785
 	 */
786 786
 	public function event() {
787
-		return $this->get_first_related( 'Event' );
787
+		return $this->get_first_related('Event');
788 788
 	}
789 789
 
790 790
 
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	public function update_sold() {
798 798
 		$count_regs_for_this_datetime = EEM_Registration::instance()->count(
799
-			array( array(
799
+			array(array(
800 800
 				'STS_ID' 					=> EEM_Registration::status_id_approved,
801 801
 				'REG_deleted' 				=> 0,
802 802
 				'Ticket.Datetime.DTT_ID' 	=> $this->ID(),
803
-			) )
803
+			))
804 804
 		);
805
-		$this->set( 'DTT_sold', $count_regs_for_this_datetime );
805
+		$this->set('DTT_sold', $count_regs_for_this_datetime);
806 806
 		$this->save();
807 807
 		return $count_regs_for_this_datetime;
808 808
 	}
Please login to merge, or discard this patch.
core/db_classes/EE_Registration.class.php 1 patch
Spacing   +188 added lines, -188 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_Registration class
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	 *                             		    date_format and the second value is the time format
42 42
 	 * @return EE_Registration
43 43
 	 */
44
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
45
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
46
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
44
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
45
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
46
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
47 47
 	}
48 48
 
49 49
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 *                          		the website will be used.
55 55
 	 * @return EE_Registration
56 56
 	 */
57
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
58
-		return new self( $props_n_values, TRUE, $timezone );
57
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
58
+		return new self($props_n_values, TRUE, $timezone);
59 59
 	}
60 60
 
61 61
 
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	 * @access        public
67 67
 	 * @param        int $EVT_ID Event ID
68 68
 	 */
69
-	public function set_event( $EVT_ID = 0 ) {
70
-		$this->set( 'EVT_ID', $EVT_ID );
69
+	public function set_event($EVT_ID = 0) {
70
+		$this->set('EVT_ID', $EVT_ID);
71 71
 	}
72 72
 
73 73
 
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
 	 * @param mixed  $field_value
79 79
 	 * @param bool   $use_default
80 80
 	 */
81
-	public function set( $field_name, $field_value, $use_default = FALSE ) {
82
-		switch( $field_name ) {
81
+	public function set($field_name, $field_value, $use_default = FALSE) {
82
+		switch ($field_name) {
83 83
 			case 'REG_code' :
84
-				if ( ! empty( $field_value ) && $this->reg_code() == '' ) {
85
-					$this->set_reg_code( $field_value, $use_default );
84
+				if ( ! empty($field_value) && $this->reg_code() == '') {
85
+					$this->set_reg_code($field_value, $use_default);
86 86
 				}
87 87
 				break;
88 88
 			case 'STS_ID' :
89
-				$this->set_status( $field_value, $use_default );
89
+				$this->set_status($field_value, $use_default);
90 90
 				break;
91 91
 			default :
92
-				parent::set( $field_name, $field_value, $use_default );
92
+				parent::set($field_name, $field_value, $use_default);
93 93
 		}
94 94
 	}
95 95
 
@@ -106,30 +106,30 @@  discard block
 block discarded – undo
106 106
 	 * @param boolean $use_default
107 107
 	 * @return bool
108 108
 	 */
109
-	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
109
+	public function set_status($new_STS_ID = NULL, $use_default = FALSE) {
110 110
 		// get current REG_Status
111 111
 		$old_STS_ID = $this->status_ID();
112 112
 		// if status has changed
113
-		if ( $old_STS_ID != $new_STS_ID  ) {
113
+		if ($old_STS_ID != $new_STS_ID) {
114 114
 			// TO approved
115
-			if ( $new_STS_ID == EEM_Registration::status_id_approved ) {
115
+			if ($new_STS_ID == EEM_Registration::status_id_approved) {
116 116
 				// reserve a space by incrementing ticket and datetime sold values
117 117
 				$this->_reserve_registration_space();
118
-				do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID );
118
+				do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID);
119 119
 			// OR FROM  approved
120
-			} else if ( $old_STS_ID == EEM_Registration::status_id_approved ) {
120
+			} else if ($old_STS_ID == EEM_Registration::status_id_approved) {
121 121
 				// release a space by decrementing ticket and datetime sold values
122 122
 				$this->_release_registration_space();
123
-				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
123
+				do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID);
124 124
 			}
125 125
 			// update status
126
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
127
-			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
126
+			parent::set('STS_ID', $new_STS_ID, $use_default);
127
+			do_action('AHEE__EE_Registration__set_status__after_update', $this);
128 128
 			return TRUE;
129
-		}else{
129
+		} else {
130 130
 			//even though the old value matches the new value, it's still good to
131 131
 			//allow the parent set method to have a say
132
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
132
+			parent::set('STS_ID', $new_STS_ID, $use_default);
133 133
 			return TRUE;
134 134
 		}
135 135
 	}
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @access        public
142 142
 	 */
143 143
 	public function status_ID() {
144
-		return $this->get( 'STS_ID' );
144
+		return $this->get('STS_ID');
145 145
 	}
146 146
 
147 147
 
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
 	 * @param boolean $include_archived whether to include archived tickets or not.
167 167
 	 * @return EE_Ticket
168 168
 	 */
169
-	public function ticket( $include_archived = TRUE ) {
169
+	public function ticket($include_archived = TRUE) {
170 170
 		$query_params = array();
171
-		if ( $include_archived ) {
172
-			$query_params[ 'default_where_conditions' ] = 'none';
171
+		if ($include_archived) {
172
+			$query_params['default_where_conditions'] = 'none';
173 173
 		}
174
-		return $this->get_first_related( 'Ticket', $query_params );
174
+		return $this->get_first_related('Ticket', $query_params);
175 175
 	}
176 176
 
177 177
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @return EE_Event
182 182
 	 */
183 183
 	public function event() {
184
-		return $this->get_first_related( 'Event' );
184
+		return $this->get_first_related('Event');
185 185
 	}
186 186
 
187 187
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function wp_user() {
197 197
 		$event = $this->event();
198
-		if ( $event instanceof EE_Event ) {
198
+		if ($event instanceof EE_Event) {
199 199
 			return $event->wp_user();
200 200
 		}
201 201
 		return 0;
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 * @access        public
222 222
 	 * @param        int $ATT_ID Attendee ID
223 223
 	 */
224
-	public function set_attendee_id( $ATT_ID = 0 ) {
225
-		$this->set( 'ATT_ID', $ATT_ID );
224
+	public function set_attendee_id($ATT_ID = 0) {
225
+		$this->set('ATT_ID', $ATT_ID);
226 226
 	}
227 227
 
228 228
 
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @access        public
234 234
 	 * @param        int $TXN_ID Transaction ID
235 235
 	 */
236
-	public function set_transaction_id( $TXN_ID = 0 ) {
237
-		$this->set( 'TXN_ID', $TXN_ID );
236
+	public function set_transaction_id($TXN_ID = 0) {
237
+		$this->set('TXN_ID', $TXN_ID);
238 238
 	}
239 239
 
240 240
 
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 	 * @access    public
246 246
 	 * @param    string $REG_session PHP Session ID
247 247
 	 */
248
-	public function set_session( $REG_session = '' ) {
249
-		$this->set( 'REG_session', $REG_session );
248
+	public function set_session($REG_session = '') {
249
+		$this->set('REG_session', $REG_session);
250 250
 	}
251 251
 
252 252
 
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 	 * @access    public
258 258
 	 * @param    string $REG_url_link Registration URL Link
259 259
 	 */
260
-	public function set_reg_url_link( $REG_url_link = '' ) {
261
-		$this->set( 'REG_url_link', $REG_url_link );
260
+	public function set_reg_url_link($REG_url_link = '') {
261
+		$this->set('REG_url_link', $REG_url_link);
262 262
 	}
263 263
 
264 264
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 * @access        public
270 270
 	 * @param        int $REG_count Primary Attendee
271 271
 	 */
272
-	public function set_count( $REG_count = 1 ) {
273
-		$this->set( 'REG_count', $REG_count );
272
+	public function set_count($REG_count = 1) {
273
+		$this->set('REG_count', $REG_count);
274 274
 	}
275 275
 
276 276
 
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 	 * @access        public
282 282
 	 * @param        boolean $REG_group_size Group Registration
283 283
 	 */
284
-	public function set_group_size( $REG_group_size = FALSE ) {
285
-		$this->set( 'REG_group_size', $REG_group_size );
284
+	public function set_group_size($REG_group_size = FALSE) {
285
+		$this->set('REG_group_size', $REG_group_size);
286 286
 	}
287 287
 
288 288
 
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 	 * @access        public
366 366
 	 * @param        mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date
367 367
 	 */
368
-	public function set_reg_date( $REG_date = FALSE ) {
369
-		$this->set( 'REG_date', $REG_date );
368
+	public function set_reg_date($REG_date = FALSE) {
369
+		$this->set('REG_date', $REG_date);
370 370
 	}
371 371
 
372 372
 
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	 * @access    public
378 378
 	 * @param    float $REG_final_price
379 379
 	 */
380
-	public function set_final_price( $REG_final_price = 0.00 ) {
381
-		$this->set( 'REG_final_price', $REG_final_price );
380
+	public function set_final_price($REG_final_price = 0.00) {
381
+		$this->set('REG_final_price', $REG_final_price);
382 382
 	}
383 383
 
384 384
 
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
 	 * @access    public
390 390
 	 * @param    float $REG_paid
391 391
 	 */
392
-	public function set_paid( $REG_paid = 0.00 ) {
393
-		$this->set( 'REG_paid', $REG_paid );
392
+	public function set_paid($REG_paid = 0.00) {
393
+		$this->set('REG_paid', $REG_paid);
394 394
 	}
395 395
 
396 396
 
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
 	 * @access        public
402 402
 	 * @param        boolean $REG_att_is_going Attendee Is Going
403 403
 	 */
404
-	public function set_att_is_going( $REG_att_is_going = FALSE ) {
405
-		$this->set( 'REG_att_is_going', $REG_att_is_going );
404
+	public function set_att_is_going($REG_att_is_going = FALSE) {
405
+		$this->set('REG_att_is_going', $REG_att_is_going);
406 406
 	}
407 407
 
408 408
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * @return EE_Attendee
413 413
 	 */
414 414
 	public function attendee() {
415
-		return $this->get_first_related( 'Attendee' );
415
+		return $this->get_first_related('Attendee');
416 416
 	}
417 417
 
418 418
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 * @access        public
423 423
 	 */
424 424
 	public function event_ID() {
425
-		return $this->get( 'EVT_ID' );
425
+		return $this->get('EVT_ID');
426 426
 	}
427 427
 
428 428
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	 */
434 434
 	public function event_name() {
435 435
 		$event = $this->event_obj();
436
-		if ( $event ) {
436
+		if ($event) {
437 437
 			return $event->name();
438 438
 		} else {
439 439
 			return NULL;
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 * @return EE_Event
448 448
 	 */
449 449
 	public function event_obj() {
450
-		return $this->get_first_related( 'Event' );
450
+		return $this->get_first_related('Event');
451 451
 	}
452 452
 
453 453
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 * @access        public
458 458
 	 */
459 459
 	public function attendee_ID() {
460
-		return $this->get( 'ATT_ID' );
460
+		return $this->get('ATT_ID');
461 461
 	}
462 462
 
463 463
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 	 * @access        public
468 468
 	 */
469 469
 	public function session_ID() {
470
-		return $this->get( 'REG_session' );
470
+		return $this->get('REG_session');
471 471
 	}
472 472
 
473 473
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
478 478
 	 * @return string
479 479
 	 */
480
-	public function receipt_url( $messenger = 'html' ) {
480
+	public function receipt_url($messenger = 'html') {
481 481
 
482 482
 		/**
483 483
 		 * The below will be deprecated one version after this.  We check first if there is a custom receipt template already in use on old system.  If there is then we just return the standard url for it.
@@ -486,12 +486,12 @@  discard block
 block discarded – undo
486 486
 		 */
487 487
 		EE_Registry::instance()->load_helper('Template');
488 488
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php';
489
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
489
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
490 490
 
491
-		if ( $has_custom ) {
492
-			return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) );
491
+		if ($has_custom) {
492
+			return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch'));
493 493
 		}
494
-		return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' );
494
+		return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt');
495 495
 	}
496 496
 
497 497
 
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
503 503
 	 * @return string
504 504
 	 */
505
-	public function invoice_url( $messenger = 'html' ) {
505
+	public function invoice_url($messenger = 'html') {
506 506
 		/**
507 507
 		 * The below will be deprecated one version after this.  We check first if there is a custom invoice template already in use on old system.  If there is then we just return the standard url for it.
508 508
 		 *
@@ -510,21 +510,21 @@  discard block
 block discarded – undo
510 510
 		 */
511 511
 		EE_Registry::instance()->load_helper('Template');
512 512
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php';
513
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
513
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
514 514
 
515
-		if ( $has_custom ) {
516
-			if ( $messenger == 'html' ) {
517
-				return $this->invoice_url( 'launch' );
515
+		if ($has_custom) {
516
+			if ($messenger == 'html') {
517
+				return $this->invoice_url('launch');
518 518
 			}
519 519
 			$route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice';
520 520
 
521
-			$query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() );
522
-			if ( $messenger == 'html' ) {
521
+			$query_args = array('ee' => $route, 'id' => $this->reg_url_link());
522
+			if ($messenger == 'html') {
523 523
 				$query_args['html'] = TRUE;
524 524
 			}
525
-			return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) );
525
+			return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
526 526
 		}
527
-		return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' );
527
+		return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice');
528 528
 	}
529 529
 
530 530
 
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	 * @access        public
535 535
 	 */
536 536
 	public function reg_url_link() {
537
-		return $this->get( 'REG_url_link' );
537
+		return $this->get('REG_url_link');
538 538
 	}
539 539
 
540 540
 
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	 * @param string $type 'download','launch', or 'html' (default is 'launch')
545 545
 	 * @return void
546 546
 	 */
547
-	public function e_invoice_url( $type = 'launch' ) {
548
-		echo $this->invoice_url( $type );
547
+	public function e_invoice_url($type = 'launch') {
548
+		echo $this->invoice_url($type);
549 549
 	}
550 550
 
551 551
 
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 	 * @return string
566 566
 	 */
567 567
 	public function payment_overview_url() {
568
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
568
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
569 569
 	}
570 570
 
571 571
 
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	 * @return string
577 577
 	 */
578 578
 	public function edit_attendee_information_url() {
579
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
579
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
580 580
 	}
581 581
 
582 582
 
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
 	 * @return string
587 587
 	 */
588 588
 	public function get_admin_edit_url() {
589
-		EE_Registry::instance()->load_helper( 'URL' );
590
-		return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) );
589
+		EE_Registry::instance()->load_helper('URL');
590
+		return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php'));
591 591
 	}
592 592
 
593 593
 
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 	 * @access        public
598 598
 	 */
599 599
 	public function is_primary_registrant() {
600
-		return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE;
600
+		return $this->get('REG_count') == 1 ? TRUE : FALSE;
601 601
 	}
602 602
 
603 603
 
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
 	 * This returns the primary registration object for this registration group (which may be this object).
607 607
 	 * @return EE_Registration
608 608
 	 */
609
-	public function get_primary_registration()  {
610
-		if ( $this->is_primary_registrant() )
609
+	public function get_primary_registration() {
610
+		if ($this->is_primary_registrant())
611 611
 			return $this;
612 612
 
613 613
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
614
-		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
614
+		$primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1)));
615 615
 		return $primary_registrant;
616 616
 	}
617 617
 
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	* 		@access		public
623 623
 	*/
624 624
 	public function count() {
625
-		return $this->get( 'REG_count' );
625
+		return $this->get('REG_count');
626 626
 	}
627 627
 
628 628
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 	 * @access        public
633 633
 	 */
634 634
 	public function group_size() {
635
-		return $this->get( 'REG_group_size' );
635
+		return $this->get('REG_group_size');
636 636
 	}
637 637
 
638 638
 
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 	 * @access        public
643 643
 	 */
644 644
 	public function date() {
645
-		return $this->get( 'REG_date' );
645
+		return $this->get('REG_date');
646 646
 	}
647 647
 
648 648
 
@@ -653,8 +653,8 @@  discard block
 block discarded – undo
653 653
 	 * @param string $time_format
654 654
 	 * @return string
655 655
 	 */
656
-	public function pretty_date( $date_format = NULL, $time_format = NULL ) {
657
-		return $this->get_datetime( 'REG_date', $date_format, $time_format );
656
+	public function pretty_date($date_format = NULL, $time_format = NULL) {
657
+		return $this->get_datetime('REG_date', $date_format, $time_format);
658 658
 	}
659 659
 
660 660
 
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 	 * @return    float
668 668
 	 */
669 669
 	public function final_price() {
670
-		return $this->get( 'REG_final_price' );
670
+		return $this->get('REG_final_price');
671 671
 	}
672 672
 
673 673
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 	 * @return string
679 679
 	 */
680 680
 	public function pretty_final_price() {
681
-		return $this->get_pretty( 'REG_final_price' );
681
+		return $this->get_pretty('REG_final_price');
682 682
 	}
683 683
 
684 684
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 	 * @return 	float
690 690
 	 */
691 691
 	public function paid() {
692
-		return $this->get( 'REG_paid' );
692
+		return $this->get('REG_paid');
693 693
 	}
694 694
 
695 695
 
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	 * @return 	float
701 701
 	 */
702 702
 	public function pretty_paid() {
703
-		return $this->get_pretty( 'REG_paid' );
703
+		return $this->get_pretty('REG_paid');
704 704
 	}
705 705
 
706 706
 
@@ -712,11 +712,11 @@  discard block
 block discarded – undo
712 712
 	 * @param array $requires_payment
713 713
 	 * @return bool
714 714
 	 */
715
-	public function owes_monies_and_can_pay( $requires_payment = array()) {
715
+	public function owes_monies_and_can_pay($requires_payment = array()) {
716 716
 		// these reg statuses require payment (if event is not free)
717
-		$requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
717
+		$requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
718 718
 		if (
719
-			in_array( $this->status_ID(), $requires_payment ) &&
719
+			in_array($this->status_ID(), $requires_payment) &&
720 720
 			$this->final_price() != 0 &&
721 721
 			$this->final_price() != $this->paid()
722 722
 		) {
@@ -733,8 +733,8 @@  discard block
 block discarded – undo
733 733
 	 * @param bool $show_icons
734 734
 	 * @return void
735 735
 	 */
736
-	public function e_pretty_status( $show_icons = FALSE ) {
737
-		echo $this->pretty_status( $show_icons );
736
+	public function e_pretty_status($show_icons = FALSE) {
737
+		echo $this->pretty_status($show_icons);
738 738
 	}
739 739
 
740 740
 
@@ -745,10 +745,10 @@  discard block
 block discarded – undo
745 745
 	 * @param bool $show_icons
746 746
 	 * @return string
747 747
 	 */
748
-	public function pretty_status( $show_icons = FALSE ) {
749
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
748
+	public function pretty_status($show_icons = FALSE) {
749
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
750 750
 		$icon = '';
751
-		switch ( $this->status_ID() ) {
751
+		switch ($this->status_ID()) {
752 752
 			case EEM_Registration::status_id_approved:
753 753
 				$icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : '';
754 754
 				break;
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 				$icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : '';
769 769
 				break;
770 770
 		}
771
-		return $icon . $status[ $this->status_ID() ];
771
+		return $icon.$status[$this->status_ID()];
772 772
 	}
773 773
 
774 774
 
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 	 * @access        public
779 779
 	 */
780 780
 	public function att_is_going() {
781
-		return $this->get( 'REG_att_is_going' );
781
+		return $this->get('REG_att_is_going');
782 782
 	}
783 783
 
784 784
 
@@ -788,8 +788,8 @@  discard block
 block discarded – undo
788 788
 	 * @param array $query_params like EEM_Base::get_all
789 789
 	 * @return EE_Answer[]
790 790
 	 */
791
-	public function answers( $query_params = NULL ) {
792
-		return $this->get_many_related( 'Answer', $query_params );
791
+	public function answers($query_params = NULL) {
792
+		return $this->get_many_related('Answer', $query_params);
793 793
 	}
794 794
 
795 795
 
@@ -803,9 +803,9 @@  discard block
 block discarded – undo
803 803
 	 * (because the answer might be an array of answer values, so passing pretty_value=true
804 804
 	 * will convert it into some kind of string)
805 805
 	 */
806
-	public function answer_value_to_question( $question, $pretty_value=true ) {
806
+	public function answer_value_to_question($question, $pretty_value = true) {
807 807
 		$question_id = EEM_Question::instance()->ensure_is_ID($question);
808
-		return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value);
808
+		return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value);
809 809
 	}
810 810
 
811 811
 
@@ -818,13 +818,13 @@  discard block
 block discarded – undo
818 818
 	 */
819 819
 	public function question_groups() {
820 820
 		$question_groups = array();
821
-		if ( $this->event() instanceof EE_Event ) {
821
+		if ($this->event() instanceof EE_Event) {
822 822
 			$question_groups = $this->event()->question_groups(
823 823
 				array(
824 824
 					array(
825 825
 						'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false
826 826
 					),
827
-					'order_by' => array( 'QSG_order' => 'ASC' )
827
+					'order_by' => array('QSG_order' => 'ASC')
828 828
 				)
829 829
 			);
830 830
 		}
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 	 */
842 842
 	public function count_question_groups() {
843 843
 		$qg_count = 0;
844
-		if ( $this->event() instanceof EE_Event ) {
844
+		if ($this->event() instanceof EE_Event) {
845 845
 			$qg_count = $this->event()->count_related(
846 846
 				'Question_Group',
847 847
 				array(
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 	 * @return string
863 863
 	 */
864 864
 	public function reg_date() {
865
-		return $this->get_datetime( 'REG_date' );
865
+		return $this->get_datetime('REG_date');
866 866
 	}
867 867
 
868 868
 
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 	 * @return EE_Datetime_Ticket
875 875
 	 */
876 876
 	public function datetime_ticket() {
877
-		return $this->get_first_related( 'Datetime_Ticket' );
877
+		return $this->get_first_related('Datetime_Ticket');
878 878
 	}
879 879
 
880 880
 
@@ -884,15 +884,15 @@  discard block
 block discarded – undo
884 884
 	 * @param EE_Datetime_Ticket $datetime_ticket
885 885
 	 * @return EE_Datetime_Ticket
886 886
 	 */
887
-	public function set_datetime_ticket( $datetime_ticket ) {
888
-		return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' );
887
+	public function set_datetime_ticket($datetime_ticket) {
888
+		return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket');
889 889
 	}
890 890
 	/**
891 891
 	 * Gets deleted
892 892
 	 * @return boolean
893 893
 	 */
894 894
 	public function deleted() {
895
-		return $this->get( 'REG_deleted' );
895
+		return $this->get('REG_deleted');
896 896
 	}
897 897
 
898 898
 	/**
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 	 * @return boolean
902 902
 	 */
903 903
 	public function set_deleted($deleted) {
904
-		$this->set( 'REG_deleted', $deleted );
904
+		$this->set('REG_deleted', $deleted);
905 905
 	}
906 906
 
907 907
 
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
 	 * @return EE_Status
912 912
 	 */
913 913
 	public function status_obj() {
914
-		return $this->get_first_related( 'Status' );
914
+		return $this->get_first_related('Status');
915 915
 	}
916 916
 
917 917
 
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 	 * @return int
923 923
 	 */
924 924
 	public function count_checkins() {
925
-		return $this->get_model()->count_related( $this, 'Checkin' );
925
+		return $this->get_model()->count_related($this, 'Checkin');
926 926
 	}
927 927
 
928 928
 
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 	 * @return int
933 933
 	 */
934 934
 	public function count_checkins_not_checkedout() {
935
-		return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) );
935
+		return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1)));
936 936
 	}
937 937
 
938 938
 
@@ -945,20 +945,20 @@  discard block
 block discarded – undo
945 945
 	 *
946 946
 	 * @return bool
947 947
 	 */
948
-	public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) {
949
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
948
+	public function can_checkin($DTT_OR_ID, $check_approved = TRUE) {
949
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
950 950
 
951 951
 		//first check registration status
952
-		if (  ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) {
952
+		if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) {
953 953
 			return false;
954 954
 		}
955 955
 		//is there a datetime ticket that matches this dtt_ID?
956
-		if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) {
956
+		if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) {
957 957
 			return false;
958 958
 		}
959 959
 
960 960
 		//final check is against TKT_uses
961
-		return $this->verify_can_checkin_against_TKT_uses( $DTT_ID );
961
+		return $this->verify_can_checkin_against_TKT_uses($DTT_ID);
962 962
 	}
963 963
 
964 964
 
@@ -971,10 +971,10 @@  discard block
 block discarded – undo
971 971
 	 * @param int | EE_Datetime  $DTT_OR_ID  The datetime the registration is being checked against
972 972
 	 * @return bool   true means can checkin.  false means cannot checkin.
973 973
 	 */
974
-	public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) {
975
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
974
+	public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) {
975
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
976 976
 
977
-		if ( ! $DTT_ID ) {
977
+		if ( ! $DTT_ID) {
978 978
 			return false;
979 979
 		}
980 980
 
@@ -982,23 +982,23 @@  discard block
 block discarded – undo
982 982
 
983 983
 		// if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in
984 984
 		// or not.
985
-		if ( ! $max_uses || $max_uses === EE_INF ) {
985
+		if ( ! $max_uses || $max_uses === EE_INF) {
986 986
 			return true;
987 987
 		}
988 988
 
989 989
 		//does this datetime have a checkin record?  If so, then the dtt count has already been verified so we can just
990 990
 		//go ahead and toggle.
991
-		if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) {
991
+		if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) {
992 992
 			return true;
993 993
 		}
994 994
 
995 995
 		//made it here so the last check is whether the number of checkins per unique datetime on this registration
996 996
 		//disallows further check-ins.
997
-		$count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true );
997
+		$count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true);
998 998
 		// checkins have already reached their max number of uses
999 999
 		// so registrant can NOT checkin
1000
-		if ( $count_unique_dtt_checkins >= $max_uses ) {
1001
-			EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1000
+		if ($count_unique_dtt_checkins >= $max_uses) {
1001
+			EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1002 1002
 			return false;
1003 1003
 		}
1004 1004
 		return true;
@@ -1019,15 +1019,15 @@  discard block
 block discarded – undo
1019 1019
 	 * @param  bool $verify  If true then can_checkin() is used to verify whether the person can be checked in or not.  Otherwise this forces change in checkin status.
1020 1020
 	 * @return int|BOOL            the chk_in status toggled to OR false if nothing got changed.
1021 1021
 	 */
1022
-	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1023
-		if ( empty( $DTT_ID ) ) {
1022
+	public function toggle_checkin_status($DTT_ID = null, $verify = false) {
1023
+		if (empty($DTT_ID)) {
1024 1024
 			$datetime = $this->get_related_primary_datetime();
1025 1025
 			$DTT_ID = $datetime->ID();
1026 1026
 		// verify the registration can checkin for the given DTT_ID
1027
-		} elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) {
1027
+		} elseif ( ! $this->can_checkin($DTT_ID, $verify)) {
1028 1028
 			EE_Error::add_error(
1029 1029
 					sprintf(
1030
-						__( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1030
+						__('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1031 1031
 						$this->ID(),
1032 1032
 						$DTT_ID
1033 1033
 					),
@@ -1041,8 +1041,8 @@  discard block
 block discarded – undo
1041 1041
 			EE_Registration::checkin_status_out => EE_Registration::checkin_status_in
1042 1042
 		);
1043 1043
 		//start by getting the current status so we know what status we'll be changing to.
1044
-		$cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL );
1045
-		$status_to = $status_paths[ $cur_status ];
1044
+		$cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL);
1045
+		$status_to = $status_paths[$cur_status];
1046 1046
 		// database only records true for checked IN or false for checked OUT
1047 1047
 		// no record ( null ) means checked in NEVER, but we obviously don't save that
1048 1048
 		$new_status = $status_to == EE_Registration::checkin_status_in ? true : false;
@@ -1050,24 +1050,24 @@  discard block
 block discarded – undo
1050 1050
 		// because we are keeping track of Check-ins over time.
1051 1051
 		// Eventually we'll probably want to show a list table
1052 1052
 		// for the individual Check-ins so that they can be managed.
1053
-		$checkin = EE_Checkin::new_instance( array(
1053
+		$checkin = EE_Checkin::new_instance(array(
1054 1054
 				'REG_ID' => $this->ID(),
1055 1055
 				'DTT_ID' => $DTT_ID,
1056 1056
 				'CHK_in' => $new_status
1057
-		) );
1057
+		));
1058 1058
 		// if the record could not be saved then return false
1059
-		if ( $checkin->save() === 0 ) {
1060
-			if ( WP_DEBUG ) {
1059
+		if ($checkin->save() === 0) {
1060
+			if (WP_DEBUG) {
1061 1061
 				global $wpdb;
1062 1062
 				$error = sprintf(
1063
-					__( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ),
1063
+					__('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'),
1064 1064
 					'<br />',
1065 1065
 					$wpdb->last_error
1066 1066
 				);
1067 1067
 			} else {
1068
-				$error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' );
1068
+				$error = __('Registration check in update failed because of an unknown database error', 'event_espresso');
1069 1069
 			}
1070
-			EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
1070
+			EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
1071 1071
 			return false;
1072 1072
 		}
1073 1073
 		return $status_to;
@@ -1091,19 +1091,19 @@  discard block
 block discarded – undo
1091 1091
 	 * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1092 1092
 	 * @return int            Integer representing Check-in status.
1093 1093
 	 */
1094
-	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) {
1095
-		if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) {
1094
+	public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) {
1095
+		if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) {
1096 1096
 			$datetime = $this->get_related_primary_datetime();
1097
-			if ( ! $datetime instanceof EE_Datetime ) {
1097
+			if ( ! $datetime instanceof EE_Datetime) {
1098 1098
 				return 0;
1099 1099
 			}
1100 1100
 			$DTT_ID = $datetime->ID();
1101 1101
 		//verify the registration can checkin for the given DTT_ID
1102 1102
 		}
1103 1103
 		//get checkin object (if exists)
1104
-		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) );
1105
-		if ( $checkin instanceof EE_Checkin ) {
1106
-			if ( $checkin->get( 'CHK_in' ) ) {
1104
+		$checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC')));
1105
+		if ($checkin instanceof EE_Checkin) {
1106
+			if ($checkin->get('CHK_in')) {
1107 1107
 				return EE_Registration::checkin_status_in; //checked in
1108 1108
 			} else {
1109 1109
 				return EE_Registration::checkin_status_out; //had checked in but is now checked out.
@@ -1121,28 +1121,28 @@  discard block
 block discarded – undo
1121 1121
 	 * @param bool $error  This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name.
1122 1122
 	 * @return string         internationalized message
1123 1123
 	 */
1124
-	public function get_checkin_msg( $DTT_ID, $error = FALSE ) {
1124
+	public function get_checkin_msg($DTT_ID, $error = FALSE) {
1125 1125
 		//let's get the attendee first so we can include the name of the attendee
1126
-		$attendee = $this->get_first_related( 'Attendee' );
1127
-		if ( $attendee instanceof EE_Attendee ) {
1128
-			if ( $error ) {
1129
-				return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() );
1126
+		$attendee = $this->get_first_related('Attendee');
1127
+		if ($attendee instanceof EE_Attendee) {
1128
+			if ($error) {
1129
+				return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name());
1130 1130
 			}
1131
-			$cur_status = $this->check_in_status_for_datetime( $DTT_ID );
1131
+			$cur_status = $this->check_in_status_for_datetime($DTT_ID);
1132 1132
 			//what is the status message going to be?
1133
-			switch ( $cur_status ) {
1133
+			switch ($cur_status) {
1134 1134
 				case EE_Registration::checkin_status_never :
1135
-					return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() );
1135
+					return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name());
1136 1136
 					break;
1137 1137
 				case EE_Registration::checkin_status_in :
1138
-					return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() );
1138
+					return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name());
1139 1139
 					break;
1140 1140
 				case EE_Registration::checkin_status_out :
1141
-					return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() );
1141
+					return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name());
1142 1142
 					break;
1143 1143
 			}
1144 1144
 		}
1145
-		return __( "The check-in status could not be determined.", "event_espresso" );
1145
+		return __("The check-in status could not be determined.", "event_espresso");
1146 1146
 	}
1147 1147
 
1148 1148
 
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 	 * @return EE_Transaction
1153 1153
 	 */
1154 1154
 	public function transaction() {
1155
-		return $this->get_first_related( 'Transaction' );
1155
+		return $this->get_first_related('Transaction');
1156 1156
 	}
1157 1157
 
1158 1158
 
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
 	 * @access        public
1164 1164
 	 */
1165 1165
 	public function reg_code() {
1166
-		return $this->get( 'REG_code' );
1166
+		return $this->get('REG_code');
1167 1167
 	}
1168 1168
 
1169 1169
 
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 	 * @access        public
1174 1174
 	 */
1175 1175
 	public function transaction_ID() {
1176
-		return $this->get( 'TXN_ID' );
1176
+		return $this->get('TXN_ID');
1177 1177
 	}
1178 1178
 
1179 1179
 
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 	 * @return int
1183 1183
 	 */
1184 1184
 	public function ticket_ID() {
1185
-		return $this->get( 'TKT_ID' );
1185
+		return $this->get('TKT_ID');
1186 1186
 	}
1187 1187
 
1188 1188
 
@@ -1194,17 +1194,17 @@  discard block
 block discarded – undo
1194 1194
 	 * @param    string $REG_code Registration Code
1195 1195
 	 * @param	boolean $use_default
1196 1196
 	 */
1197
-	public function set_reg_code( $REG_code, $use_default = FALSE ) {
1198
-		if ( empty( $REG_code )) {
1199
-			EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1197
+	public function set_reg_code($REG_code, $use_default = FALSE) {
1198
+		if (empty($REG_code)) {
1199
+			EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1200 1200
 			return;
1201 1201
 		}
1202
-		if ( ! $this->reg_code() ) {
1203
-			parent::set( 'REG_code', $REG_code, $use_default );
1202
+		if ( ! $this->reg_code()) {
1203
+			parent::set('REG_code', $REG_code, $use_default);
1204 1204
 		} else {
1205 1205
 			EE_Error::doing_it_wrong(
1206
-				__CLASS__ . '::' . __FUNCTION__,
1207
-				__( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ),
1206
+				__CLASS__.'::'.__FUNCTION__,
1207
+				__('Can not change a registration REG_code once it has been set.', 'event_espresso'),
1208 1208
 				'4.6.0'
1209 1209
 			);
1210 1210
 		}
@@ -1224,17 +1224,17 @@  discard block
 block discarded – undo
1224 1224
 	 * @return EE_Registration[]  or empty array if this isn't a group registration.
1225 1225
 	 */
1226 1226
 	public function get_all_other_registrations_in_group() {
1227
-		if ( $this->group_size() < 2 ) {
1227
+		if ($this->group_size() < 2) {
1228 1228
 			return array();
1229 1229
 		}
1230 1230
 
1231 1231
 		$query[0] = array(
1232 1232
 			'TXN_ID' => $this->transaction_ID(),
1233
-			'REG_ID' => array( '!=', $this->ID() ),
1233
+			'REG_ID' => array('!=', $this->ID()),
1234 1234
 			'TKT_ID' => $this->ticket_ID()
1235 1235
 			);
1236 1236
 
1237
-		$registrations = $this->get_model()->get_all( $query );
1237
+		$registrations = $this->get_model()->get_all($query);
1238 1238
 		return $registrations;
1239 1239
 	}
1240 1240
 
@@ -1243,14 +1243,14 @@  discard block
 block discarded – undo
1243 1243
 	 * @return string
1244 1244
 	 */
1245 1245
 	public function get_admin_details_link() {
1246
-		EE_Registry::instance()->load_helper( 'URL' );
1246
+		EE_Registry::instance()->load_helper('URL');
1247 1247
 		return EEH_URL::add_query_args_and_nonce(
1248 1248
 			array(
1249 1249
 				'page' => 'espresso_registrations',
1250 1250
 				'action' => 'view_registration',
1251 1251
 				'_REG_ID' => $this->ID()
1252 1252
 			),
1253
-			admin_url( 'admin.php' )
1253
+			admin_url('admin.php')
1254 1254
 		);
1255 1255
 	}
1256 1256
 
@@ -1275,12 +1275,12 @@  discard block
 block discarded – undo
1275 1275
 	 * @return string
1276 1276
 	 */
1277 1277
 	public function get_admin_overview_link() {
1278
-		EE_Registry::instance()->load_helper( 'URL' );
1278
+		EE_Registry::instance()->load_helper('URL');
1279 1279
 		return EEH_URL::add_query_args_and_nonce(
1280 1280
 			array(
1281 1281
 				'page' => 'espresso_registrations'
1282 1282
 			),
1283
-			admin_url( 'admin.php' )
1283
+			admin_url('admin.php')
1284 1284
 		);
1285 1285
 	}
1286 1286
 
@@ -1289,8 +1289,8 @@  discard block
 block discarded – undo
1289 1289
 	 * @param array $query_params
1290 1290
 	 * @return \EE_Registration[]
1291 1291
 	 */
1292
-	public function payments( $query_params = array() ) {
1293
-		return $this->get_many_related( 'Payment', $query_params );
1292
+	public function payments($query_params = array()) {
1293
+		return $this->get_many_related('Payment', $query_params);
1294 1294
 	}
1295 1295
 
1296 1296
 
@@ -1299,8 +1299,8 @@  discard block
 block discarded – undo
1299 1299
 	 * @param array $query_params
1300 1300
 	 * @return \EE_Registration[]
1301 1301
 	 */
1302
-	public function registration_payments( $query_params = array() ) {
1303
-		return $this->get_many_related( 'Registration_Payment', $query_params );
1302
+	public function registration_payments($query_params = array()) {
1303
+		return $this->get_many_related('Registration_Payment', $query_params);
1304 1304
 	}
1305 1305
 
1306 1306
 
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 	 * @access 	public
1312 1312
 	 */
1313 1313
 	public function price_paid() {
1314
-		EE_Error::doing_it_wrong( 'EE_Registration::price_paid()', __( 'This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso' ), '4.7.0' );
1314
+		EE_Error::doing_it_wrong('EE_Registration::price_paid()', __('This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso'), '4.7.0');
1315 1315
 		return $this->final_price();
1316 1316
 	}
1317 1317
 
@@ -1323,9 +1323,9 @@  discard block
 block discarded – undo
1323 1323
 	 * @access    public
1324 1324
 	 * @param    float $REG_final_price
1325 1325
 	 */
1326
-	public function set_price_paid( $REG_final_price = 0.00 ) {
1327
-		EE_Error::doing_it_wrong( 'EE_Registration::set_price_paid()', __( 'This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso' ), '4.7.0' );
1328
-		$this->set_final_price( $REG_final_price );
1326
+	public function set_price_paid($REG_final_price = 0.00) {
1327
+		EE_Error::doing_it_wrong('EE_Registration::set_price_paid()', __('This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso'), '4.7.0');
1328
+		$this->set_final_price($REG_final_price);
1329 1329
 	}
1330 1330
 
1331 1331
 
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 	 * @return string
1337 1337
 	 */
1338 1338
 	public function pretty_price_paid() {
1339
-		EE_Error::doing_it_wrong( 'EE_Registration::pretty_price_paid()', __( 'This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso' ), '4.7.0' );
1339
+		EE_Error::doing_it_wrong('EE_Registration::pretty_price_paid()', __('This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso'), '4.7.0');
1340 1340
 		return $this->pretty_final_price();
1341 1341
 	}
1342 1342
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_9_0.dms.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
 //(all other times it gets resurrected from a wordpress option)
9 9
 $stages = glob(EE_CORE.'data_migration_scripts/4_9_0_stages/*');
10 10
 $class_to_filepath = array();
11
-foreach($stages as $filepath){
11
+foreach ($stages as $filepath) {
12 12
 	$matches = array();
13
-	preg_match('~4_9_0_stages/(.*).dmsstage.php~',$filepath,$matches);
13
+	preg_match('~4_9_0_stages/(.*).dmsstage.php~', $filepath, $matches);
14 14
 	$class_to_filepath[$matches[1]] = $filepath;
15 15
 }
16 16
 //give addons a chance to autoload their stages too
17
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages',$class_to_filepath);
17
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_9_0__autoloaded_stages', $class_to_filepath);
18 18
 EEH_Autoloader::register_autoloader($class_to_filepath);
19 19
 
20 20
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * @since                4.6.0
31 31
  *
32 32
  */
33
-class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base{
33
+class EE_DMS_Core_4_9_0 extends EE_Data_Migration_Script_Base {
34 34
 
35 35
 	/**
36 36
 	 * return EE_DMS_Core_4_9_0
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function can_migrate_from_version($version_array) {
53 53
 		$version_string = $version_array['Core'];
54
-		if( $version_string <= '4.9.0' && $version_string >= '4.8.0' ){
54
+		if ($version_string <= '4.9.0' && $version_string >= '4.8.0') {
55 55
 //			echo "$version_string can be migrated from";
56 56
 			return true;
57
-		} elseif( ! $version_string ){
57
+		} elseif ( ! $version_string) {
58 58
 //			echo "no version string provided: $version_string";
59 59
 			//no version string provided... this must be pre 4.3
60
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
61
-		}else{
60
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
61
+		} else {
62 62
 //			echo "$version_string doesnt apply";
63 63
 			return false;
64 64
 		}
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 	 * @return bool
80 80
 	 */
81 81
 	public function schema_changes_before_migration() {
82
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
83
-		$now_in_mysql = current_time( 'mysql', true );
82
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
83
+		$now_in_mysql = current_time('mysql', true);
84 84
 
85 85
 		$table_name = 'esp_message';
86
-		$sql="MSG_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
86
+		$sql = "MSG_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
87 87
 					GRP_ID INT(10) UNSIGNED NULL,
88 88
 					MSG_token VARCHAR(255) NULL,
89 89
 					TXN_ID INT(10) UNSIGNED NULL,
@@ -115,17 +115,17 @@  discard block
 block discarded – undo
115 115
 					KEY STS_ID (STS_ID),
116 116
 					KEY MSG_created (MSG_created),
117 117
 					KEY MSG_modified (MSG_modified)";
118
-		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
118
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
119 119
 
120
-		$table_name='esp_answer';
121
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
120
+		$table_name = 'esp_answer';
121
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
122 122
 					REG_ID INT UNSIGNED NOT NULL,
123 123
 					QST_ID INT UNSIGNED NOT NULL,
124 124
 					ANS_value TEXT NOT NULL,
125 125
 					PRIMARY KEY  (ANS_ID),
126 126
 					KEY REG_ID (REG_ID),
127 127
 					KEY QST_ID (QST_ID)";
128
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
128
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
129 129
 
130 130
 		$table_name = 'esp_attendee_meta';
131 131
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 				CNT_is_EU TINYINT(1) DEFAULT '0',
166 166
 				CNT_active TINYINT(1) DEFAULT '0',
167 167
 				PRIMARY KEY  (CNT_ISO)";
168
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
168
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
169 169
 
170 170
 		$table_name = 'esp_currency';
171 171
 		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
176 176
 				CUR_active TINYINT(1) DEFAULT '0',
177 177
 				PRIMARY KEY  (CUR_code)";
178
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
178
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
179 179
 
180 180
 
181 181
 		$table_name = 'esp_currency_payment_method';
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 				KEY EVT_ID (EVT_ID),
206 206
 				KEY DTT_is_primary (DTT_is_primary)";
207 207
 
208
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
208
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209 209
 
210 210
 		$table_name = 'esp_event_meta';
211 211
 		$sql = "
@@ -224,41 +224,41 @@  discard block
 block discarded – undo
224 224
 			EVT_donations TINYINT(1) NULL,
225 225
 			PRIMARY KEY  (EVTM_ID),
226 226
 			KEY EVT_ID (EVT_ID)";
227
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
227
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
228 228
 
229 229
 
230 230
 
231
-		$table_name='esp_event_question_group';
232
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
231
+		$table_name = 'esp_event_question_group';
232
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
233 233
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
234 234
 					QSG_ID INT UNSIGNED NOT NULL,
235 235
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
236 236
 					PRIMARY KEY  (EQG_ID),
237 237
 					KEY EVT_ID (EVT_ID),
238 238
 					KEY QSG_ID (QSG_ID)";
239
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
239
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
240 240
 
241 241
 
242 242
 
243
-		$table_name='esp_event_venue';
244
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
243
+		$table_name = 'esp_event_venue';
244
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
245 245
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
246 246
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
247 247
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
248 248
 				PRIMARY KEY  (EVV_ID)";
249
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
249
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
250 250
 
251 251
 
252 252
 
253
-		$table_name='esp_extra_meta';
254
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
253
+		$table_name = 'esp_extra_meta';
254
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
255 255
 				OBJ_ID INT(11) DEFAULT NULL,
256 256
 				EXM_type VARCHAR(45) DEFAULT NULL,
257 257
 				EXM_key VARCHAR(45) DEFAULT NULL,
258 258
 				EXM_value TEXT,
259 259
 				PRIMARY KEY  (EXM_ID),
260 260
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
261
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
261
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
262 262
 
263 263
 		$table_name = 'esp_extra_join';
264 264
 		$sql = "EXJ_ID INT(11) NOT NULL AUTO_INCREMENT,
@@ -271,8 +271,8 @@  discard block
 block discarded – undo
271 271
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
272 272
 		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
273 273
 
274
-		$table_name='esp_line_item';
275
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
274
+		$table_name = 'esp_line_item';
275
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
276 276
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
277 277
 				TXN_ID INT(11) DEFAULT NULL,
278 278
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 				PRIMARY KEY  (LIN_ID),
292 292
 				KEY LIN_code (LIN_code(191)),
293 293
 				KEY TXN_ID (TXN_ID)";
294
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB' );
294
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
295 295
 
296 296
 		$table_name = 'esp_log';
297 297
 		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
331 331
 					PRIMARY KEY  (GRP_ID),
332 332
 					KEY MTP_user_id (MTP_user_id)";
333
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
333
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
334 334
 
335 335
 		$table_name = 'esp_event_message_template';
336 336
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 					PRIMARY KEY  (EMT_ID),
340 340
 					KEY EVT_ID (EVT_ID),
341 341
 					KEY GRP_ID (GRP_ID)";
342
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
342
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
343 343
 
344 344
 
345 345
 		$table_name = 'esp_payment';
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
 					  PRIMARY KEY  (TTM_ID)";
413 413
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
414 414
 
415
-		$table_name='esp_question';
416
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
415
+		$table_name = 'esp_question';
416
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
417 417
 					QST_display_text TEXT NOT NULL,
418 418
 					QST_admin_label VARCHAR(255) NOT NULL,
419 419
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -427,22 +427,22 @@  discard block
 block discarded – undo
427 427
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
428 428
 					PRIMARY KEY  (QST_ID),
429 429
 					KEY QST_order (QST_order)';
430
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
430
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
431 431
 
432
-		$table_name='esp_question_group_question';
433
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
432
+		$table_name = 'esp_question_group_question';
433
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
434 434
 					QSG_ID INT UNSIGNED NOT NULL,
435 435
 					QST_ID INT UNSIGNED NOT NULL,
436 436
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
437 437
 					PRIMARY KEY  (QGQ_ID),
438 438
 					KEY QST_ID (QST_ID),
439 439
 					KEY QSG_ID_order (QSG_ID,QGQ_order)";
440
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
440
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
441 441
 
442 442
 
443 443
 
444
-		$table_name='esp_question_option';
445
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
444
+		$table_name = 'esp_question_option';
445
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
446 446
 					QSO_value VARCHAR(255) NOT NULL,
447 447
 					QSO_desc TEXT NOT NULL,
448 448
 					QST_ID INT UNSIGNED NOT NULL,
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 					PRIMARY KEY  (QSO_ID),
453 453
 					KEY QST_ID (QST_ID),
454 454
 					KEY QSO_order (QSO_order)";
455
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
455
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
456 456
 
457 457
 
458 458
 
@@ -498,8 +498,8 @@  discard block
 block discarded – undo
498 498
 
499 499
 
500 500
 
501
-		$table_name='esp_checkin';
502
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
501
+		$table_name = 'esp_checkin';
502
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
503 503
 					REG_ID INT(10) UNSIGNED NOT NULL,
504 504
 					DTT_ID INT(10) UNSIGNED NOT NULL,
505 505
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
595 595
 					  PRIMARY KEY  (PRC_ID),
596 596
 					  KEY PRT_ID (PRT_ID)";
597
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
597
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
598 598
 
599 599
 		$table_name = "esp_price_type";
600 600
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -632,10 +632,10 @@  discard block
 block discarded – undo
632 632
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
633 633
 					  PRIMARY KEY  (TKT_ID),
634 634
 					  KEY TKT_start_date (TKT_start_date)";
635
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
635
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
636 636
 
637 637
 		$table_name = 'esp_question_group';
638
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
638
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
639 639
 					QSG_name VARCHAR(255) NOT NULL,
640 640
 					QSG_identifier VARCHAR(100) NOT NULL,
641 641
 					QSG_desc TEXT NULL,
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 					PRIMARY KEY  (QSG_ID),
649 649
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
650 650
 					KEY QSG_order (QSG_order)';
651
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
651
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
652 652
 
653 653
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
654 654
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -682,5 +682,5 @@  discard block
 block discarded – undo
682 682
 		return true;
683 683
 	}
684 684
 
685
-	public function migration_page_hooks(){}
685
+	public function migration_page_hooks() {}
686 686
 }
687 687
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/EEM_Question_Group.model.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- * Event Espresso
4
- *
5
- * Event Registration and Management Plugin for WordPress
6
- *
7
- * @ package			Event Espresso
8
- * @ author				Seth Shoultes
9
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
- * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
- * @ link					http://www.eventespresso.com
12
- * @ version		 	4.0
13
- *
14
- * ------------------------------------------------------------------------
15
- *
16
- * Question Group Model
17
- *
18
- * @package			Event Espresso
19
- * @subpackage		includes/models/
20
- * @author				Michael Nelson
21
- *
22
- * ------------------------------------------------------------------------
23
- */
3
+	 * Event Espresso
4
+	 *
5
+	 * Event Registration and Management Plugin for WordPress
6
+	 *
7
+	 * @ package			Event Espresso
8
+	 * @ author				Seth Shoultes
9
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
+	 * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
+	 * @ link					http://www.eventespresso.com
12
+	 * @ version		 	4.0
13
+	 *
14
+	 * ------------------------------------------------------------------------
15
+	 *
16
+	 * Question Group Model
17
+	 *
18
+	 * @package			Event Espresso
19
+	 * @subpackage		includes/models/
20
+	 * @author				Michael Nelson
21
+	 *
22
+	 * ------------------------------------------------------------------------
23
+	 */
24 24
 require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25 25
 require_once( EE_CLASSES . 'EE_Question_Option.class.php');
26 26
 
Please login to merge, or discard this patch.