Completed
Branch FET-9593-collection-loader-man... (8bd595)
by
unknown
555:03 queued 539:50
created
admin_pages/events/Events_Admin_Page.core.php 1 patch
Spacing   +383 added lines, -383 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
 /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$this->_cpt_edit_routes = array(
67 67
 			'espresso_events' => 'edit'
68 68
 		);
69
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
69
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
70 70
 	}
71 71
 
72 72
 	protected function _ajax_hooks() {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				'edit' => __('Update Event', 'event_espresso'),
93 93
 				'add_category' => __('Save New Category', 'event_espresso'),
94 94
 				'edit_category' => __('Update Category', 'event_espresso'),
95
-				'template_settings' => __( 'Update Settings', 'event_espresso' )
95
+				'template_settings' => __('Update Settings', 'event_espresso')
96 96
 				)
97 97
 		);
98 98
 	}
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		//load field generator helper
103 103
 
104 104
 		//is there a evt_id in the request?
105
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
106
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
105
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
106
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
107 107
 
108 108
 
109 109
 		$this->_page_routes = array(
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 				'help_tour' => array(
318 318
 					'Event_Editor_Help_Tour'
319 319
 					),
320
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
320
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
321 321
 				'require_nonce' => FALSE
322 322
 			),
323 323
 			'edit' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 				/*'help_tour' => array(
374 374
 					'Event_Edit_Help_Tour'
375 375
 				),*/
376
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
376
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
377 377
 				'require_nonce' => FALSE
378 378
 			),
379 379
 			'default_event_settings' => array(
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 						'filename' => 'events_default_settings_status'
396 396
 					)
397 397
 				),
398
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
398
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
399 399
 				'require_nonce' => FALSE
400 400
 			),
401 401
 			//template settings
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 						'filename' => 'general_settings_templates'
412 412
 					)
413 413
 				),
414
-				'help_tour' => array( 'Templates_Help_Tour' ),
414
+				'help_tour' => array('Templates_Help_Tour'),
415 415
 				'require_nonce' => FALSE
416 416
 			),
417 417
 			//event category stuff
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 					'label' => __('Edit Category', 'event_espresso'),
436 436
 					'order' => 15,
437 437
 					'persistent' => FALSE,
438
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
438
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
439 439
 					),
440 440
 				'help_tabs' => array(
441 441
 					'edit_category_help_tab' => array(
@@ -505,14 +505,14 @@  discard block
 block discarded – undo
505 505
 
506 506
 	public function load_scripts_styles() {
507 507
 
508
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
509
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
508
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
509
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
510 510
 		wp_enqueue_style('events-admin-css');
511 511
 		wp_enqueue_style('ee-cat-admin');
512 512
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
513 513
 		//registers for all views
514 514
 		//scripts
515
-		wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
515
+		wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
516 516
 	}
517 517
 
518 518
 	/**
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 	public function load_scripts_styles_edit() {
531 531
 		//styles
532 532
 		wp_enqueue_style('espresso-ui-theme');
533
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
533
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
534 534
 		wp_enqueue_style('event-editor-css');
535 535
 
536 536
 		//scripts
537
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
537
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
538 538
 		wp_enqueue_script('event-datetime-metabox');
539 539
 
540 540
 	}
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 
570 570
 
571 571
 	public function admin_init() {
572
-		EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' );
572
+		EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
573 573
 	}
574 574
 
575 575
 
@@ -590,12 +590,12 @@  discard block
 block discarded – undo
590 590
 	 */
591 591
 	public function verify_event_edit($event = NULL) {
592 592
 		// no event?
593
-		if ( empty( $event )) {
593
+		if (empty($event)) {
594 594
 			// set event
595 595
 			$event = $this->_cpt_model_obj;
596 596
 		}
597 597
 		// STILL no event?
598
-		if ( empty ( $event )) {
598
+		if (empty ($event)) {
599 599
 			return;
600 600
 		}
601 601
 		$orig_status = $event->status();
@@ -609,27 +609,27 @@  discard block
 block discarded – undo
609 609
 			return;
610 610
 		}
611 611
 		//made it here so it IS active... next check that any of the tickets are sold.
612
-		if ( $event->is_sold_out( true ) ) {
613
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
612
+		if ($event->is_sold_out(true)) {
613
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
614 614
 				EE_Error::add_attention(
615 615
 					sprintf(
616
-						__( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso' ),
617
-						EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
616
+						__('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso'),
617
+						EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
618 618
 					)
619 619
 				);
620 620
 			}
621 621
 			return;
622
-		} else if ( $orig_status === EEM_Event::sold_out ) {
622
+		} else if ($orig_status === EEM_Event::sold_out) {
623 623
 			EE_Error::add_attention(
624 624
 				sprintf(
625
-					__( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
626
-						'event_espresso' ),
627
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
625
+					__('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
626
+						'event_espresso'),
627
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
628 628
 				)
629 629
 			);
630 630
 		}
631 631
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
632
-		if ( ! $event->tickets_on_sale() ) {
632
+		if ( ! $event->tickets_on_sale()) {
633 633
 			return;
634 634
 		}
635 635
 		//made it here so show warning
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 */
649 649
 	protected function _edit_event_warning() {
650 650
 		// we don't want to add warnings during these requests
651
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
651
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
652 652
 			return;
653 653
 		}
654 654
 		EE_Error::add_attention(
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 			),
680 680
 		);
681 681
 
682
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
682
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
683 683
 			$this->_views['trash'] = array(
684 684
 				'slug' => 'trash',
685 685
 				'label' => __('Trash', 'event_espresso'),
@@ -709,39 +709,39 @@  discard block
 block discarded – undo
709 709
 				'desc' => __('View Registrations for Event', 'event_espresso')
710 710
 			)
711 711
 		);
712
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
712
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
713 713
 		$statuses = array(
714 714
 			'sold_out_status' => array(
715
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
716
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
715
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
716
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
717 717
 			),
718 718
 			'active_status' => array(
719
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
720
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
719
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
720
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
721 721
 			),
722 722
 			'upcoming_status' => array(
723
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
724
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
723
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
724
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
725 725
 			),
726 726
 			'postponed_status' => array(
727
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
728
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
727
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
728
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
729 729
 			),
730 730
 			'cancelled_status' => array(
731
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
732
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
731
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
732
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
733 733
 			),
734 734
 			'expired_status' => array(
735
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
736
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
735
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
736
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
737 737
 			),
738 738
 			'inactive_status' => array(
739
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
740
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
739
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
740
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
741 741
 			)
742 742
 		);
743
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
744
-		return array_merge( $items, $statuses );
743
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
744
+		return array_merge($items, $statuses);
745 745
 	}
746 746
 
747 747
 
@@ -753,8 +753,8 @@  discard block
 block discarded – undo
753 753
 	 * @return EEM_Event
754 754
 	 */
755 755
 	private function _event_model() {
756
-		if ( ! $this->_event_model instanceof EEM_Event ) {
757
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
756
+		if ( ! $this->_event_model instanceof EEM_Event) {
757
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
758 758
 		}
759 759
 		return $this->_event_model;
760 760
 	}
@@ -773,12 +773,12 @@  discard block
 block discarded – undo
773 773
 	 * @param  string $new_slug  what the slug is
774 774
 	 * @return string            The new html string for the permalink area
775 775
 	 */
776
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
776
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
777 777
 		//make sure this is only when editing
778
-		if ( !empty( $id ) ) {
779
-			$post = get_post( $id );
780
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> ';
781
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">';
778
+		if ( ! empty($id)) {
779
+			$post = get_post($id);
780
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> ';
781
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">';
782 782
 		}
783 783
 		return $return;
784 784
 	}
@@ -794,8 +794,8 @@  discard block
 block discarded – undo
794 794
 	 * @return string html for generated table
795 795
 	 */
796 796
 	protected function _events_overview_list_table() {
797
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
798
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) .
797
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
798
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button').
799 799
 		$this->_display_legend($this->_event_legend_items());
800 800
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
801 801
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -813,51 +813,51 @@  discard block
 block discarded – undo
813 813
 
814 814
 
815 815
 
816
-	protected function _insert_update_cpt_item( $post_id, $post ) {
816
+	protected function _insert_update_cpt_item($post_id, $post) {
817 817
 
818
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
818
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
819 819
 			//getout we're not processing an event save.
820 820
 			return;
821 821
 		}
822 822
 
823 823
 		$event_values = array(
824
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
825
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
824
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
825
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
826 826
 			'EVT_additional_limit' => min(
827
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
828
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
829
-			'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
830
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
831
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
832
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
833
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
834
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
827
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
828
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
829
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
830
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
831
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
832
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
833
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
834
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
835 835
 			);
836 836
 
837 837
 		//update event
838
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
838
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
839 839
 
840 840
 
841 841
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
842
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
843
-		$event = $this->_event_model()->get_one( array($get_one_where) );
842
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
843
+		$event = $this->_event_model()->get_one(array($get_one_where));
844 844
 
845 845
 
846 846
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
847
-		$event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) );
847
+		$event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')));
848 848
 
849 849
 		$att_success = TRUE;
850 850
 
851
-		foreach ( $event_update_callbacks as $e_callback ) {
852
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
853
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
851
+		foreach ($event_update_callbacks as $e_callback) {
852
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
853
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
854 854
 		}
855 855
 
856 856
 		//any errors?
857
-		if ( $success && FALSE === $att_success ) {
858
-			EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
859
-		} else if ( $success === FALSE ) {
860
-			EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
857
+		if ($success && FALSE === $att_success) {
858
+			EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
859
+		} else if ($success === FALSE) {
860
+			EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
861 861
 		}
862 862
 	}
863 863
 
@@ -867,14 +867,14 @@  discard block
 block discarded – undo
867 867
 	/**
868 868
 	 * @see parent::restore_item()
869 869
 	 */
870
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
870
+	protected function _restore_cpt_item($post_id, $revision_id) {
871 871
 		//copy existing event meta to new post
872 872
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
873
-		if ( $post_evt instanceof EE_Event ) {
873
+		if ($post_evt instanceof EE_Event) {
874 874
 			//meta revision restore
875
-			$post_evt->restore_revision( $revision_id );
875
+			$post_evt->restore_revision($revision_id);
876 876
 			//related objs restore
877
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
877
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
878 878
 		}
879 879
 	}
880 880
 
@@ -887,52 +887,52 @@  discard block
 block discarded – undo
887 887
 	 * @param  array  $data   The request data from the form
888 888
 	 * @return bool           Success or fail.
889 889
 	 */
890
-	protected function _default_venue_update( $evtobj, $data ) {
891
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
890
+	protected function _default_venue_update($evtobj, $data) {
891
+		require_once(EE_MODELS.'EEM_Venue.model.php');
892 892
 		$venue_model = EE_Registry::instance()->load_model('Venue');
893 893
 		$rows_affected = NULL;
894
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
894
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
895 895
 
896 896
 		// very important.  If we don't have a venue name...
897 897
 		// then we'll get out because not necessary to create empty venue
898
-		if ( empty( $data['venue_title'] ) ) {
898
+		if (empty($data['venue_title'])) {
899 899
 			return false;
900 900
 		}
901 901
 
902 902
 		$venue_array = array(
903 903
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
904
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
905
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
906
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
907
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
908
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
909
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
910
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
911
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
912
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
913
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
914
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
915
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
916
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
917
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
918
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
919
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
904
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
905
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
906
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
907
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
908
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
909
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
910
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
911
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
912
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
913
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
914
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
915
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
916
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
917
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
918
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
919
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
920 920
 				'status' => 'publish'
921 921
 			);
922 922
 
923 923
 
924 924
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
925
-		if ( !empty( $venue_id ) ) {
926
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
927
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
925
+		if ( ! empty($venue_id)) {
926
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
927
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
928 928
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
929
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
929
+			$evtobj->_add_relation_to($venue_id, 'Venue');
930 930
 			return $rows_affected > 0 ? TRUE : FALSE;
931 931
 		} else {
932 932
 			//we insert the venue
933
-			$venue_id = $venue_model->insert( $venue_array );
934
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
935
-			return !empty( $venue_id ) ? TRUE : FALSE;
933
+			$venue_id = $venue_model->insert($venue_array);
934
+			$evtobj->_add_relation_to($venue_id, 'Venue');
935
+			return ! empty($venue_id) ? TRUE : FALSE;
936 936
 		}
937 937
 		//when we have the ancestor come in it's already been handled by the revision save.
938 938
 	}
@@ -946,54 +946,54 @@  discard block
 block discarded – undo
946 946
 	 * @param  array    $data   The request data from the form
947 947
 	 * @return bool             success or fail
948 948
 	 */
949
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
949
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
950 950
 		$success = true;
951 951
 		$saved_dtt = null;
952 952
 		$saved_tickets = array();
953
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
953
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
954 954
 
955
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
955
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
956 956
 			//trim all values to ensure any excess whitespace is removed.
957
-			$dtt =  array_map( 'trim', $dtt );
958
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
957
+			$dtt = array_map('trim', $dtt);
958
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
959 959
 			$datetime_values = array(
960
-				'DTT_ID' 		=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
960
+				'DTT_ID' 		=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
961 961
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
962 962
 				'DTT_EVT_end' 	=> $dtt['DTT_EVT_end'],
963
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
963
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
964 964
 				'DTT_order' 	=> $row,
965 965
 			);
966 966
 
967 967
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
968 968
 
969
-			if ( !empty( $dtt['DTT_ID'] ) ) {
970
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
971
-				$DTM->set_date_format( $incoming_date_formats[0] );
972
-				$DTM->set_time_format( $incoming_date_formats[1] );
973
-				foreach ( $datetime_values as $field => $value ) {
974
-					$DTM->set( $field, $value );
969
+			if ( ! empty($dtt['DTT_ID'])) {
970
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
971
+				$DTM->set_date_format($incoming_date_formats[0]);
972
+				$DTM->set_time_format($incoming_date_formats[1]);
973
+				foreach ($datetime_values as $field => $value) {
974
+					$DTM->set($field, $value);
975 975
 				}
976 976
 
977 977
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
978 978
 				$saved_dtts[$DTM->ID()] = $DTM;
979 979
 			} else {
980
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
981
-				$DTM->set_date_format( $incoming_date_formats[0] );
982
-				$DTM->set_time_format( $incoming_date_formats[1] );
983
-				$DTM->set_timezone( $evtobj->get_timezone() );
984
-				foreach ( $datetime_values as $field => $value ) {
985
-					$DTM->set( $field, $value );
980
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
981
+				$DTM->set_date_format($incoming_date_formats[0]);
982
+				$DTM->set_time_format($incoming_date_formats[1]);
983
+				$DTM->set_timezone($evtobj->get_timezone());
984
+				foreach ($datetime_values as $field => $value) {
985
+					$DTM->set($field, $value);
986 986
 				}
987 987
 			}
988 988
 			$DTM->save();
989 989
 
990
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
990
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
991 991
 
992 992
 			//load DTT helper
993 993
 
994 994
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
995
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
996
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
995
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
996
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
997 997
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
998 998
 				$DTT->save();
999 999
 			}
@@ -1001,45 +1001,45 @@  discard block
 block discarded – undo
1001 1001
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
1002 1002
 			$saved_dtt = $DTT;
1003 1003
 
1004
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1004
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1005 1005
 		}
1006 1006
 
1007 1007
 		//no dtts get deleted so we don't do any of that logic here.
1008 1008
 		//update tickets next
1009
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
1010
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1011
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1009
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1010
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1011
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1012 1012
 			$update_prices = false;
1013
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1013
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1014 1014
 
1015 1015
 			// trim inputs to ensure any excess whitespace is removed.
1016
-			$tkt = array_map( 'trim', $tkt );
1016
+			$tkt = array_map('trim', $tkt);
1017 1017
 
1018
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1018
+			if (empty($tkt['TKT_start_date'])) {
1019 1019
 				//let's use now in the set timezone.
1020
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1021
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1020
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1021
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1022 1022
 			}
1023 1023
 
1024
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1024
+			if (empty($tkt['TKT_end_date'])) {
1025 1025
 				//use the start date of the first datetime
1026 1026
 				$dtt = $evtobj->first_datetime();
1027
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
1027
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
1028 1028
 			}
1029 1029
 
1030 1030
 			$TKT_values = array(
1031
-				'TKT_ID' 			=> !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1032
-				'TTM_ID' 			=> !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1033
-				'TKT_name' 			=> !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1034
-				'TKT_description' 	=> !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1031
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1032
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1033
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1034
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1035 1035
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
1036 1036
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
1037
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'],
1038
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ],
1039
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1040
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1037
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1038
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1039
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1040
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1041 1041
 				'TKT_row' 			=> $row,
1042
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1042
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1043 1043
 				'TKT_price' 		=> $ticket_price
1044 1044
 			);
1045 1045
 
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
 
1049 1049
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1050
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1050
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1051 1051
 				$TKT_values['TKT_ID'] = 0;
1052 1052
 				$TKT_values['TKT_is_default'] = 0;
1053 1053
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1058,58 +1058,58 @@  discard block
 block discarded – undo
1058 1058
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1059 1059
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1060 1060
 
1061
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1062
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1063
-				if ( $TKT instanceof EE_Ticket ) {
1064
-					$ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1061
+			if ( ! empty($tkt['TKT_ID'])) {
1062
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1063
+				if ($TKT instanceof EE_Ticket) {
1064
+					$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1065 1065
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1066
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false;
1067
-					$TKT->set_date_format( $incoming_date_formats[ 0 ] );
1068
-					$TKT->set_time_format( $incoming_date_formats[ 1 ] );
1066
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false;
1067
+					$TKT->set_date_format($incoming_date_formats[0]);
1068
+					$TKT->set_time_format($incoming_date_formats[1]);
1069 1069
 					//set new values
1070
-					foreach ( $TKT_values as $field => $value ) {
1071
-						if ( $field == 'TKT_qty' ) {
1072
-							$TKT->set_qty( $value );
1070
+					foreach ($TKT_values as $field => $value) {
1071
+						if ($field == 'TKT_qty') {
1072
+							$TKT->set_qty($value);
1073 1073
 						} else {
1074
-							$TKT->set( $field, $value );
1074
+							$TKT->set($field, $value);
1075 1075
 						}
1076 1076
 					}
1077 1077
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1078
-					if ( $create_new_TKT ) {
1078
+					if ($create_new_TKT) {
1079 1079
 						//archive the old ticket first
1080
-						$TKT->set( 'TKT_deleted', 1 );
1080
+						$TKT->set('TKT_deleted', 1);
1081 1081
 						$TKT->save();
1082 1082
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1083
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1083
+						$saved_tickets[$TKT->ID()] = $TKT;
1084 1084
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1085 1085
 						$TKT = clone $TKT;
1086
-						$TKT->set( 'TKT_ID', 0 );
1087
-						$TKT->set( 'TKT_deleted', 0 );
1088
-						$TKT->set( 'TKT_price', $ticket_price );
1089
-						$TKT->set( 'TKT_sold', 0 );
1086
+						$TKT->set('TKT_ID', 0);
1087
+						$TKT->set('TKT_deleted', 0);
1088
+						$TKT->set('TKT_price', $ticket_price);
1089
+						$TKT->set('TKT_sold', 0);
1090 1090
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1091 1091
 						$update_prices = true;
1092 1092
 					}
1093 1093
 					//make sure price is set if it hasn't been already
1094
-					$TKT->set( 'TKT_price', $ticket_price );
1094
+					$TKT->set('TKT_price', $ticket_price);
1095 1095
 				}
1096 1096
 
1097 1097
 			} else {
1098 1098
 				//no TKT_id so a new TKT
1099 1099
 				$TKT_values['TKT_price'] = $ticket_price;
1100
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1101
-				if ( $TKT instanceof EE_Ticket ) {
1100
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1101
+				if ($TKT instanceof EE_Ticket) {
1102 1102
 					//need to reset values to properly account for the date formats
1103
-					$TKT->set_date_format( $incoming_date_formats[0] );
1104
-					$TKT->set_time_format( $incoming_date_formats[1] );
1105
-					$TKT->set_timezone( $evtobj->get_timezone() );
1103
+					$TKT->set_date_format($incoming_date_formats[0]);
1104
+					$TKT->set_time_format($incoming_date_formats[1]);
1105
+					$TKT->set_timezone($evtobj->get_timezone());
1106 1106
 
1107 1107
 					//set new values
1108
-					foreach ( $TKT_values as $field => $value ) {
1109
-						if ( $field == 'TKT_qty' ) {
1110
-							$TKT->set_qty( $value );
1108
+					foreach ($TKT_values as $field => $value) {
1109
+						if ($field == 'TKT_qty') {
1110
+							$TKT->set_qty($value);
1111 1111
 						} else {
1112
-							$TKT->set( $field, $value );
1112
+							$TKT->set($field, $value);
1113 1113
 						}
1114 1114
 					}
1115 1115
 
@@ -1117,31 +1117,31 @@  discard block
 block discarded – undo
1117 1117
 				}
1118 1118
 			}
1119 1119
 			// cap ticket qty by datetime reg limits
1120
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1120
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1121 1121
 			//update ticket.
1122 1122
 			$TKT->save();
1123 1123
 
1124 1124
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1125
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1126
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1125
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1126
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1127 1127
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1128 1128
 				$TKT->save();
1129 1129
 			}
1130 1130
 
1131 1131
 			//initially let's add the ticket to the dtt
1132
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1132
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1133 1133
 
1134 1134
 			$saved_tickets[$TKT->ID()] = $TKT;
1135 1135
 
1136 1136
 			//add prices to ticket
1137
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1137
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1138 1138
 		}
1139 1139
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1140
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1141
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1140
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1141
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1142 1142
 
1143
-		foreach ( $tickets_removed as $id ) {
1144
-			$id = absint( $id );
1143
+		foreach ($tickets_removed as $id) {
1144
+			$id = absint($id);
1145 1145
 
1146 1146
 			//get the ticket for this id
1147 1147
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1150 1150
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1151 1151
 
1152
-			foreach( $dtts as $dtt ) {
1152
+			foreach ($dtts as $dtt) {
1153 1153
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1154 1154
 			}
1155 1155
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1161 1161
 			$tkt_to_remove->delete_permanently();
1162 1162
 		}
1163
-		return array( $saved_dtt, $saved_tickets );
1163
+		return array($saved_dtt, $saved_tickets);
1164 1164
 	}
1165 1165
 
1166 1166
 
@@ -1175,31 +1175,31 @@  discard block
 block discarded – undo
1175 1175
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1176 1176
 	 * @return  void
1177 1177
 	 */
1178
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1179
-		foreach ( $prices as $row => $prc ) {
1178
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1179
+		foreach ($prices as $row => $prc) {
1180 1180
 			$PRC_values = array(
1181
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1182
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1183
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1184
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1185
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1181
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1182
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1183
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1184
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1185
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1186 1186
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1187 1187
 				'PRC_order' => $row
1188 1188
 			);
1189 1189
 
1190
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1190
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1191 1191
 				$PRC_values['PRC_ID'] = 0;
1192
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1192
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1193 1193
 			} else {
1194
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1194
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1195 1195
 				//update this price with new values
1196
-				foreach ( $PRC_values as $field => $newprc ) {
1197
-					$PRC->set( $field, $newprc );
1196
+				foreach ($PRC_values as $field => $newprc) {
1197
+					$PRC->set($field, $newprc);
1198 1198
 				}
1199 1199
 				$PRC->save();
1200 1200
 			}
1201 1201
 
1202
-			$ticket->_add_relation_to( $PRC, 'Price' );
1202
+			$ticket->_add_relation_to($PRC, 'Price');
1203 1203
 		}
1204 1204
 	}
1205 1205
 
@@ -1237,9 +1237,9 @@  discard block
 block discarded – undo
1237 1237
 		//load formatter helper
1238 1238
 
1239 1239
   		//args for getting related registrations
1240
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1241
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1242
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1240
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1241
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1242
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1243 1243
 
1244 1244
 
1245 1245
 		// publish box
@@ -1268,9 +1268,9 @@  discard block
 block discarded – undo
1268 1268
 				),
1269 1269
 				REG_ADMIN_URL
1270 1270
 			),
1271
-			'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ),
1272
-			'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ),
1273
-			'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ),
1271
+			'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args),
1272
+			'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args),
1273
+			'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args),
1274 1274
 			'misc_pub_section_class' => apply_filters(
1275 1275
 				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1276 1276
 				'misc-pub-section'
@@ -1289,9 +1289,9 @@  discard block
 block discarded – undo
1289 1289
 			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1290 1290
 			$this->_cpt_model_obj
1291 1291
 		);
1292
-		$publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean();
1292
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1293 1293
 		// load template
1294
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1294
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1295 1295
 	}
1296 1296
 
1297 1297
 
@@ -1323,16 +1323,16 @@  discard block
 block discarded – undo
1323 1323
 		$this->verify_cpt_object();
1324 1324
 		add_meta_box(
1325 1325
 			'espresso_event_editor_tickets',
1326
-			__( 'Event Datetime & Ticket', 'event_espresso' ),
1327
-			array( $this, 'ticket_metabox' ),
1326
+			__('Event Datetime & Ticket', 'event_espresso'),
1327
+			array($this, 'ticket_metabox'),
1328 1328
 			$this->page_slug,
1329 1329
 			'normal',
1330 1330
 			'high'
1331 1331
 		);
1332 1332
 		add_meta_box(
1333 1333
 			'espresso_event_editor_event_options',
1334
-			__( 'Event Registration Options', 'event_espresso' ),
1335
-			array( $this, 'registration_options_meta_box' ),
1334
+			__('Event Registration Options', 'event_espresso'),
1335
+			array($this, 'registration_options_meta_box'),
1336 1336
 			$this->page_slug,
1337 1337
 			'side',
1338 1338
 			'default'
@@ -1362,36 +1362,36 @@  discard block
 block discarded – undo
1362 1362
 			'disabled' => ''
1363 1363
 			);
1364 1364
 
1365
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1365
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1366 1366
 
1367
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1367
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1368 1368
 
1369 1369
 		/**
1370 1370
 		 * 1. Start with retrieving Datetimes
1371 1371
 		 * 2. Fore each datetime get related tickets
1372 1372
 		 * 3. For each ticket get related prices
1373 1373
 		 */
1374
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1374
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1375 1375
 		/** @type EE_Datetime $first_datetime */
1376
-		$first_datetime = reset( $times );
1376
+		$first_datetime = reset($times);
1377 1377
 		//do we get related tickets?
1378
-		if ( $first_datetime instanceof EE_Datetime
1379
-			&& $first_datetime->ID() !== 0 ) {
1378
+		if ($first_datetime instanceof EE_Datetime
1379
+			&& $first_datetime->ID() !== 0) {
1380 1380
 			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1381 1381
 			$template_args['time'] = $first_datetime;
1382 1382
 			$related_tickets = $first_datetime->tickets(
1383 1383
 				array(
1384
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1384
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1385 1385
 					'default_where_conditions' => 'none'
1386 1386
 				)
1387 1387
 			);
1388 1388
 
1389
-			if ( !empty($related_tickets) ) {
1389
+			if ( ! empty($related_tickets)) {
1390 1390
 				$template_args['total_ticket_rows'] = count($related_tickets);
1391 1391
 				$row = 0;
1392
-				foreach ( $related_tickets as $ticket ) {
1392
+				foreach ($related_tickets as $ticket) {
1393 1393
 					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1394
-					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1394
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1395 1395
 
1396 1396
 					$row++;
1397 1397
 				}
@@ -1399,13 +1399,13 @@  discard block
 block discarded – undo
1399 1399
 				$template_args['total_ticket_rows'] = 1;
1400 1400
 				/** @type EE_Ticket $ticket */
1401 1401
 				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1402
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1402
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1403 1403
 			}
1404 1404
 		} else {
1405 1405
 			$template_args['time'] = $times[0];
1406 1406
 			/** @type EE_Ticket $ticket */
1407 1407
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1408
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1408
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1409 1409
 			// NOTE: we're just sending the first default row
1410 1410
 			// (decaf can't manage default tickets so this should be sufficient);
1411 1411
 		}
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1415 1415
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1416 1416
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1417
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1418
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1417
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1418
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1419 1419
 		EEH_Template::display_template($template, $template_args);
1420 1420
 	}
1421 1421
 
@@ -1430,21 +1430,21 @@  discard block
 block discarded – undo
1430 1430
 	 * @param int        $row
1431 1431
 	 * @return string generated html for the ticket row.
1432 1432
 	 */
1433
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1433
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1434 1434
 		$template_args = array(
1435
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1436
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1435
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1436
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1437 1437
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1438 1438
 			'TKT_ID' => $ticket->get('TKT_ID'),
1439 1439
 			'TKT_name' => $ticket->get('TKT_name'),
1440 1440
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1441 1441
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1442 1442
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1443
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1443
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1444 1444
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1445 1445
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1446
-			'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1447
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1446
+			'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1447
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1448 1448
 			);
1449 1449
 
1450 1450
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1460,23 +1460,23 @@  discard block
 block discarded – undo
1460 1460
 
1461 1461
 		//make sure we have default start and end dates if skeleton
1462 1462
 		//handle rows that should NOT be empty
1463
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1463
+		if (empty($template_args['TKT_start_date'])) {
1464 1464
 			//if empty then the start date will be now.
1465 1465
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1466 1466
 		}
1467 1467
 
1468
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1468
+		if (empty($template_args['TKT_end_date'])) {
1469 1469
 			//get the earliest datetime (if present);
1470
-			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1470
+			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1471 1471
 
1472
-			if ( !empty( $earliest_dtt ) )
1472
+			if ( ! empty($earliest_dtt))
1473 1473
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1474 1474
 			else
1475
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1475
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1476 1476
 		}
1477 1477
 
1478
-		$template_args = array_merge( $template_args, $price_args );
1479
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1478
+		$template_args = array_merge($template_args, $price_args);
1479
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1480 1480
 		return EEH_Template::display_template($template, $template_args, TRUE);
1481 1481
 	}
1482 1482
 
@@ -1505,8 +1505,8 @@  discard block
 block discarded – undo
1505 1505
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1506 1506
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1507 1507
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1508
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
1509
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1508
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
1509
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1510 1510
 		EEH_Template::display_template($templatepath, $template_args);
1511 1511
 	}
1512 1512
 
@@ -1534,21 +1534,21 @@  discard block
 block discarded – undo
1534 1534
 		$EEME = $this->_event_model();
1535 1535
 
1536 1536
 		$offset = ($current_page - 1) * $per_page;
1537
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1537
+		$limit = $count ? NULL : $offset.','.$per_page;
1538 1538
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1539 1539
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1540 1540
 
1541 1541
 		if (isset($this->_req_data['month_range'])) {
1542 1542
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1543
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1544
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1543
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1544
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1545 1545
 		}
1546 1546
 
1547 1547
 		$where = array();
1548 1548
 
1549
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1549
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1550 1550
 		//determine what post_status our condition will have for the query.
1551
-		switch ( $status ) {
1551
+		switch ($status) {
1552 1552
 			case 'month' :
1553 1553
 			case 'today' :
1554 1554
 			case NULL :
@@ -1556,7 +1556,7 @@  discard block
 block discarded – undo
1556 1556
 				break;
1557 1557
 
1558 1558
 			case 'draft' :
1559
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1559
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1560 1560
 				break;
1561 1561
 
1562 1562
 			default :
@@ -1564,43 +1564,43 @@  discard block
 block discarded – undo
1564 1564
 		}
1565 1565
 
1566 1566
 		//categories?
1567
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1567
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1568 1568
 
1569
-		if ( !empty ( $category ) ) {
1569
+		if ( ! empty ($category)) {
1570 1570
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1571 1571
 			$where['Term_Taxonomy.term_id'] = $category;
1572 1572
 		}
1573 1573
 
1574 1574
 		//date where conditions
1575
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1575
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1576 1576
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1577
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1578
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1579
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1580
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1577
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1578
+			$start = $DateTime->format(implode(' ', $start_formats));
1579
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1580
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1581 1581
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1582
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1583
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1584
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1585
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1586
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1587
-			$now = date( 'Y-m-01' );
1588
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1589
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1590
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1591
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1582
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1583
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1584
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1585
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1586
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1587
+			$now = date('Y-m-01');
1588
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1589
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1590
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1591
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1592 1592
 		}
1593 1593
 
1594 1594
 
1595
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1596
-			$where['EVT_wp_user'] =  get_current_user_id();
1595
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1596
+			$where['EVT_wp_user'] = get_current_user_id();
1597 1597
 		} else {
1598
-			if ( ! isset( $where['status'] ) ) {
1599
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1598
+			if ( ! isset($where['status'])) {
1599
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1600 1600
 					$where['OR'] = array(
1601
-						'status*restrict_private' => array( '!=', 'private' ),
1601
+						'status*restrict_private' => array('!=', 'private'),
1602 1602
 						'AND' => array(
1603
-							'status*inclusive' => array( '=', 'private' ),
1603
+							'status*inclusive' => array('=', 'private'),
1604 1604
 							'EVT_wp_user' => get_current_user_id()
1605 1605
 						)
1606 1606
 					);
@@ -1608,16 +1608,16 @@  discard block
 block discarded – undo
1608 1608
 			}
1609 1609
 		}
1610 1610
 
1611
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1612
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1611
+		if (isset($this->_req_data['EVT_wp_user'])) {
1612
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1613 1613
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1614 1614
 			}
1615 1615
 		}
1616 1616
 
1617 1617
 
1618 1618
 		//search query handling
1619
-		if ( isset( $this->_req_data['s'] ) ) {
1620
-			$search_string = '%' . $this->_req_data['s'] . '%';
1619
+		if (isset($this->_req_data['s'])) {
1620
+			$search_string = '%'.$this->_req_data['s'].'%';
1621 1621
 			$where['OR'] = array(
1622 1622
 				'EVT_name' => array('LIKE', $search_string),
1623 1623
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1626,32 +1626,32 @@  discard block
 block discarded – undo
1626 1626
 		}
1627 1627
 
1628 1628
 
1629
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1630
-		$query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data );
1629
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1630
+		$query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data);
1631 1631
 
1632 1632
 
1633 1633
 		//let's first check if we have special requests coming in.
1634
-		if ( isset( $this->_req_data['active_status'] ) ) {
1635
-			switch ( $this->_req_data['active_status'] ) {
1634
+		if (isset($this->_req_data['active_status'])) {
1635
+			switch ($this->_req_data['active_status']) {
1636 1636
 				case 'upcoming' :
1637
-					return $EEME->get_upcoming_events( $query_params, $count );
1637
+					return $EEME->get_upcoming_events($query_params, $count);
1638 1638
 					break;
1639 1639
 
1640 1640
 				case 'expired' :
1641
-					return $EEME->get_expired_events( $query_params, $count );
1641
+					return $EEME->get_expired_events($query_params, $count);
1642 1642
 					break;
1643 1643
 
1644 1644
 				case 'active' :
1645
-					return $EEME->get_active_events( $query_params, $count );
1645
+					return $EEME->get_active_events($query_params, $count);
1646 1646
 					break;
1647 1647
 
1648 1648
 				case 'inactive' :
1649
-					return $EEME->get_inactive_events( $query_params, $count );
1649
+					return $EEME->get_inactive_events($query_params, $count);
1650 1650
 					break;
1651 1651
 			}
1652 1652
 		}
1653 1653
 
1654
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1654
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1655 1655
 
1656 1656
 		return $events;
1657 1657
 	}
@@ -1660,23 +1660,23 @@  discard block
 block discarded – undo
1660 1660
 
1661 1661
 
1662 1662
 	//handling for WordPress CPT actions (trash, restore, delete)
1663
-	public function trash_cpt_item( $post_id ) {
1663
+	public function trash_cpt_item($post_id) {
1664 1664
 		$this->_req_data['EVT_ID'] = $post_id;
1665
-		$this->_trash_or_restore_event( 'trash', FALSE );
1665
+		$this->_trash_or_restore_event('trash', FALSE);
1666 1666
 	}
1667 1667
 
1668 1668
 
1669 1669
 
1670 1670
 
1671
-	public function restore_cpt_item( $post_id ) {
1671
+	public function restore_cpt_item($post_id) {
1672 1672
 		$this->_req_data['EVT_ID'] = $post_id;
1673
-		$this->_trash_or_restore_event( 'draft', FALSE );
1673
+		$this->_trash_or_restore_event('draft', FALSE);
1674 1674
 	}
1675 1675
 
1676 1676
 
1677
-	public function delete_cpt_item( $post_id ) {
1677
+	public function delete_cpt_item($post_id) {
1678 1678
 		$this->_req_data['EVT_ID'] = $post_id;
1679
-		$this->_delete_event( FALSE );
1679
+		$this->_delete_event(FALSE);
1680 1680
 	}
1681 1681
 
1682 1682
 
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
 	 * @param  string $event_status
1689 1689
 	 * @return void
1690 1690
 	 */
1691
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1691
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1692 1692
 		//determine the event id and set to array.
1693 1693
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1694 1694
 		// loop thru events
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
 			// clean status
1697 1697
 			$event_status = sanitize_key($event_status);
1698 1698
 			// grab status
1699
-			if (!empty($event_status)) {
1699
+			if ( ! empty($event_status)) {
1700 1700
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1701 1701
 			} else {
1702 1702
 				$success = FALSE;
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 		}
1711 1711
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1712 1712
 
1713
-		if ( $redirect_after )
1713
+		if ($redirect_after)
1714 1714
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1715 1715
 	}
1716 1716
 
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
 		// clean status
1726 1726
 		$event_status = sanitize_key($event_status);
1727 1727
 		// grab status
1728
-		if (!empty($event_status)) {
1728
+		if ( ! empty($event_status)) {
1729 1729
 			$success = TRUE;
1730 1730
 			//determine the event id and set to array.
1731 1731
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1760,15 +1760,15 @@  discard block
 block discarded – undo
1760 1760
 	 * @param  string $event_status
1761 1761
 	 * @return bool
1762 1762
 	 */
1763
-	private function _change_event_status( $EVT_ID = 0, $event_status = '') {
1763
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1764 1764
 		// grab event id
1765
-		if (!$EVT_ID) {
1765
+		if ( ! $EVT_ID) {
1766 1766
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1767 1767
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1768 1768
 			return FALSE;
1769 1769
 		}
1770 1770
 
1771
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1771
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1772 1772
 
1773 1773
 		// clean status
1774 1774
 		$event_status = sanitize_key($event_status);
@@ -1794,7 +1794,7 @@  discard block
 block discarded – undo
1794 1794
 				$hook = FALSE;
1795 1795
 		}
1796 1796
 		//use class to change status
1797
-		$this->_cpt_model_obj->set_status( $event_status );
1797
+		$this->_cpt_model_obj->set_status($event_status);
1798 1798
 		$success = $this->_cpt_model_obj->save();
1799 1799
 
1800 1800
 		if ($success === FALSE) {
@@ -1816,15 +1816,15 @@  discard block
 block discarded – undo
1816 1816
 	 * @access protected
1817 1817
 	 * @param bool $redirect_after
1818 1818
 	 */
1819
-	protected function _delete_event( $redirect_after = TRUE ) {
1819
+	protected function _delete_event($redirect_after = TRUE) {
1820 1820
 		//determine the event id and set to array.
1821 1821
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1822
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1822
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1823 1823
 
1824 1824
 
1825 1825
 		// loop thru events
1826 1826
 		if ($EVT_ID) {
1827
-			$success = $this->_permanently_delete_event( $EVT_ID );
1827
+			$success = $this->_permanently_delete_event($EVT_ID);
1828 1828
 			// get list of events with no prices
1829 1829
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1830 1830
 			// remove this event from the list of events with no prices
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1839 1839
 		}
1840 1840
 
1841
-		if ( $redirect_after )
1841
+		if ($redirect_after)
1842 1842
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1843 1843
 	}
1844 1844
 
@@ -1856,12 +1856,12 @@  discard block
 block discarded – undo
1856 1856
 		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1857 1857
 		// loop thru events
1858 1858
 		foreach ($EVT_IDs as $EVT_ID) {
1859
-			$EVT_ID = absint( $EVT_ID );
1860
-			if ( $EVT_ID ) {
1861
-				$results = $this->_permanently_delete_event( $EVT_ID );
1859
+			$EVT_ID = absint($EVT_ID);
1860
+			if ($EVT_ID) {
1861
+				$results = $this->_permanently_delete_event($EVT_ID);
1862 1862
 				$success = $results !== FALSE ? $success : FALSE;
1863 1863
 				// remove this event from the list of events with no prices
1864
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1864
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1865 1865
 			} else {
1866 1866
 				$success = FALSE;
1867 1867
 				$msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso');
@@ -1881,9 +1881,9 @@  discard block
 block discarded – undo
1881 1881
 	 * @param  int $EVT_ID
1882 1882
 	 * @return bool
1883 1883
 	 */
1884
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
1884
+	private function _permanently_delete_event($EVT_ID = 0) {
1885 1885
 		// grab event id
1886
-		if ( ! $EVT_ID ) {
1886
+		if ( ! $EVT_ID) {
1887 1887
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1888 1888
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1889 1889
 			return FALSE;
@@ -1892,19 +1892,19 @@  discard block
 block discarded – undo
1892 1892
 			! $this->_cpt_model_obj instanceof EE_Event
1893 1893
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
1894 1894
 		) {
1895
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1895
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1896 1896
 		}
1897 1897
 
1898
-		if ( ! $this->_cpt_model_obj instanceof EE_Event ) {
1898
+		if ( ! $this->_cpt_model_obj instanceof EE_Event) {
1899 1899
 			return false;
1900 1900
 		}
1901 1901
 
1902 1902
 		//need to delete related tickets and prices first.
1903 1903
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1904
-		foreach ( $datetimes as $datetime ) {
1904
+		foreach ($datetimes as $datetime) {
1905 1905
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1906 1906
 			$tickets = $datetime->get_many_related('Ticket');
1907
-			foreach ( $tickets as $ticket ) {
1907
+			foreach ($tickets as $ticket) {
1908 1908
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1909 1909
 				$ticket->delete_related_permanently('Price');
1910 1910
 				$ticket->delete_permanently();
@@ -1914,14 +1914,14 @@  discard block
 block discarded – undo
1914 1914
 
1915 1915
 		//what about related venues or terms?
1916 1916
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1917
-		foreach ( $venues as $venue ) {
1917
+		foreach ($venues as $venue) {
1918 1918
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1919 1919
 		}
1920 1920
 
1921 1921
 		//any attached question groups?
1922 1922
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1923
-		if ( !empty( $question_groups ) ) {
1924
-			foreach ( $question_groups as $question_group ) {
1923
+		if ( ! empty($question_groups)) {
1924
+			foreach ($question_groups as $question_group) {
1925 1925
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1926 1926
 			}
1927 1927
 		}
@@ -1930,12 +1930,12 @@  discard block
 block discarded – undo
1930 1930
 
1931 1931
 
1932 1932
 		//Message Template Groups
1933
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1933
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1934 1934
 
1935 1935
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
1936 1936
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1937 1937
 
1938
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1938
+		foreach ($term_taxonomies as $term_taxonomy) {
1939 1939
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1940 1940
 		}
1941 1941
 
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1950 1950
 			return FALSE;
1951 1951
 		}
1952
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
1952
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
1953 1953
 		return TRUE;
1954 1954
 	}
1955 1955
 
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
 	 */
1967 1967
 	public function total_events() {
1968 1968
 
1969
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
1969
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
1970 1970
 		return $count;
1971 1971
 	}
1972 1972
 
@@ -1981,10 +1981,10 @@  discard block
 block discarded – undo
1981 1981
 	 */
1982 1982
 	public function total_events_draft() {
1983 1983
 		$where = array(
1984
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
1984
+			'status' => array('IN', array('draft', 'auto-draft'))
1985 1985
 			);
1986 1986
 
1987
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1987
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1988 1988
 		return $count;
1989 1989
 	}
1990 1990
 
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 			'status' => 'trash'
2004 2004
 			);
2005 2005
 
2006
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2006
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2007 2007
 		return $count;
2008 2008
 	}
2009 2009
 
@@ -2031,11 +2031,11 @@  discard block
 block discarded – undo
2031 2031
 			// translated
2032 2032
 			TRUE
2033 2033
 		);
2034
-		$this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment;
2034
+		$this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment;
2035 2035
 
2036 2036
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2037 2037
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2038
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2038
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2039 2039
 		$this->display_admin_page_with_sidebar();
2040 2040
 	}
2041 2041
 
@@ -2061,9 +2061,9 @@  discard block
 block discarded – undo
2061 2061
 
2062 2062
 	protected function _template_settings() {
2063 2063
 		$this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso');
2064
-		$this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />';
2065
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>';
2066
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2064
+		$this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />';
2065
+		$this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>';
2066
+		$this->display_admin_caf_preview_page('template_settings_tab');
2067 2067
 	}
2068 2068
 
2069 2069
 
@@ -2076,22 +2076,22 @@  discard block
 block discarded – undo
2076 2076
 	 * @return void
2077 2077
 	 */
2078 2078
 	private function _set_category_object() {
2079
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2079
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2080 2080
 			return; //already have the category object so get out.
2081 2081
 
2082 2082
 		//set default category object
2083 2083
 		$this->_set_empty_category_object();
2084 2084
 
2085 2085
 		//only set if we've got an id
2086
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2086
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2087 2087
 			return;
2088 2088
 		}
2089 2089
 
2090 2090
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2091 2091
 
2092
-		$term = get_term( $category_id, 'espresso_event_categories' );
2092
+		$term = get_term($category_id, 'espresso_event_categories');
2093 2093
 
2094
-		if ( !empty( $term ) ) {
2094
+		if ( ! empty($term)) {
2095 2095
 			$this->_category->category_name = $term->name;
2096 2096
 			$this->_category->category_identifier = $term->slug;
2097 2097
 			$this->_category->category_desc = $term->description;
@@ -2105,13 +2105,13 @@  discard block
 block discarded – undo
2105 2105
 
2106 2106
 	private function _set_empty_category_object() {
2107 2107
 		$this->_category = new stdClass();
2108
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2108
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2109 2109
 		$this->_category->id = $this->_category->parent = 0;
2110 2110
 	}
2111 2111
 
2112 2112
 
2113 2113
 	protected function _category_list_table() {
2114
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2114
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2115 2115
 		$this->_search_btn_label = __('Categories', 'event_espresso');
2116 2116
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2117 2117
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2127,14 +2127,14 @@  discard block
 block discarded – undo
2127 2127
 		$this->_set_add_edit_form_tags($route);
2128 2128
 
2129 2129
 		$this->_set_category_object();
2130
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2130
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2131 2131
 
2132 2132
 		$delete_action = 'delete_category';
2133 2133
 
2134 2134
 		//custom redirect
2135
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2135
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2136 2136
 
2137
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2137
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2138 2138
 
2139 2139
 		//take care of contents
2140 2140
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2148,25 +2148,25 @@  discard block
 block discarded – undo
2148 2148
 			'type' => 'wp_editor',
2149 2149
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2150 2150
 			'class' => 'my_editor_custom',
2151
-			'wpeditor_args' => array('media_buttons' => FALSE )
2151
+			'wpeditor_args' => array('media_buttons' => FALSE)
2152 2152
 		);
2153
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2153
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2154 2154
 
2155
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2155
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2156 2156
 
2157 2157
 		//setup category select for term parents.
2158 2158
 		$category_select_values[] = array(
2159 2159
 			'text' => __('No Parent', 'event_espresso'),
2160 2160
 			'id' => 0
2161 2161
 			);
2162
-		foreach ( $all_terms as $term ) {
2162
+		foreach ($all_terms as $term) {
2163 2163
 			$category_select_values[] = array(
2164 2164
 				'text' => $term->name,
2165 2165
 				'id' => $term->term_id
2166 2166
 				);
2167 2167
 		}
2168 2168
 
2169
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2169
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2170 2170
 
2171 2171
 		$template_args = array(
2172 2172
 			'category' => $this->_category,
@@ -2176,15 +2176,15 @@  discard block
 block discarded – undo
2176 2176
 			'disable' => '',
2177 2177
 			'disabled_message' => FALSE
2178 2178
 			);
2179
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2180
-		return EEH_Template::display_template($template, $template_args, TRUE );
2179
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2180
+		return EEH_Template::display_template($template, $template_args, TRUE);
2181 2181
 	}
2182 2182
 
2183 2183
 
2184 2184
 	protected function _delete_categories() {
2185
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2185
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2186 2186
 
2187
-		foreach ( $cat_ids as $cat_id ) {
2187
+		foreach ($cat_ids as $cat_id) {
2188 2188
 			$this->_delete_category($cat_id);
2189 2189
 		}
2190 2190
 
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 		$query_args = array(
2193 2193
 			'action' => 'category_list'
2194 2194
 			);
2195
-		$this->_redirect_after_action(0,'','',$query_args);
2195
+		$this->_redirect_after_action(0, '', '', $query_args);
2196 2196
 
2197 2197
 	}
2198 2198
 
@@ -2202,61 +2202,61 @@  discard block
 block discarded – undo
2202 2202
 
2203 2203
 	protected function _delete_category($cat_id) {
2204 2204
 		global $wpdb;
2205
-		$cat_id = absint( $cat_id );
2206
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2205
+		$cat_id = absint($cat_id);
2206
+		wp_delete_term($cat_id, 'espresso_event_categories');
2207 2207
 	}
2208 2208
 
2209 2209
 
2210 2210
 
2211 2211
 	protected function _insert_or_update_category($new_category) {
2212 2212
 
2213
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2213
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2214 2214
 		$success = 0; //we already have a success message so lets not send another.
2215 2215
 
2216
-		if ( $cat_id ) {
2216
+		if ($cat_id) {
2217 2217
 			$query_args = array(
2218 2218
 				'action'     => 'edit_category',
2219 2219
 				'EVT_CAT_ID' => $cat_id
2220 2220
 			);
2221 2221
 		} else {
2222
-			$query_args = array( 'action' => 'add_category' );
2222
+			$query_args = array('action' => 'add_category');
2223 2223
 		}
2224
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2224
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2225 2225
 
2226 2226
 	}
2227 2227
 
2228 2228
 
2229 2229
 
2230
-	private function _insert_category( $update = FALSE ) {
2230
+	private function _insert_category($update = FALSE) {
2231 2231
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2232
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2233
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2234
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2232
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2233
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2234
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2235 2235
 
2236
-		if ( empty( $category_name ) ) {
2237
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
2238
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2236
+		if (empty($category_name)) {
2237
+			$msg = __('You must add a name for the category.', 'event_espresso');
2238
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2239 2239
 			return false;
2240 2240
 		}
2241 2241
 
2242
-		$term_args=array(
2242
+		$term_args = array(
2243 2243
 			'name'=>$category_name,
2244 2244
 			'description'=>$category_desc,
2245 2245
 			'parent'=>$category_parent
2246 2246
 		);
2247 2247
 		//was the category_identifier input disabled?
2248
-		if(isset($this->_req_data['category_identifier'])){
2248
+		if (isset($this->_req_data['category_identifier'])) {
2249 2249
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2250 2250
 		}
2251
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2251
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2252 2252
 
2253
-		if ( !is_array( $insert_ids ) ) {
2254
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2255
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2253
+		if ( ! is_array($insert_ids)) {
2254
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
2255
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2256 2256
 		} else {
2257 2257
 			$cat_id = $insert_ids['term_id'];
2258
-			$msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name );
2259
-			EE_Error::add_success( $msg );
2258
+			$msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name);
2259
+			EE_Error::add_success($msg);
2260 2260
 		}
2261 2261
 
2262 2262
 		return $cat_id;
@@ -2265,32 +2265,32 @@  discard block
 block discarded – undo
2265 2265
 
2266 2266
 
2267 2267
 
2268
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2268
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2269 2269
 		global $wpdb;
2270 2270
 
2271 2271
 		//testing term stuff
2272
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2273
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2274
-		$limit = ($current_page-1)*$per_page;
2272
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2273
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2274
+		$limit = ($current_page - 1) * $per_page;
2275 2275
 
2276
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2276
+		$where = array('taxonomy' => 'espresso_event_categories');
2277 2277
 
2278
-		if ( isset( $this->_req_data['s'] ) ) {
2279
-			$sstr = '%' . $this->_req_data['s'] . '%';
2278
+		if (isset($this->_req_data['s'])) {
2279
+			$sstr = '%'.$this->_req_data['s'].'%';
2280 2280
 			$where['OR'] = array(
2281
-				'Term.name' => array( 'LIKE', $sstr),
2282
-				'description' => array( 'LIKE', $sstr )
2281
+				'Term.name' => array('LIKE', $sstr),
2282
+				'description' => array('LIKE', $sstr)
2283 2283
 				);
2284 2284
 		}
2285 2285
 
2286 2286
 		$query_params = array(
2287
-			$where ,
2288
-			'order_by' => array( $orderby => $order ),
2289
-			'limit' => $limit . ',' . $per_page,
2287
+			$where,
2288
+			'order_by' => array($orderby => $order),
2289
+			'limit' => $limit.','.$per_page,
2290 2290
 			'force_join' => array('Term')
2291 2291
 			);
2292 2292
 
2293
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2293
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2294 2294
 
2295 2295
 		return $categories;
2296 2296
 	}
Please login to merge, or discard this patch.
core/exceptions/ExceptionLogger.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		}
72 72
 		$time = time();
73 73
 		$exception_log = '----------------------------------------------------------------------------------------'
74
-		                 . PHP_EOL;
74
+						 . PHP_EOL;
75 75
 		$exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . ']  Exception Details' . PHP_EOL;
76 76
 		$exception_log .= 'Message: ' . $this->exception->getMessage() . PHP_EOL;
77 77
 		$exception_log .= 'Code: ' . $this->exception->getCode() . PHP_EOL;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		$exception_log .= 'Stack trace: ' . PHP_EOL;
81 81
 		$exception_log .= $this->exception->getMessage() . PHP_EOL;
82 82
 		$exception_log .= '----------------------------------------------------------------------------------------'
83
-		                  . PHP_EOL;
83
+						  . PHP_EOL;
84 84
 		try {
85 85
 			\EEH_File::ensure_file_exists_and_is_writable(
86 86
 				EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . $this->log_file_name
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 
4 4
 use Exception;
5 5
 
6
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-	exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 * @param string    $log_file_name
40 40
 	 * @throws InvalidDataTypeException
41 41
 	 */
42
-	public function __construct( Exception $exception, $log_file_name = 'espresso_error_log.txt' ) {
42
+	public function __construct(Exception $exception, $log_file_name = 'espresso_error_log.txt') {
43 43
 		$this->exception = $exception;
44
-		$this->setLogFileName( $log_file_name );
44
+		$this->setLogFileName($log_file_name);
45 45
 	}
46 46
 
47 47
 
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	 * @param string $log_file_name
51 51
 	 * @throws InvalidDataTypeException
52 52
 	 */
53
-	public function setLogFileName( $log_file_name ) {
54
-		if ( ! is_string( $log_file_name ) ) {
55
-			throw new InvalidDataTypeException( '$log_file_name', $log_file_name, 'string' );
53
+	public function setLogFileName($log_file_name) {
54
+		if ( ! is_string($log_file_name)) {
55
+			throw new InvalidDataTypeException('$log_file_name', $log_file_name, 'string');
56 56
 		}
57 57
 		$this->log_file_name = $log_file_name;
58 58
 	}
@@ -65,39 +65,39 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @param bool  $clear
67 67
 	 */
68
-	public function log( $clear = false ) {
69
-		if ( ! $this->exception instanceof Exception ) {
68
+	public function log($clear = false) {
69
+		if ( ! $this->exception instanceof Exception) {
70 70
 			return;
71 71
 		}
72 72
 		$time = time();
73 73
 		$exception_log = '----------------------------------------------------------------------------------------'
74 74
 		                 . PHP_EOL;
75
-		$exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . ']  Exception Details' . PHP_EOL;
76
-		$exception_log .= 'Message: ' . $this->exception->getMessage() . PHP_EOL;
77
-		$exception_log .= 'Code: ' . $this->exception->getCode() . PHP_EOL;
78
-		$exception_log .= 'File: ' . $this->exception->getFile() . PHP_EOL;
79
-		$exception_log .= 'Line No: ' . $this->exception->getLine() . PHP_EOL;
80
-		$exception_log .= 'Stack trace: ' . PHP_EOL;
81
-		$exception_log .= $this->exception->getMessage() . PHP_EOL;
75
+		$exception_log .= '['.date('Y-m-d H:i:s', $time).']  Exception Details'.PHP_EOL;
76
+		$exception_log .= 'Message: '.$this->exception->getMessage().PHP_EOL;
77
+		$exception_log .= 'Code: '.$this->exception->getCode().PHP_EOL;
78
+		$exception_log .= 'File: '.$this->exception->getFile().PHP_EOL;
79
+		$exception_log .= 'Line No: '.$this->exception->getLine().PHP_EOL;
80
+		$exception_log .= 'Stack trace: '.PHP_EOL;
81
+		$exception_log .= $this->exception->getMessage().PHP_EOL;
82 82
 		$exception_log .= '----------------------------------------------------------------------------------------'
83 83
 		                  . PHP_EOL;
84 84
 		try {
85 85
 			\EEH_File::ensure_file_exists_and_is_writable(
86
-				EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . $this->log_file_name
86
+				EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.$this->log_file_name
87 87
 			);
88
-			\EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' );
89
-			if ( ! $clear ) {
88
+			\EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs');
89
+			if ( ! $clear) {
90 90
 				//get existing log file and append new log info
91 91
 				$exception_log = \EEH_File::get_file_contents(
92
-						EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . $this->log_file_name
93
-					) . $exception_log;
92
+						EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.$this->log_file_name
93
+					).$exception_log;
94 94
 			}
95 95
 			\EEH_File::write_to_file(
96
-				EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . $this->log_file_name,
96
+				EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.$this->log_file_name,
97 97
 				$exception_log
98 98
 			);
99
-		} catch ( \Exception $e ) {
100
-			$handler = new \EventEspresso\Core\Exceptions\ExceptionHandler( $e );
99
+		} catch (\Exception $e) {
100
+			$handler = new \EventEspresso\Core\Exceptions\ExceptionHandler($e);
101 101
 			$handler->display();
102 102
 		}
103 103
 	}
Please login to merge, or discard this patch.
core/exceptions/BaseException.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\Core\Exceptions;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 	 * @param \Exception $previous
26 26
 	 * @throws \EventEspresso\Core\Exceptions\BaseException
27 27
 	 */
28
-	public function __construct( $message, $code = 0, \Exception $previous = null ) {
29
-		parent::__construct( $message, $code, $previous );
28
+	public function __construct($message, $code = 0, \Exception $previous = null) {
29
+		parent::__construct($message, $code, $previous);
30 30
 	}
31 31
 
32 32
 
Please login to merge, or discard this patch.
core/exceptions/ExceptionHandler.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -168,28 +168,28 @@  discard block
 block discarded – undo
168 168
 					$trace_details .= '
169 169
 					<tr>
170 170
 						<td align="right" valign="top" class="'
171
-					                  . $corellian_bloodstripe
172
-					                  . '">'
173
-					                  . $nmbr
174
-					                  . '</td>
171
+									  . $corellian_bloodstripe
172
+									  . '">'
173
+									  . $nmbr
174
+									  . '</td>
175 175
 						<td align="right" valign="top" class="'
176
-					                  . $corellian_bloodstripe
177
-					                  . '">'
178
-					                  . $line
179
-					                  . '</td>
176
+									  . $corellian_bloodstripe
177
+									  . '">'
178
+									  . $line
179
+									  . '</td>
180 180
 						<td align="left" valign="top" class="'
181
-					                  . $corellian_bloodstripe
182
-					                  . '">'
183
-					                  . $file
184
-					                  . '</td>
181
+									  . $corellian_bloodstripe
182
+									  . '">'
183
+									  . $file
184
+									  . '</td>
185 185
 						<td align="left" valign="top" class="'
186
-					                  . $corellian_bloodstripe
187
-					                  . '">'
188
-					                  . $class_display
189
-					                  . $type
190
-					                  . $function
191
-					                  . $args
192
-					                  . '</td>
186
+									  . $corellian_bloodstripe
187
+									  . '">'
188
+									  . $class_display
189
+									  . $type
190
+									  . $function
191
+									  . $args
192
+									  . '</td>
193 193
 					</tr>';
194 194
 				}
195 195
 				$trace_details .= '
@@ -200,51 +200,51 @@  discard block
 block discarded – undo
200 200
 			// add generic non-identifying messages for non-privileged users
201 201
 			if ( ! WP_DEBUG ) {
202 202
 				$this->pretty_exception .= '<span class="ee-error-user-msg-spn">'
203
-				           . trim( $msg )
204
-				           . '</span> &nbsp; <sup>'
205
-				           . $error_code
206
-				           . '</sup><br />';
203
+						   . trim( $msg )
204
+						   . '</span> &nbsp; <sup>'
205
+						   . $error_code
206
+						   . '</sup><br />';
207 207
 			} else {
208 208
 				// or helpful developer messages if debugging is on
209 209
 				$this->pretty_exception .= '
210 210
 		<div class="ee-error-dev-msg-dv">
211 211
 			<p class="ee-error-dev-msg-pg">
212 212
 				'
213
-				           . sprintf(
214
-					           __( '%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso' ),
215
-					           '<strong class="ee-error-dev-msg-str">',
216
-					           get_class( $this->exception ),
217
-					           '</strong>  &nbsp; <span>',
218
-					           $error_code . '</span>'
219
-				           )
220
-				           . '<br />
213
+						   . sprintf(
214
+							   __( '%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso' ),
215
+							   '<strong class="ee-error-dev-msg-str">',
216
+							   get_class( $this->exception ),
217
+							   '</strong>  &nbsp; <span>',
218
+							   $error_code . '</span>'
219
+						   )
220
+						   . '<br />
221 221
 				<span class="big-text">"'
222
-				           . trim( $msg )
223
-				           . '"</span><br/>
222
+						   . trim( $msg )
223
+						   . '"</span><br/>
224 224
 				<a id="display-ee-error-trace'
225
-				           . $this->time
226
-				           . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace'
227
-				           . $this->time
228
-				           . '">
225
+						   . $this->time
226
+						   . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace'
227
+						   . $this->time
228
+						   . '">
229 229
 					'
230
-				           . __( 'click to view backtrace and class/method details', 'event_espresso' )
231
-				           . '
230
+						   . __( 'click to view backtrace and class/method details', 'event_espresso' )
231
+						   . '
232 232
 				</a><br />
233 233
 				'
234
-				           . $this->exception->getFile()
235
-				           . sprintf(
236
-					           __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ),
237
-					           ' &nbsp; <span class="small-text lt-grey-text">',
238
-					           $this->exception->getLine(),
239
-					           '</span>'
240
-				           )
241
-				           . '
234
+						   . $this->exception->getFile()
235
+						   . sprintf(
236
+							   __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ),
237
+							   ' &nbsp; <span class="small-text lt-grey-text">',
238
+							   $this->exception->getLine(),
239
+							   '</span>'
240
+						   )
241
+						   . '
242 242
 			</p>
243 243
 			<div id="ee-error-trace'
244
-				           . $this->time
245
-				           . '-dv" class="ee-error-trace-dv" style="display: none;">
244
+						   . $this->time
245
+						   . '-dv" class="ee-error-trace-dv" style="display: none;">
246 246
 				'
247
-				           . $trace_details;
247
+						   . $trace_details;
248 248
 				if ( ! empty( $class ) ) {
249 249
 					$this->pretty_exception .= '
250 250
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;">
Please login to merge, or discard this patch.
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 
4 4
 use Exception;
5 5
 
6
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-	exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @param \Exception      $exception
48 48
 	 * @param ExceptionLogger $logger
49 49
 	 */
50
-	public function __construct( Exception $exception, ExceptionLogger $logger = null ) {
50
+	public function __construct(Exception $exception, ExceptionLogger $logger = null) {
51 51
 		$this->time = time();
52 52
 		$this->exception = $exception;
53 53
 		$this->logger = $logger;
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 
59 59
 	public function display() {
60 60
 		$this->format_error();
61
-		if ( defined( 'DOING_AJAX' ) ) {
62
-			echo json_encode( array( 'error' => $this->pretty_exception ) );
61
+		if (defined('DOING_AJAX')) {
62
+			echo json_encode(array('error' => $this->pretty_exception));
63 63
 			exit();
64 64
 		}
65 65
 		echo $this->pretty_exception;
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 
76 76
 
77 77
 	public function log() {
78
-		if ( ! $this->logger instanceof ExceptionLogger ) {
79
-			$this->logger = new ExceptionLogger( $this->exception );
78
+		if ( ! $this->logger instanceof ExceptionLogger) {
79
+			$this->logger = new ExceptionLogger($this->exception);
80 80
 		}
81 81
 		$this->logger->log();
82 82
 	}
@@ -100,20 +100,20 @@  discard block
 block discarded – undo
100 100
 		$error_code = '';
101 101
 		$trace_details = '';
102 102
 		// get separate user and developer messages if they exist
103
-		$msg = explode( '||', $this->exception->getMessage() );
103
+		$msg = explode('||', $this->exception->getMessage());
104 104
 		$user_msg = $msg[0];
105
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
105
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
106 106
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
107 107
 		$backtrace = $this->exception->getTrace();
108 108
 		$this->pretty_exception = ExceptionHandler::_exception_styles();
109 109
 		$this->pretty_exception .= '
110 110
 <div id="ee-error-message" class="error">';
111
-		if ( ! WP_DEBUG ) {
111
+		if ( ! WP_DEBUG) {
112 112
 			$this->pretty_exception .= '
113 113
 	<p>';
114 114
 		}
115 115
 			// process trace info
116
-			if ( empty( $backtrace ) ) {
116
+			if (empty($backtrace)) {
117 117
 				$trace_details .= __(
118 118
 					'Sorry, but no trace information was available for this exception.',
119 119
 					'event_espresso'
@@ -126,45 +126,45 @@  discard block
 block discarded – undo
126 126
 					<th scope="col" align="right" style="width:2.5%;">#</th>
127 127
 					<th scope="col" align="right" style="width:3.5%;">Line</th>
128 128
 					<th scope="col" align="left" style="width:40%;">File</th>
129
-					<th scope="col" align="left">' . __( 'Class', 'event_espresso' ) . '->' . __(
129
+					<th scope="col" align="left">' . __('Class', 'event_espresso').'->'.__(
130 130
 						'Method( arguments )',
131 131
 						'event_espresso'
132
-					) . '</th>
132
+					).'</th>
133 133
 				</tr>';
134
-				$last_on_stack = count( $backtrace ) - 1;
134
+				$last_on_stack = count($backtrace) - 1;
135 135
 				// reverse array so that stack is in proper chronological order
136
-				$sorted_trace = array_reverse( $backtrace );
137
-				foreach ( $sorted_trace as $nmbr => $trace ) {
138
-					$file = isset( $trace['file'] ) ? $trace['file'] : '';
139
-					$class = isset( $trace['class'] ) ? $trace['class'] : '';
140
-					$type = isset( $trace['type'] ) ? $trace['type'] : '';
141
-					$function = isset( $trace['function'] ) ? $trace['function'] : '';
142
-					$args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : '';
143
-					$args = isset( $trace['args'] ) && count( $trace['args'] ) > 4 ? ' <br />' . $args . '<br />'
136
+				$sorted_trace = array_reverse($backtrace);
137
+				foreach ($sorted_trace as $nmbr => $trace) {
138
+					$file = isset($trace['file']) ? $trace['file'] : '';
139
+					$class = isset($trace['class']) ? $trace['class'] : '';
140
+					$type = isset($trace['type']) ? $trace['type'] : '';
141
+					$function = isset($trace['function']) ? $trace['function'] : '';
142
+					$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
143
+					$args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />'.$args.'<br />'
144 144
 						: $args;
145
-					$line = isset( $trace['line'] ) ? $trace['line'] : '';
145
+					$line = isset($trace['line']) ? $trace['line'] : '';
146 146
 					$corellian_bloodstripe = $nmbr % 2 !== 0 ? ' odd' : '';
147
-					if ( empty( $file ) && ! empty( $class ) ) {
148
-						$a = new \ReflectionClass( $class );
147
+					if (empty($file) && ! empty($class)) {
148
+						$a = new \ReflectionClass($class);
149 149
 						$file = $a->getFileName();
150
-						if ( empty( $line ) && ! empty( $function ) ) {
151
-							$b = new \ReflectionMethod( $class, $function );
150
+						if (empty($line) && ! empty($function)) {
151
+							$b = new \ReflectionMethod($class, $function);
152 152
 							$line = $b->getStartLine();
153 153
 						}
154 154
 					}
155
-					if ( $nmbr === $last_on_stack ) {
155
+					if ($nmbr === $last_on_stack) {
156 156
 						$file = $this->exception->getFile() !== '' ? $this->exception->getFile() : $file;
157 157
 						$line = $this->exception->getLine() !== '' ? $this->exception->getLine() : $line;
158
-						$error_code = self::generate_error_code( $file, $trace['function'], $line );
158
+						$error_code = self::generate_error_code($file, $trace['function'], $line);
159 159
 					}
160
-					$file = \EEH_File::standardise_directory_separators( $file );
161
-					$nmbr = ! empty( $nmbr ) ? $nmbr : '&nbsp;';
162
-					$line = ! empty( $line ) ? $line : '&nbsp;';
163
-					$file = ! empty( $file ) ? $file : '&nbsp;';
164
-					$class_display = ! empty( $class ) ? $class : '';
165
-					$type = ! empty( $type ) ? $type : '';
166
-					$function = ! empty( $function ) ? $function : '';
167
-					$args = ! empty( $args ) ? '( ' . $args . ' )' : '()';
160
+					$file = \EEH_File::standardise_directory_separators($file);
161
+					$nmbr = ! empty($nmbr) ? $nmbr : '&nbsp;';
162
+					$line = ! empty($line) ? $line : '&nbsp;';
163
+					$file = ! empty($file) ? $file : '&nbsp;';
164
+					$class_display = ! empty($class) ? $class : '';
165
+					$type = ! empty($type) ? $type : '';
166
+					$function = ! empty($function) ? $function : '';
167
+					$args = ! empty($args) ? '( '.$args.' )' : '()';
168 168
 					$trace_details .= '
169 169
 					<tr>
170 170
 						<td align="right" valign="top" class="'
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
 			}
199 199
 		$error_code = $this->exception->getCode() ? $this->exception->getCode() : $error_code;
200 200
 			// add generic non-identifying messages for non-privileged users
201
-			if ( ! WP_DEBUG ) {
201
+			if ( ! WP_DEBUG) {
202 202
 				$this->pretty_exception .= '<span class="ee-error-user-msg-spn">'
203
-				           . trim( $msg )
203
+				           . trim($msg)
204 204
 				           . '</span> &nbsp; <sup>'
205 205
 				           . $error_code
206 206
 				           . '</sup><br />';
@@ -211,15 +211,15 @@  discard block
 block discarded – undo
211 211
 			<p class="ee-error-dev-msg-pg">
212 212
 				'
213 213
 				           . sprintf(
214
-					           __( '%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso' ),
214
+					           __('%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso'),
215 215
 					           '<strong class="ee-error-dev-msg-str">',
216
-					           get_class( $this->exception ),
216
+					           get_class($this->exception),
217 217
 					           '</strong>  &nbsp; <span>',
218
-					           $error_code . '</span>'
218
+					           $error_code.'</span>'
219 219
 				           )
220 220
 				           . '<br />
221 221
 				<span class="big-text">"'
222
-				           . trim( $msg )
222
+				           . trim($msg)
223 223
 				           . '"</span><br/>
224 224
 				<a id="display-ee-error-trace'
225 225
 				           . $this->time
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 				           . $this->time
228 228
 				           . '">
229 229
 					'
230
-				           . __( 'click to view backtrace and class/method details', 'event_espresso' )
230
+				           . __('click to view backtrace and class/method details', 'event_espresso')
231 231
 				           . '
232 232
 				</a><br />
233 233
 				'
234 234
 				           . $this->exception->getFile()
235 235
 				           . sprintf(
236
-					           __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ),
236
+					           __('%1$s( line no: %2$s )%3$s', 'event_espresso'),
237 237
 					           ' &nbsp; <span class="small-text lt-grey-text">',
238 238
 					           $this->exception->getLine(),
239 239
 					           '</span>'
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
 				           . '-dv" class="ee-error-trace-dv" style="display: none;">
246 246
 				'
247 247
 				           . $trace_details;
248
-				if ( ! empty( $class ) ) {
248
+				if ( ! empty($class)) {
249 249
 					$this->pretty_exception .= '
250 250
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;">
251 251
 					<div style="padding:1em 2em; border:1px solid #999; background:#fcfcfc;">
252
-						<h3>' . __( 'Class Details', 'event_espresso' ) . '</h3>';
253
-					$a = new \ReflectionClass( $class );
252
+						<h3>' . __('Class Details', 'event_espresso').'</h3>';
253
+					$a = new \ReflectionClass($class);
254 254
 					$this->pretty_exception .= '
255
-						<pre>' . $a . '</pre>
255
+						<pre>' . $a.'</pre>
256 256
 					</div>
257 257
 				</div>';
258 258
 				}
@@ -264,13 +264,13 @@  discard block
 block discarded – undo
264 264
 
265 265
 		// remove last linebreak
266 266
 		// $this->pretty_exception = substr( $this->pretty_exception, 0, count( $this->pretty_exception ) - 7 );
267
-		if ( ! WP_DEBUG ) {
267
+		if ( ! WP_DEBUG) {
268 268
 			$this->pretty_exception .= '
269 269
 	</p>';
270 270
 		}
271 271
 		$this->pretty_exception .= '
272 272
 </div>';
273
-		$this->pretty_exception .= self::_print_scripts( true );
273
+		$this->pretty_exception .= self::_print_scripts(true);
274 274
 	}
275 275
 
276 276
 
@@ -283,56 +283,56 @@  discard block
 block discarded – undo
283 283
 	 * @param bool  $array
284 284
 	 * @return string
285 285
 	 */
286
-	private function _convert_args_to_string( $arguments = array(), $indent = 0, $array = false ) {
286
+	private function _convert_args_to_string($arguments = array(), $indent = 0, $array = false) {
287 287
 		$args = array();
288
-		$args_count = count( $arguments );
289
-		if ( $args_count > 2 ) {
288
+		$args_count = count($arguments);
289
+		if ($args_count > 2) {
290 290
 			$indent++;
291 291
 			$args[] = '<br />';
292 292
 		}
293 293
 		$x = 0;
294
-		foreach ( $arguments as $arg ) {
294
+		foreach ($arguments as $arg) {
295 295
 			$x++;
296
-			for ( $i = 0; $i < $indent; $i++ ) {
296
+			for ($i = 0; $i < $indent; $i++) {
297 297
 				$args[] = ' &nbsp;&nbsp; ';
298 298
 			}
299
-			if ( is_string( $arg ) ) {
300
-				if ( ! $array && strlen( $arg ) > 75 ) {
299
+			if (is_string($arg)) {
300
+				if ( ! $array && strlen($arg) > 75) {
301 301
 					$args[] = "<br />";
302
-					for ( $i = 0; $i <= $indent; $i++ ) {
302
+					for ($i = 0; $i <= $indent; $i++) {
303 303
 						$args[] = ' &nbsp;&nbsp; ';
304 304
 					}
305
-					$args[] = "'" . $arg . "'<br />";
305
+					$args[] = "'".$arg."'<br />";
306 306
 				} else {
307
-					$args[] = " '" . $arg . "'";
307
+					$args[] = " '".$arg."'";
308 308
 				}
309
-			} elseif ( is_array( $arg ) ) {
310
-				$arg_count = count( $arg );
311
-				if ( $arg_count > 2 ) {
309
+			} elseif (is_array($arg)) {
310
+				$arg_count = count($arg);
311
+				if ($arg_count > 2) {
312 312
 					$indent++;
313
-					$args[] = " array(" . $this->_convert_args_to_string( $arg, $indent, true ) . ")";
313
+					$args[] = " array(".$this->_convert_args_to_string($arg, $indent, true).")";
314 314
 					$indent--;
315
-				} else if ( $arg_count === 0 ) {
315
+				} else if ($arg_count === 0) {
316 316
 					$args[] = " array()";
317 317
 				} else {
318
-					$args[] = " array( " . $this->_convert_args_to_string( $arg ) . " )";
318
+					$args[] = " array( ".$this->_convert_args_to_string($arg)." )";
319 319
 				}
320
-			} elseif ( $arg === null ) {
320
+			} elseif ($arg === null) {
321 321
 				$args[] = ' null';
322
-			} elseif ( is_bool( $arg ) ) {
322
+			} elseif (is_bool($arg)) {
323 323
 				$args[] = $arg ? ' true' : ' false';
324
-			} elseif ( is_object( $arg ) ) {
325
-				$args[] = get_class( $arg );
326
-			} elseif ( is_resource( $arg ) ) {
327
-				$args[] = get_resource_type( $arg );
324
+			} elseif (is_object($arg)) {
325
+				$args[] = get_class($arg);
326
+			} elseif (is_resource($arg)) {
327
+				$args[] = get_resource_type($arg);
328 328
 			} else {
329 329
 				$args[] = $arg;
330 330
 			}
331
-			if ( $x === $args_count ) {
332
-				if ( $args_count > 2 ) {
331
+			if ($x === $args_count) {
332
+				if ($args_count > 2) {
333 333
 					$args[] = "<br />";
334 334
 					$indent--;
335
-					for ( $i = 1; $i < $indent; $i++ ) {
335
+					for ($i = 1; $i < $indent; $i++) {
336 336
 						$args[] = ' &nbsp;&nbsp; ';
337 337
 					}
338 338
 				}
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 				$args[] = $args_count > 2 ? ",<br />" : ', ';
341 341
 			}
342 342
 		}
343
-		return implode( '', $args );
343
+		return implode('', $args);
344 344
 	}
345 345
 
346 346
 
@@ -355,11 +355,11 @@  discard block
 block discarded – undo
355 355
 	 * @param string $line
356 356
 	 * @return string
357 357
 	 */
358
-	public static function generate_error_code( $file = '', $func = '', $line = '' ) {
359
-		$file_bits = explode( '.', basename( $file ) );
360
-		$error_code = ! empty( $file_bits[0] ) ? $file_bits[0] : '';
361
-		$error_code .= ! empty( $func ) ? ' - ' . $func : '';
362
-		$error_code .= ! empty( $line ) ? ' - ' . $line : '';
358
+	public static function generate_error_code($file = '', $func = '', $line = '') {
359
+		$file_bits = explode('.', basename($file));
360
+		$error_code = ! empty($file_bits[0]) ? $file_bits[0] : '';
361
+		$error_code .= ! empty($func) ? ' - '.$func : '';
362
+		$error_code .= ! empty($line) ? ' - '.$line : '';
363 363
 		return $error_code;
364 364
 	}
365 365
 
@@ -438,26 +438,26 @@  discard block
 block discarded – undo
438 438
 	 * @param bool $force_print
439 439
 	 * @return string|void
440 440
 	 */
441
-	private static function _print_scripts( $force_print = false ) {
442
-		if ( ! $force_print && ( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' ) ) ) {
443
-			if ( wp_script_is( 'ee_error_js', 'enqueued' ) ) {
441
+	private static function _print_scripts($force_print = false) {
442
+		if ( ! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) {
443
+			if (wp_script_is('ee_error_js', 'enqueued')) {
444 444
 				return '';
445
-			} else if ( wp_script_is( 'ee_error_js', 'registered' ) ) {
446
-				add_filter( 'FHEE_load_css', '__return_true' );
447
-				add_filter( 'FHEE_load_js', '__return_true' );
448
-				wp_enqueue_script( 'ee_error_js' );
449
-				wp_localize_script( 'ee_error_js', 'ee_settings', array( 'wp_debug' => WP_DEBUG ) );
445
+			} else if (wp_script_is('ee_error_js', 'registered')) {
446
+				add_filter('FHEE_load_css', '__return_true');
447
+				add_filter('FHEE_load_js', '__return_true');
448
+				wp_enqueue_script('ee_error_js');
449
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug' => WP_DEBUG));
450 450
 			}
451 451
 		} else {
452 452
 			return '
453 453
 <script>
454 454
 /* <![CDATA[ */
455
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
455
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
456 456
 /* ]]> */
457 457
 </script>
458
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
459
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
460
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
458
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
459
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
460
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
461 461
 ';
462 462
 		}
463 463
 		return '';
Please login to merge, or discard this patch.