Completed
Branch ENH-9844-update-decaf-rating-l... (cc0077)
by
unknown
99:38 queued 88:56
created
admin_pages/registrations/Registrations_Admin_Page.core.php 2 patches
Braces   +27 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -118,8 +120,9 @@  discard block
 block discarded – undo
118 120
 	public function clear_comment_link( $link, $comment, $args ) {
119 121
 		//gotta make sure this only happens on this route
120 122
 		$post_type = get_post_type( $comment->comment_post_ID);
121
-		if ( $post_type == 'espresso_attendees' )
122
-			return '#commentsdiv';
123
+		if ( $post_type == 'espresso_attendees' ) {
124
+					return '#commentsdiv';
125
+		}
123 126
 		return $link;
124 127
 	}
125 128
 
@@ -890,9 +893,9 @@  discard block
 block discarded – undo
890 893
 
891 894
 		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
892 895
 
893
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
894
-			return TRUE;
895
-		else {
896
+		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) {
897
+					return TRUE;
898
+		} else {
896 899
 			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
897 900
 			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
898 901
 			$this->_registration = NULL;
@@ -987,7 +990,7 @@  discard block
 block discarded – undo
987 990
 					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
988 991
 					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
989 992
 			));
990
-		}elseif($this_month_a || $this_month){
993
+		} elseif($this_month_a || $this_month){
991 994
 			$this_month_r = date('m', current_time('timestamp'));
992 995
 			$days_this_month = date( 't', current_time('timestamp') );
993 996
 			$_where['REG_date']= array('BETWEEN',
@@ -995,18 +998,18 @@  discard block
 block discarded – undo
995 998
 					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
996 999
 					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' )
997 1000
 			));
998
-		}elseif($month_range){
1001
+		} elseif($month_range){
999 1002
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1000 1003
 			$month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : '';
1001 1004
 			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1002 1005
 			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
1003 1006
 			$_where['REG_date']= array('BETWEEN',
1004 1007
 				array(  EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month .  ' 23:59:59', 'Y-m-d H:i:s' ) ) );
1005
-		}elseif($start_date && $end_date){
1008
+		} elseif($start_date && $end_date){
1006 1009
 			throw new EE_Error("not yet supported");
1007
-		}elseif($start_date){
1010
+		} elseif($start_date){
1008 1011
 			throw new EE_Error("not yet supported");
1009
-		}elseif($end_date){
1012
+		} elseif($end_date){
1010 1013
 			throw new EE_Error("not yet supported");
1011 1014
 		}
1012 1015
 
@@ -1939,8 +1942,9 @@  discard block
 block discarded – undo
1939 1942
 			// cycle thru checkboxes
1940 1943
 			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1941 1944
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1942
-				if ( ! $REG instanceof EE_Registration )
1943
-					continue;
1945
+				if ( ! $REG instanceof EE_Registration ) {
1946
+									continue;
1947
+				}
1944 1948
 				$deleted = $this->_delete_registration($REG);
1945 1949
 				if ( !$deleted ) {
1946 1950
 					$success = 0;
@@ -1979,8 +1983,9 @@  discard block
 block discarded – undo
1979 1983
 
1980 1984
 		$all_trashed = TRUE;
1981 1985
 		foreach ( $REGS as $registration ) {
1982
-			if ( ! $registration->get('REG_deleted') )
1983
-				$all_trashed = FALSE;
1986
+			if ( ! $registration->get('REG_deleted') ) {
1987
+							$all_trashed = FALSE;
1988
+			}
1984 1989
 		}
1985 1990
 
1986 1991
 		if ( ! $all_trashed ) {
@@ -2006,8 +2011,10 @@  discard block
 block discarded – undo
2006 2011
 			//now delete permanently the checkins related to this registration.
2007 2012
 			$registration->delete_related_permanently('Checkin');
2008 2013
 
2009
-			if ( $registration->ID() === $REG->ID() )
2010
-				continue; //we don't want to delete permanently the existing registration just yet.
2014
+			if ( $registration->ID() === $REG->ID() ) {
2015
+							continue;
2016
+			}
2017
+			//we don't want to delete permanently the existing registration just yet.
2011 2018
 
2012 2019
 			//remove relation to transaction for these registrations if NOT the existing registrations
2013 2020
 			$registration->_remove_relations('Transaction');
@@ -2559,8 +2566,9 @@  discard block
 block discarded – undo
2559 2566
 			}
2560 2567
 		}
2561 2568
 
2562
-		if ( $success === FALSE )
2563
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2569
+		if ( $success === FALSE ) {
2570
+					EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2571
+		}
2564 2572
 
2565 2573
 	}
2566 2574
 
Please login to merge, or discard this patch.
Spacing   +580 added lines, -580 removed lines patch added patch discarded remove patch
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Registrations_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
61
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ));
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61
+		add_action('wp_loaded', array($this, 'wp_loaded'));
62 62
 	}
63 63
 
64 64
 
65 65
 
66 66
 	public function wp_loaded() {
67 67
 		// when adding a new registration...
68
-		if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) {
68
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') {
69 69
 			EE_System::do_not_cache();
70 70
 			if (
71
-				! isset( $this->_req_data[ 'processing_registration' ] )
72
-				|| absint( $this->_req_data[ 'processing_registration' ] ) !== 1
71
+				! isset($this->_req_data['processing_registration'])
72
+				|| absint($this->_req_data['processing_registration']) !== 1
73 73
 			) {
74 74
 				// and it's NOT the attendee information reg step
75 75
 				// force cookie expiration by setting time to last week
76
-				setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' );
76
+				setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/');
77 77
 				// and update the global
78
-				$_COOKIE[ 'ee_registration_added' ] = 0;
78
+				$_COOKIE['ee_registration_added'] = 0;
79 79
 			}
80 80
 		}
81 81
 	}
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 				'trash' => 'post.php'
110 110
 			);
111 111
 
112
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
112
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
113 113
 		//add filters so that the comment urls don't take users to a confusing 404 page
114
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
114
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
115 115
 	}
116 116
 
117 117
 
118
-	public function clear_comment_link( $link, $comment, $args ) {
118
+	public function clear_comment_link($link, $comment, $args) {
119 119
 		//gotta make sure this only happens on this route
120
-		$post_type = get_post_type( $comment->comment_post_ID);
121
-		if ( $post_type == 'espresso_attendees' )
120
+		$post_type = get_post_type($comment->comment_post_ID);
121
+		if ($post_type == 'espresso_attendees')
122 122
 			return '#commentsdiv';
123 123
 		return $link;
124 124
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 	protected function _ajax_hooks() {
128 128
 		//todo: all hooks for registrations ajax goes in here
129
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
129
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
130 130
 	}
131 131
 
132 132
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 				'add-attendee' => __('Add Contact', 'event_espresso'),
142 142
 				'edit' => __('Edit Contact', 'event_espresso'),
143 143
 				'report'=>  __("Event Registrations CSV Report", "event_espresso"),
144
-				'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
145
-				'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
144
+				'report_all' => __('All Registrations CSV Report', 'event_espresso'),
145
+				'contact_list_report' => __('Contact List Report', 'event_espresso'),
146 146
 				'contact_list_export'=>  __("Export Data", "event_espresso"),
147 147
 			),
148 148
 			'publishbox' => array(
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$this->_get_registration_status_array();
172 172
 
173
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
174
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
175
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
173
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
174
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
175
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
176 176
 
177 177
 		$this->_page_routes = array(
178 178
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 				'restore_registrations' => array(
207 207
 					'func' => '_trash_or_restore_registrations',
208
-					'args' => array( 'trash' => FALSE ),
208
+					'args' => array('trash' => FALSE),
209 209
 					'noheader' => TRUE,
210 210
 					'capability' => 'ee_delete_registrations'
211 211
 					),
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 						'filename' => 'registrations_overview_other'
439 439
 					)
440 440
                 ),
441
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
441
+				'help_tour' => array('Registration_Overview_Help_Tour'),
442 442
 				'qtips' => array('Registration_List_Table_Tips'),
443 443
 				'list_table' => 'EE_Registrations_List_Table',
444 444
 				'require_nonce' => FALSE
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 					'order' => 15,
451 451
 					'url' => isset($this->_req_data['_REG_ID'])
452 452
 						? add_query_arg(
453
-							array('_REG_ID' => $this->_req_data['_REG_ID'] ),
453
+							array('_REG_ID' => $this->_req_data['_REG_ID']),
454 454
 							$this->_current_page_view_url
455 455
 						)
456 456
 						: $this->_admin_base_url,
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
 						'filename' => 'registrations_details_registrant_details'
475 475
 					)
476 476
 				),
477
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
478
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
477
+				'help_tour' => array('Registration_Details_Help_Tour'),
478
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
479 479
 				'require_nonce' => FALSE
480 480
 			),
481 481
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 					'order' => 15,
500 500
 					'persistent' => FALSE
501 501
 				),
502
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
502
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
503 503
 				'require_nonce' => FALSE
504 504
 			),
505 505
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 					'label' => __('Edit Contact', 'event_espresso'),
509 509
 					'order' => 15,
510 510
 					'persistent' => FALSE,
511
-					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
511
+					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
512 512
 				),
513 513
 				'metaboxes' => array('attendee_editor_metaboxes'),
514 514
 				'require_nonce' => FALSE
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 						'filename' => 'registrations_contact_list_other'
539 539
 					)
540 540
                 ),
541
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
541
+				'help_tour' => array('Contact_List_Help_Tour'),
542 542
 				'metaboxes' => array(),
543 543
 				'require_nonce' => FALSE
544 544
 			),
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	protected function _add_screen_options() {}
558 558
 	protected function _add_feature_pointers() {}
559 559
 	public function admin_init() {
560
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
560
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
561 561
 	}
562 562
 	public function admin_notices() {}
563 563
 	public function admin_footer_scripts() {}
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	*		@return void
576 576
 	*/
577 577
 	private function _get_registration_status_array() {
578
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
578
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
579 579
 	}
580 580
 
581 581
 
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 	public function load_scripts_styles() {
599 599
 		//style
600 600
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
601
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
601
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
602 602
 		wp_enqueue_style('espresso_reg');
603 603
 
604 604
 		//script
605
-		wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
605
+		wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
606 606
 		wp_enqueue_script('espresso_reg');
607 607
 	}
608 608
 
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 	public function load_scripts_styles_edit_attendee() {
612 612
 		//stuff to only show up on our attendee edit details page.
613 613
 		$attendee_details_translations = array(
614
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
614
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
615 615
 			);
616
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
616
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
617 617
 		wp_enqueue_script('jquery-validate');
618 618
 	}
619 619
 
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
 		//styles
623 623
 		wp_enqueue_style('espresso-ui-theme');
624 624
 		//scripts
625
-		$this->_get_reg_custom_questions_form( $this->_registration->ID() );
626
-		$this->_reg_custom_questions_form->wp_enqueue_scripts( true );
625
+		$this->_get_reg_custom_questions_form($this->_registration->ID());
626
+		$this->_reg_custom_questions_form->wp_enqueue_scripts(true);
627 627
 	}
628 628
 
629 629
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
 	public function load_scripts_styles_contact_list() {
635 635
 		wp_deregister_style('espresso_reg');
636
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
636
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
637 637
 		wp_enqueue_style('espresso_att');
638 638
 	}
639 639
 
@@ -642,9 +642,9 @@  discard block
 block discarded – undo
642 642
 
643 643
 
644 644
 	public function load_scripts_styles_new_registration() {
645
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
645
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
646 646
 		wp_enqueue_script('ee-spco-for-admin');
647
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
647
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
648 648
 		EE_Form_Section_Proper::wp_enqueue_scripts();
649 649
 		EED_Ticket_Selector::load_tckt_slctr_assets();
650 650
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		//for notification related bulk actions we need to make sure only active messengers have an option.
672 672
 		EED_Messages::set_autoloaders();
673 673
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
674
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
674
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
675 675
 		$active_mts = $message_resource_manager->list_of_active_message_types();
676 676
 		//key= bulk_action_slug, value= message type.
677 677
 		$match_array = array(
@@ -684,23 +684,23 @@  discard block
 block discarded – undo
684 684
 
685 685
 		/** setup reg status bulk actions **/
686 686
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
687
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
687
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
688 688
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
689 689
 		}
690 690
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
691
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
691
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
692 692
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
693 693
 		}
694 694
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
695
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
695
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
696 696
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
697 697
 		}
698 698
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
699
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
699
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
700 700
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
701 701
 		}
702 702
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
703
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
703
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
704 704
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
705 705
 		}
706 706
 
@@ -709,29 +709,29 @@  discard block
 block discarded – undo
709 709
 				'slug' => 'all',
710 710
 				'label' => __('View All Registrations', 'event_espresso'),
711 711
 				'count' => 0,
712
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
712
+				'bulk_action' => array_merge($def_reg_status_actions, array(
713 713
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
714
-					) )
714
+					))
715 715
 				),
716 716
 			'month' => array(
717 717
 				'slug' => 'month',
718 718
 				'label' => __('This Month', 'event_espresso'),
719 719
 				'count' => 0,
720
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
720
+				'bulk_action' => array_merge($def_reg_status_actions, array(
721 721
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
722 722
 					))
723 723
 				),
724 724
 			'today' => array(
725 725
 				'slug' => 'today',
726
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
726
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
727 727
 				'count' => 0,
728
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
728
+				'bulk_action' => array_merge($def_reg_status_actions, array(
729 729
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
730 730
 					))
731 731
 				)
732 732
 			);
733 733
 
734
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
734
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
735 735
 			$this->_views['incomplete'] = array(
736 736
 				'slug' => 'incomplete',
737 737
 				'label' => __('Incomplete', 'event_espresso'),
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 				)
768 768
 			);
769 769
 
770
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
770
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
771 771
 			$this->_views['trash'] = array(
772 772
 				'slug' => 'trash',
773 773
 				'label' => __('Trash', 'event_espresso'),
@@ -806,18 +806,18 @@  discard block
 block discarded – undo
806 806
 				'desc' => __('View Transaction Invoice', 'event_espresso')
807 807
 				),
808 808
  			);
809
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
809
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
810 810
 			$fc_items['resend_registration'] = array(
811 811
 				'class' => 'dashicons dashicons-email-alt',
812 812
 				'desc' => __('Resend Registration Details', 'event_espresso')
813 813
 				);
814 814
 		} else {
815
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
815
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
816 816
 		}
817 817
 
818
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
819
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
820
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
818
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
819
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
820
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
821 821
 				$fc_items['view_related_messages'] = array(
822 822
 					'class' => $related_for_icon['css_class'],
823 823
 					'desc' => $related_for_icon['label'],
@@ -827,35 +827,35 @@  discard block
 block discarded – undo
827 827
 
828 828
 		$sc_items = array(
829 829
 			'approved_status' => array(
830
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
831
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
830
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
831
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
832 832
 				),
833 833
 			'pending_status' => array(
834
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
835
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
834
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
835
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
836 836
 				),
837 837
 			'wait_list' => array(
838
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
839
-				'desc'  => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' )
838
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list,
839
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence')
840 840
 			),
841 841
 			'incomplete_status' => array(
842
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
843
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
842
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
843
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
844 844
 			),
845 845
 			'not_approved' => array(
846
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
847
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
846
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
847
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
848 848
 				),
849 849
 			'declined_status' => array(
850
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
851
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
850
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
851
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
852 852
 				),
853 853
 			'cancelled_status' => array(
854
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
855
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
854
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
855
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
856 856
 				)
857 857
 			);
858
-		return array_merge( $fc_items, $sc_items );
858
+		return array_merge($fc_items, $sc_items);
859 859
 	}
860 860
 
861 861
 
@@ -869,45 +869,45 @@  discard block
 block discarded – undo
869 869
 	 */
870 870
 	protected function _registrations_overview_list_table() {
871 871
 		$this->_template_args['admin_page_header'] = '';
872
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : 0;
873
-		if ( $EVT_ID ) {
874
-			if ( EE_Registry::instance()->CAP->current_user_can(
872
+		$EVT_ID = ! empty($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : 0;
873
+		if ($EVT_ID) {
874
+			if (EE_Registry::instance()->CAP->current_user_can(
875 875
 				'ee_edit_registrations',
876 876
 				'espresso_registrations_new_registration',
877 877
 				$EVT_ID
878 878
 				)
879 879
 			) {
880
-				$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
880
+				$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
881 881
 					'new_registration',
882 882
 					'add-registrant',
883
-					array( 'event_id' => $EVT_ID ),
883
+					array('event_id' => $EVT_ID),
884 884
 					'add-new-h2'
885 885
 				);
886 886
 			}
887
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
888
-			if ( $event instanceof EE_Event ) {
887
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
888
+			if ($event instanceof EE_Event) {
889 889
 				$this->_template_args['admin_page_header'] = sprintf(
890
-					__( '%s Viewing registrations for the event: %s%s', 'event_espresso' ),
890
+					__('%s Viewing registrations for the event: %s%s', 'event_espresso'),
891 891
 					'<h3 style="line-height:1.5em;">',
892
-					'<br /><a href="' . EE_Admin_Page::add_query_args_and_nonce(
893
-						array( 'action' => 'edit', 'post' => $event->ID() ),
892
+					'<br /><a href="'.EE_Admin_Page::add_query_args_and_nonce(
893
+						array('action' => 'edit', 'post' => $event->ID()),
894 894
 						EVENTS_ADMIN_URL
895
-					) . '">&nbsp;' . $event->get( 'EVT_name' ) . '&nbsp;</a>&nbsp;',
895
+					).'">&nbsp;'.$event->get('EVT_name').'&nbsp;</a>&nbsp;',
896 896
 					'</h3>'
897 897
 				);
898 898
 			}
899
-			$DTT_ID = ! empty( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : 0;
900
-			$datetime = EEM_Datetime::instance()->get_one_by_ID( $DTT_ID );
901
-			if ( $datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '' ) {
902
-				$this->_template_args['admin_page_header'] = substr( $this->_template_args['admin_page_header'], 0, -5 );
899
+			$DTT_ID = ! empty($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : 0;
900
+			$datetime = EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
901
+			if ($datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '') {
902
+				$this->_template_args['admin_page_header'] = substr($this->_template_args['admin_page_header'], 0, -5);
903 903
 				$this->_template_args['admin_page_header'] .= ' &nbsp;<span class="drk-grey-text">';
904 904
 				$this->_template_args['admin_page_header'] .= '<span class="dashicons dashicons-calendar"></span>';
905 905
 				$this->_template_args['admin_page_header'] .= $datetime->name();
906
-				$this->_template_args['admin_page_header'] .= ' ( ' . $datetime->start_date() . ' )';
906
+				$this->_template_args['admin_page_header'] .= ' ( '.$datetime->start_date().' )';
907 907
 				$this->_template_args['admin_page_header'] .= '</span></h3>';
908 908
 			}
909 909
 		}
910
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
910
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
911 911
 		$this->display_admin_list_table_page_with_no_sidebar();
912 912
 	}
913 913
 
@@ -922,19 +922,19 @@  discard block
 block discarded – undo
922 922
 	 */
923 923
 	private function _set_registration_object() {
924 924
 		//get out if we've already set the object
925
-		if ( is_object( $this->_registration )) {
925
+		if (is_object($this->_registration)) {
926 926
 			return TRUE;
927 927
 		}
928 928
 
929 929
 	    $REG = EEM_Registration::instance();
930 930
 
931
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
931
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
932 932
 
933
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
933
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
934 934
 			return TRUE;
935 935
 		else {
936
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
937
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
936
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
937
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
938 938
 			$this->_registration = NULL;
939 939
 			return FALSE;
940 940
 		}
@@ -952,25 +952,25 @@  discard block
 block discarded – undo
952 952
 	 * @throws \EE_Error
953 953
 	 * @return mixed (int|array)  int = count || array of registration objects
954 954
 	 */
955
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
956
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
957
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
958
-		$DTT_ID = isset( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : null;
959
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
960
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
961
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
962
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE  : FALSE;
955
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
956
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
957
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
958
+		$DTT_ID = isset($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : null;
959
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
960
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
961
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
962
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE  : FALSE;
963 963
 		$start_date = FALSE;
964 964
 		$end_date = FALSE;
965 965
 		$_where = array();
966
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
967
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
966
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
967
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
968 968
 
969 969
 		//set orderby
970 970
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
971 971
 
972 972
 
973
-		switch ( $this->_req_data['orderby'] ) {
973
+		switch ($this->_req_data['orderby']) {
974 974
 			case '_REG_ID':
975 975
 				$orderby = 'REG_ID';
976 976
 				break;
@@ -990,30 +990,30 @@  discard block
 block discarded – undo
990 990
 				$orderby = 'REG_date';
991 991
 		}
992 992
 
993
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
994
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
995
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
993
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
994
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
995
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
996 996
 
997 997
 
998
-		$offset = ($current_page-1)*$per_page;
999
-		$limit = $count  ? NULL : array( $offset, $per_page );
998
+		$offset = ($current_page - 1) * $per_page;
999
+		$limit = $count ? NULL : array($offset, $per_page);
1000 1000
 
1001
-		if($EVT_ID){
1002
-			$_where['EVT_ID']=$EVT_ID;
1001
+		if ($EVT_ID) {
1002
+			$_where['EVT_ID'] = $EVT_ID;
1003 1003
 		}
1004
-		if($CAT_ID){
1004
+		if ($CAT_ID) {
1005 1005
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
1006 1006
 		}
1007 1007
 		//if DTT is included we filter by that datetime.
1008
-		if ( $DTT_ID ) {
1008
+		if ($DTT_ID) {
1009 1009
 			$_where['Ticket.Datetime.DTT_ID'] = $DTT_ID;
1010 1010
 		}
1011
-		if ( $incomplete ) {
1011
+		if ($incomplete) {
1012 1012
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
1013 1013
 		} else if ( ! $trash) {
1014
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
1014
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
1015 1015
 		}
1016
-		if($reg_status){
1016
+		if ($reg_status) {
1017 1017
 			$_where['STS_ID'] = $reg_status;
1018 1018
 		}
1019 1019
 
@@ -1025,103 +1025,103 @@  discard block
 block discarded – undo
1025 1025
 		$time_start = ' 00:00:00';
1026 1026
 		$time_end = ' 23:59:59';
1027 1027
 
1028
-		if($today_a || $today ){
1028
+		if ($today_a || $today) {
1029 1029
 			$curdate = date('Y-m-d', current_time('timestamp'));
1030
-			$_where['REG_date']= array('BETWEEN',
1030
+			$_where['REG_date'] = array('BETWEEN',
1031 1031
 				array(
1032
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
1033
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
1032
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
1033
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
1034 1034
 			));
1035
-		}elseif($this_month_a || $this_month){
1035
+		}elseif ($this_month_a || $this_month) {
1036 1036
 			$this_month_r = date('m', current_time('timestamp'));
1037
-			$days_this_month = date( 't', current_time('timestamp') );
1038
-			$_where['REG_date']= array('BETWEEN',
1037
+			$days_this_month = date('t', current_time('timestamp'));
1038
+			$_where['REG_date'] = array('BETWEEN',
1039 1039
 				array(
1040
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
1041
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' )
1040
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
1041
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s')
1042 1042
 			));
1043
-		}elseif($month_range){
1043
+		}elseif ($month_range) {
1044 1044
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1045
-			$month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : '';
1046
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1047
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
1048
-			$_where['REG_date']= array('BETWEEN',
1049
-				array(  EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month .  ' 23:59:59', 'Y-m-d H:i:s' ) ) );
1050
-		}elseif($start_date && $end_date){
1045
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : '';
1046
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1047
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
1048
+			$_where['REG_date'] = array('BETWEEN',
1049
+				array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s')));
1050
+		}elseif ($start_date && $end_date) {
1051 1051
 			throw new EE_Error("not yet supported");
1052
-		}elseif($start_date){
1052
+		}elseif ($start_date) {
1053 1053
 			throw new EE_Error("not yet supported");
1054
-		}elseif($end_date){
1054
+		}elseif ($end_date) {
1055 1055
 			throw new EE_Error("not yet supported");
1056 1056
 		}
1057 1057
 
1058
-		if ( ! empty( $this->_req_data['s'] ) ) {
1059
-			$sstr = '%' . $this->_req_data['s'] . '%';
1058
+		if ( ! empty($this->_req_data['s'])) {
1059
+			$sstr = '%'.$this->_req_data['s'].'%';
1060 1060
 			$_where['OR'] = array(
1061
-				'Event.EVT_name' => array( 'LIKE', $sstr),
1062
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
1063
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
1064
-				'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),
1065
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
1066
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
1067
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
1068
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
1069
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
1070
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
1071
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
1072
-				'REG_final_price' => array( 'LIKE', $sstr ),
1073
-				'REG_code' => array( 'LIKE', $sstr ),
1074
-				'REG_count' => array( 'LIKE' , $sstr ),
1075
-				'REG_group_size' => array( 'LIKE' , $sstr ),
1076
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
1077
-				'Ticket.TKT_description' => array( 'LIKE', $sstr ),
1078
-				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )
1061
+				'Event.EVT_name' => array('LIKE', $sstr),
1062
+				'Event.EVT_desc' => array('LIKE', $sstr),
1063
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
1064
+				'Attendee.ATT_full_name' => array('LIKE', $sstr),
1065
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
1066
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
1067
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
1068
+				'Attendee.ATT_email' => array('LIKE', $sstr),
1069
+				'Attendee.ATT_address' => array('LIKE', $sstr),
1070
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
1071
+				'Attendee.ATT_city' => array('LIKE', $sstr),
1072
+				'REG_final_price' => array('LIKE', $sstr),
1073
+				'REG_code' => array('LIKE', $sstr),
1074
+				'REG_count' => array('LIKE', $sstr),
1075
+				'REG_group_size' => array('LIKE', $sstr),
1076
+				'Ticket.TKT_name' => array('LIKE', $sstr),
1077
+				'Ticket.TKT_description' => array('LIKE', $sstr),
1078
+				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr)
1079 1079
 			);
1080 1080
 		}
1081 1081
 
1082 1082
 		//capability checks
1083
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
1083
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
1084 1084
 			$_where['AND'] = array(
1085 1085
 				'Event.EVT_wp_user' => get_current_user_id()
1086 1086
 				);
1087 1087
 		}
1088 1088
 
1089
-		if( $count ){
1090
-			if ( $trash ) {
1091
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
1092
-			} else if ( $incomplete ) {
1093
-				return EEM_Registration::instance()->count( array( $_where ));
1089
+		if ($count) {
1090
+			if ($trash) {
1091
+				return EEM_Registration::instance()->count_deleted(array($_where));
1092
+			} else if ($incomplete) {
1093
+				return EEM_Registration::instance()->count(array($_where));
1094 1094
 			} else {
1095
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
1095
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
1096 1096
 			}
1097 1097
 		} else {
1098 1098
 			//make sure we remove default where conditions cause all registrations matching query are returned
1099
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1100
-			if ( $per_page !== -1 ) {
1099
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1100
+			if ($per_page !== -1) {
1101 1101
 				$query_params['limit'] = $limit;
1102 1102
 			}
1103
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1103
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1104 1104
 
1105
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1105
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1106 1106
 				$first_registration = $registrations[0];
1107 1107
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1108 1108
 				$event_name = $first_registration->event_obj()->name();
1109
-				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1109
+				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1110 1110
 				// edit event link
1111
-				if ( $event_name != '' ) {
1112
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1113
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1114
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1111
+				if ($event_name != '') {
1112
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1113
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1114
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1115 1115
 				}
1116 1116
 
1117
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1118
-				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
1117
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1118
+				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
1119 1119
 
1120 1120
 				$this->_template_args['before_admin_page_content'] = '
1121 1121
 			<div id="admin-page-header">
1122
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1123
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1124
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1122
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1123
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1124
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1125 1125
 			</div>
1126 1126
 			';
1127 1127
 
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 
1160 1160
 		$this->_set_registration_object();
1161 1161
 
1162
-		if ( is_object( $this->_registration )) {
1162
+		if (is_object($this->_registration)) {
1163 1163
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1164 1164
 			$this->_session = $transaction->session_data();
1165 1165
 
@@ -1167,10 +1167,10 @@  discard block
 block discarded – undo
1167 1167
 
1168 1168
 
1169 1169
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1170
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1170
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1171 1171
 
1172
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->get_i18n_datetime( 'REG_date' );
1173
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1172
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date');
1173
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1174 1174
 
1175 1175
 			$this->_template_args['grand_total'] = $transaction->total();
1176 1176
 
@@ -1178,20 +1178,20 @@  discard block
 block discarded – undo
1178 1178
 			// link back to overview
1179 1179
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1180 1180
 			$this->_template_args['registration'] = $this->_registration;
1181
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1182
-			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) );
1183
-			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) );
1181
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1182
+			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php'));
1183
+			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php'));
1184 1184
 
1185 1185
 			//next and previous links
1186
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1187
-			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';
1188
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1189
-			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';
1186
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1187
+			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : '';
1188
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1189
+			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : '';
1190 1190
 
1191 1191
 			// grab header
1192
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1192
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1193 1193
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1194
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1194
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1195 1195
 
1196 1196
 		} else {
1197 1197
 
@@ -1210,17 +1210,17 @@  discard block
 block discarded – undo
1210 1210
 
1211 1211
 
1212 1212
 	protected function _registration_details_metaboxes() {
1213
-		do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this );
1213
+		do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1214 1214
 		$this->_set_registration_object();
1215 1215
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1216
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1217
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1218
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1219
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1216
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1217
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1218
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1219
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1220 1220
 		}
1221
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1222
-		if ( $this->_registration->group_size() > 1 ) {
1223
-			add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1221
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1222
+		if ($this->_registration->group_size() > 1) {
1223
+			add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high');
1224 1224
 		}
1225 1225
 	}
1226 1226
 
@@ -1262,25 +1262,25 @@  discard block
 block discarded – undo
1262 1262
 				'html_id'         => 'reg-status-change-form',
1263 1263
 				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1264 1264
 				'subsections'     => array(
1265
-					'return' => new EE_Hidden_Input( array(
1265
+					'return' => new EE_Hidden_Input(array(
1266 1266
 						'name'    => 'return',
1267 1267
 						'default' => 'view_registration'
1268
-					) ),
1269
-					'REG_ID' => new EE_Hidden_Input( array(
1268
+					)),
1269
+					'REG_ID' => new EE_Hidden_Input(array(
1270 1270
 						'name'    => 'REG_ID',
1271 1271
 						'default' => $this->_registration->ID()
1272
-					) ),
1272
+					)),
1273 1273
 					'current_status' => new EE_Form_Section_HTML(
1274 1274
 						EEH_HTML::tr(
1275 1275
 							EEH_HTML::th(
1276 1276
 								EEH_HTML::label(
1277
-									EEH_HTML::strong( __( 'Current Registration Status', 'event_espresso' ) )
1277
+									EEH_HTML::strong(__('Current Registration Status', 'event_espresso'))
1278 1278
 								)
1279
-							) .
1279
+							).
1280 1280
 							EEH_HTML::td(
1281 1281
 								EEH_HTML::strong(
1282 1282
 									$this->_registration->pretty_status(),
1283
-									'', 'status-' . $this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;'
1283
+									'', 'status-'.$this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;'
1284 1284
 								)
1285 1285
 							)
1286 1286
 						)
@@ -1288,22 +1288,22 @@  discard block
 block discarded – undo
1288 1288
 					'reg_status' => new EE_Select_Input(
1289 1289
 						$this->_get_reg_statuses(),
1290 1290
 						array(
1291
-							'html_label_text' => __( 'Change Registration Status to', 'event_espresso' ),
1291
+							'html_label_text' => __('Change Registration Status to', 'event_espresso'),
1292 1292
 							'default'         => $this->_registration->status_ID(),
1293 1293
 						)
1294 1294
 					),
1295 1295
 					'send_notifications' => new EE_Yes_No_Input(
1296 1296
 						array(
1297
-							'html_label_text' => __( 'Send Related Messages', 'event_espresso' ),
1297
+							'html_label_text' => __('Send Related Messages', 'event_espresso'),
1298 1298
 							'default'         => false,
1299
-							'html_help_text'  => __( 'If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso' ),
1299
+							'html_help_text'  => __('If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso'),
1300 1300
 						)
1301 1301
 					),
1302
-					'submit' => new EE_Submit_Input( array(
1302
+					'submit' => new EE_Submit_Input(array(
1303 1303
 						'html_class'      => 'button-primary',
1304 1304
 						'html_label_text' => '&nbsp;',
1305
-						'default'         => __( 'Update Registration Status', 'event_espresso' )
1306
-					) ),
1305
+						'default'         => __('Update Registration Status', 'event_espresso')
1306
+					)),
1307 1307
 				),
1308 1308
 			)
1309 1309
 		);
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 	 * Returns an array of all the buttons for the various statuses and switch status actions
1317 1317
 	 * @return string
1318 1318
 	 */
1319
-	protected function _get_current_reg_status_help_text( $STS_ID = '' ) {
1319
+	protected function _get_current_reg_status_help_text($STS_ID = '') {
1320 1320
 		//$reg_status_help_text = array(
1321 1321
 		//	'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ),
1322 1322
 		//	'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ),
@@ -1349,14 +1349,14 @@  discard block
 block discarded – undo
1349 1349
 	 */
1350 1350
 	protected function _get_reg_statuses() {
1351 1351
 		$reg_status_array = EEM_Registration::instance()->reg_status_array();
1352
-		unset ( $reg_status_array[ EEM_Registration::status_id_incomplete ] );
1352
+		unset ($reg_status_array[EEM_Registration::status_id_incomplete]);
1353 1353
 		// get current reg status
1354 1354
 		$current_status = $this->_registration->status_ID();
1355 1355
 		// is registration for free event? This will determine whether to display the pending payment option
1356
-		if ( $current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free() ) {
1357
-			unset( $reg_status_array[ EEM_Registration::status_id_pending_payment ] );
1356
+		if ($current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free()) {
1357
+			unset($reg_status_array[EEM_Registration::status_id_pending_payment]);
1358 1358
 		}
1359
-		return EEM_Status::instance()->localized_status( $reg_status_array, false, 'sentence' );
1359
+		return EEM_Status::instance()->localized_status($reg_status_array, false, 'sentence');
1360 1360
 	}
1361 1361
 
1362 1362
 
@@ -1369,15 +1369,15 @@  discard block
 block discarded – undo
1369 1369
 	 *
1370 1370
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1371 1371
 	 */
1372
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1373
-		if ( isset( $this->_req_data[ 'reg_status_change_form' ] ) ) {
1374
-			$REG_IDs = isset( $this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ] )
1375
-				? (array)$this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ]
1372
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1373
+		if (isset($this->_req_data['reg_status_change_form'])) {
1374
+			$REG_IDs = isset($this->_req_data['reg_status_change_form']['REG_ID'])
1375
+				? (array) $this->_req_data['reg_status_change_form']['REG_ID']
1376 1376
 				: array();
1377 1377
 		} else {
1378
-			$REG_IDs = isset( $this->_req_data[ '_REG_ID' ] ) ? (array)$this->_req_data[ '_REG_ID' ] : array();
1378
+			$REG_IDs = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1379 1379
 		}
1380
-		$success = $this->_set_registration_status( $REG_IDs, $status );
1380
+		$success = $this->_set_registration_status($REG_IDs, $status);
1381 1381
 		//notify?
1382 1382
 		if (
1383 1383
 			$success
@@ -1404,21 +1404,21 @@  discard block
 block discarded – undo
1404 1404
 	 * @param bool $status
1405 1405
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1406 1406
 	 */
1407
-	protected function _set_registration_status( $REG_IDs = array(), $status = false ) {
1407
+	protected function _set_registration_status($REG_IDs = array(), $status = false) {
1408 1408
 		$success = false;
1409 1409
 		// typecast $REG_IDs
1410
-		$REG_IDs = (array)$REG_IDs;
1411
-		if ( ! empty( $REG_IDs ) ) {
1410
+		$REG_IDs = (array) $REG_IDs;
1411
+		if ( ! empty($REG_IDs)) {
1412 1412
 			$success = true;
1413 1413
 			// set default status if none is passed
1414 1414
 			$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1415 1415
 			// sanitize $REG_IDs
1416
-			$REG_IDs = array_filter( $REG_IDs, 'absint' );
1416
+			$REG_IDs = array_filter($REG_IDs, 'absint');
1417 1417
 			//loop through REG_ID's and change status
1418
-			foreach ( $REG_IDs as $REG_ID ) {
1419
-				$registration = EEM_Registration::instance()->get_one_by_ID( $REG_ID );
1420
-				if ( $registration instanceof EE_Registration ) {
1421
-					$registration->set_status( $status );
1418
+			foreach ($REG_IDs as $REG_ID) {
1419
+				$registration = EEM_Registration::instance()->get_one_by_ID($REG_ID);
1420
+				if ($registration instanceof EE_Registration) {
1421
+					$registration->set_status($status);
1422 1422
 					$result = $registration->save();
1423 1423
 					// verifying explicit fails because update *may* just return 0 for 0 rows affected
1424 1424
 					$success = $result !== false ? $success : false;
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 		//reset _req_data['_REG_ID'] for any potential future messages notifications
1429 1429
 		$this->_req_data['_REG_ID'] = $REG_IDs;
1430 1430
 		//return $success and processed registrations
1431
-		return array( 'REG_ID' => $REG_IDs, 'success' => $success );
1431
+		return array('REG_ID' => $REG_IDs, 'success' => $success);
1432 1432
 	}
1433 1433
 
1434 1434
 
@@ -1440,49 +1440,49 @@  discard block
 block discarded – undo
1440 1440
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1441 1441
 	 * @return void
1442 1442
 	 */
1443
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1444
-		$result = ! empty( $STS_ID )
1445
-            ? $this->_set_registration_status_from_request( $STS_ID, $notify )
1446
-            : array( 'success' => false );
1447
-		$success = isset( $result['success'] ) && $result['success'];
1443
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1444
+		$result = ! empty($STS_ID)
1445
+            ? $this->_set_registration_status_from_request($STS_ID, $notify)
1446
+            : array('success' => false);
1447
+		$success = isset($result['success']) && $result['success'];
1448 1448
 		//setup success message
1449
-		if ( $success ) {
1450
-			if ( is_array( $result[ 'REG_ID' ] ) && count( $result[ 'REG_ID' ] ) === 1 ) {
1449
+		if ($success) {
1450
+			if (is_array($result['REG_ID']) && count($result['REG_ID']) === 1) {
1451 1451
 				$msg = sprintf(
1452
-					__( 'Registration status has been set to %s', 'event_espresso' ),
1453
-					EEH_Template::pretty_status( $STS_ID, false, 'lower' )
1452
+					__('Registration status has been set to %s', 'event_espresso'),
1453
+					EEH_Template::pretty_status($STS_ID, false, 'lower')
1454 1454
 				);
1455 1455
 			} else {
1456 1456
 				$msg = sprintf(
1457
-					__( 'Registrations have been set to %s.', 'event_espresso' ),
1458
-					EEH_Template::pretty_status( $STS_ID, false, 'lower' )
1457
+					__('Registrations have been set to %s.', 'event_espresso'),
1458
+					EEH_Template::pretty_status($STS_ID, false, 'lower')
1459 1459
 				);
1460 1460
 			}
1461
-			EE_Error::add_success( $msg );
1461
+			EE_Error::add_success($msg);
1462 1462
 		} else {
1463 1463
 			EE_Error::add_error(
1464
-				__( 'Something went wrong, and the status was not changed', 'event_espresso' ),
1464
+				__('Something went wrong, and the status was not changed', 'event_espresso'),
1465 1465
 				__FILE__, __LINE__, __FUNCTION__
1466 1466
 			);
1467 1467
 		}
1468
-		if ( isset( $this->_req_data[ 'return' ] ) && $this->_req_data[ 'return' ] == 'view_registration' ) {
1469
-			$route = array( 'action' => 'view_registration', '_REG_ID' => reset( $result[ 'REG_ID' ] ) );
1468
+		if (isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration') {
1469
+			$route = array('action' => 'view_registration', '_REG_ID' => reset($result['REG_ID']));
1470 1470
 		} else {
1471
-			$route = array( 'action' => 'default' );
1471
+			$route = array('action' => 'default');
1472 1472
 		}
1473 1473
 		//unset nonces
1474
-		foreach ( $this->_req_data as $ref => $value ) {
1475
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1476
-				unset( $this->_req_data[$ref] );
1474
+		foreach ($this->_req_data as $ref => $value) {
1475
+			if (strpos($ref, 'nonce') !== false) {
1476
+				unset($this->_req_data[$ref]);
1477 1477
 				continue;
1478 1478
 			}
1479 1479
 
1480
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1480
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1481 1481
 			$this->_req_data[$ref] = $value;
1482 1482
 		}
1483 1483
 		//merge request vars so that the reloaded list table contains any existing filter query params
1484
-		$route = array_merge( $this->_req_data, $route );
1485
-		$this->_redirect_after_action( $success, '', '', $route, true );
1484
+		$route = array_merge($this->_req_data, $route);
1485
+		$this->_redirect_after_action($success, '', '', $route, true);
1486 1486
 	}
1487 1487
 
1488 1488
 
@@ -1493,51 +1493,51 @@  discard block
 block discarded – undo
1493 1493
 	protected function _change_reg_status() {
1494 1494
 		$this->_req_data['return'] = 'view_registration';
1495 1495
 		//set notify based on whether the send notifications toggle is set or not
1496
-		$notify = ! empty( $this->_req_data['reg_status_change_form']['send_notifications'] );
1496
+		$notify = ! empty($this->_req_data['reg_status_change_form']['send_notifications']);
1497 1497
 		//$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1498
-		$this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ] = isset(
1499
-			$this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ]
1498
+		$this->_req_data['reg_status_change_form']['reg_status'] = isset(
1499
+			$this->_req_data['reg_status_change_form']['reg_status']
1500 1500
 		)
1501
-			? $this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ]
1501
+			? $this->_req_data['reg_status_change_form']['reg_status']
1502 1502
 			: '';
1503 1503
 
1504
-		switch ( $this->_req_data[ 'reg_status_change_form' ]['reg_status'] ) {
1504
+		switch ($this->_req_data['reg_status_change_form']['reg_status']) {
1505 1505
 
1506 1506
 			case EEM_Registration::status_id_approved :
1507
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1508
-				$this->approve_registration( $notify );
1507
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1508
+				$this->approve_registration($notify);
1509 1509
 				break;
1510 1510
 
1511 1511
 			case EEM_Registration::status_id_pending_payment :
1512
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1513
-				$this->pending_registration( $notify );
1512
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1513
+				$this->pending_registration($notify);
1514 1514
 				break;
1515 1515
 
1516 1516
 			case EEM_Registration::status_id_not_approved :
1517
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1518
-				$this->not_approve_registration( $notify );
1517
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1518
+				$this->not_approve_registration($notify);
1519 1519
 				break;
1520 1520
 
1521 1521
 			case EEM_Registration::status_id_declined :
1522
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1523
-				$this->decline_registration( $notify );
1522
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1523
+				$this->decline_registration($notify);
1524 1524
 				break;
1525 1525
 
1526 1526
 			case EEM_Registration::status_id_cancelled :
1527
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1528
-				$this->cancel_registration( $notify );
1527
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1528
+				$this->cancel_registration($notify);
1529 1529
 				break;
1530 1530
 
1531 1531
 			case EEM_Registration::status_id_wait_list :
1532
-			case EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' ) :
1533
-				$this->waitlist_registration( $notify );
1532
+			case EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence') :
1533
+				$this->waitlist_registration($notify);
1534 1534
 				break;
1535 1535
 
1536 1536
 			case EEM_Registration::status_id_incomplete :
1537 1537
 			default :
1538 1538
 				$result['success'] = false;
1539
-				unset( $this->_req_data['return'] );
1540
-				$this->_reg_status_change_return( '', false );
1539
+				unset($this->_req_data['return']);
1540
+				$this->_reg_status_change_return('', false);
1541 1541
 				break;
1542 1542
 		}
1543 1543
 	}
@@ -1551,8 +1551,8 @@  discard block
 block discarded – undo
1551 1551
 	 * @param bool $notify whether or not to notify the registrant about their approval.
1552 1552
 	 * @return void
1553 1553
 	 */
1554
-	protected function approve_registration( $notify = false ) {
1555
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1554
+	protected function approve_registration($notify = false) {
1555
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1556 1556
 	}
1557 1557
 
1558 1558
 
@@ -1564,8 +1564,8 @@  discard block
 block discarded – undo
1564 1564
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1565 1565
 	 * @return void
1566 1566
 	 */
1567
-	protected function decline_registration( $notify = false ) {
1568
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1567
+	protected function decline_registration($notify = false) {
1568
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1569 1569
 	}
1570 1570
 
1571 1571
 
@@ -1577,8 +1577,8 @@  discard block
 block discarded – undo
1577 1577
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1578 1578
 	 * @return void
1579 1579
 	 */
1580
-	protected function cancel_registration( $notify = false ) {
1581
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1580
+	protected function cancel_registration($notify = false) {
1581
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1582 1582
 	}
1583 1583
 
1584 1584
 
@@ -1590,8 +1590,8 @@  discard block
 block discarded – undo
1590 1590
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1591 1591
 	 * @return void
1592 1592
 	 */
1593
-	protected function not_approve_registration( $notify = false ) {
1594
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1593
+	protected function not_approve_registration($notify = false) {
1594
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1595 1595
 	}
1596 1596
 
1597 1597
 
@@ -1603,8 +1603,8 @@  discard block
 block discarded – undo
1603 1603
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1604 1604
 	 * @return void
1605 1605
 	 */
1606
-	protected function pending_registration( $notify = false ) {
1607
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1606
+	protected function pending_registration($notify = false) {
1607
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1608 1608
 	}
1609 1609
 
1610 1610
 
@@ -1616,8 +1616,8 @@  discard block
 block discarded – undo
1616 1616
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1617 1617
 	 * @return void
1618 1618
 	 */
1619
-	protected function waitlist_registration( $notify = false ) {
1620
-		$this->_reg_status_change_return( EEM_Registration::status_id_wait_list, $notify );
1619
+	protected function waitlist_registration($notify = false) {
1620
+		$this->_reg_status_change_return(EEM_Registration::status_id_wait_list, $notify);
1621 1621
 	}
1622 1622
 
1623 1623
 
@@ -1631,14 +1631,14 @@  discard block
 block discarded – undo
1631 1631
 	public function _reg_details_meta_box() {
1632 1632
 		EEH_Autoloader::register_line_item_display_autoloaders();
1633 1633
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1634
-		EE_Registry::instance()->load_helper( 'Line_Item' );
1634
+		EE_Registry::instance()->load_helper('Line_Item');
1635 1635
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1636 1636
 		$this->_session = $transaction->session_data();
1637 1637
 
1638 1638
 		$filters = new EE_Line_Item_Filter_Collection();
1639 1639
 		//$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1640
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1641
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1640
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1641
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1642 1642
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1643 1643
 		$line_item_display = new EE_Line_Item_Display(
1644 1644
 			'reg_admin_table',
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
 		);
1647 1647
 		$this->_template_args['line_item_table'] = $line_item_display->display_line_item(
1648 1648
 			$filtered_line_item_tree,
1649
-			array( 'EE_Registration' => $this->_registration )
1649
+			array('EE_Registration' => $this->_registration)
1650 1650
 		);
1651 1651
 		$attendee = $this->_registration->attendee();
1652 1652
 
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 				'espresso_transactions_view_transaction'
1657 1657
 			)
1658 1658
 		) {
1659
-			$this->_template_args[ 'view_transaction_button' ] =  EEH_Template::get_button_or_link(
1659
+			$this->_template_args['view_transaction_button'] = EEH_Template::get_button_or_link(
1660 1660
 				EE_Admin_Page::add_query_args_and_nonce(
1661 1661
 					array(
1662 1662
 						'action' => 'view_transaction',
@@ -1664,12 +1664,12 @@  discard block
 block discarded – undo
1664 1664
 					),
1665 1665
 					TXN_ADMIN_URL
1666 1666
 				),
1667
-				esc_html__( ' View Transaction' ),
1667
+				esc_html__(' View Transaction'),
1668 1668
 				'button secondary-button right',
1669 1669
 				'dashicons dashicons-cart'
1670 1670
 			);
1671 1671
 		} else {
1672
-			$this->_template_args[ 'view_transaction_button' ] = '';
1672
+			$this->_template_args['view_transaction_button'] = '';
1673 1673
 		}
1674 1674
 
1675 1675
 		if (
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 				'espresso_registrations_resend_registration'
1680 1680
 			)
1681 1681
 		) {
1682
-			$this->_template_args[ 'resend_registration_button' ] = EEH_Template::get_button_or_link(
1682
+			$this->_template_args['resend_registration_button'] = EEH_Template::get_button_or_link(
1683 1683
 				EE_Admin_Page::add_query_args_and_nonce(
1684 1684
 					array(
1685 1685
 						'action' 		=> 'resend_registration',
@@ -1688,55 +1688,55 @@  discard block
 block discarded – undo
1688 1688
 					),
1689 1689
 					REG_ADMIN_URL
1690 1690
 				),
1691
-				esc_html__( ' Resend Registration' ),
1691
+				esc_html__(' Resend Registration'),
1692 1692
 				'button secondary-button right',
1693 1693
 				'dashicons dashicons-email-alt'
1694 1694
 			);
1695 1695
 		} else {
1696
-			$this->_template_args[ 'resend_registration_button' ] = '';
1696
+			$this->_template_args['resend_registration_button'] = '';
1697 1697
 		}
1698 1698
 
1699 1699
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1700
-		$payment = $transaction->get_first_related( 'Payment' );
1700
+		$payment = $transaction->get_first_related('Payment');
1701 1701
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1702
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1702
+		$payment_method = $payment->get_first_related('Payment_Method');
1703 1703
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1704 1704
 
1705 1705
 		$reg_details = array(
1706 1706
 			'payment_method' => $payment_method->name(),
1707 1707
 			'response_msg' => $payment->gateway_response(),
1708
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1708
+			'registration_id' => $this->_registration->get('REG_code'),
1709 1709
 			'registration_session' => $this->_registration->session_ID(),
1710
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1711
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1710
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1711
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1712 1712
 		);
1713 1713
 
1714 1714
 
1715
-		if ( isset( $reg_details['registration_id'] )) {
1715
+		if (isset($reg_details['registration_id'])) {
1716 1716
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1717
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1717
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1718 1718
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1719 1719
 		}
1720 1720
 
1721
-		if ( isset( $reg_details['payment_method'] ) ) {
1721
+		if (isset($reg_details['payment_method'])) {
1722 1722
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1723
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1723
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1724 1724
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1725 1725
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1726
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1726
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1727 1727
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1728 1728
 		}
1729 1729
 
1730 1730
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1731
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1731
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1732 1732
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1733 1733
 
1734 1734
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1735
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1735
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1736 1736
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1737 1737
 
1738 1738
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1739
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1739
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1740 1740
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1741 1741
 
1742 1742
 		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(
@@ -1749,8 +1749,8 @@  discard block
 block discarded – undo
1749 1749
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1750 1750
 		$this->_template_args['event_id'] = $this->_registration->event_ID();
1751 1751
 
1752
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1753
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1752
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1753
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1754 1754
 
1755 1755
 	}
1756 1756
 
@@ -1764,14 +1764,14 @@  discard block
 block discarded – undo
1764 1764
 	*/
1765 1765
 	public function _reg_questions_meta_box() {
1766 1766
 		//allow someone to override this method entirely
1767
-		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
1768
-			$form = $this->_get_reg_custom_questions_form( $this->_registration->ID() );
1769
-			$this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : '';
1767
+		if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) {
1768
+			$form = $this->_get_reg_custom_questions_form($this->_registration->ID());
1769
+			$this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : '';
1770 1770
 			$this->_template_args['reg_questions_form_action'] = 'edit_registration';
1771 1771
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1772 1772
 
1773
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1774
-			echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1773
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1774
+			echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1775 1775
 		}
1776 1776
 	}
1777 1777
 
@@ -1785,12 +1785,12 @@  discard block
 block discarded – undo
1785 1785
 	 * @param        string $output
1786 1786
 	 * @return        string
1787 1787
 	 */
1788
-	public function form_before_question_group( $output ) {
1788
+	public function form_before_question_group($output) {
1789 1789
 		EE_Error::doing_it_wrong(
1790
-			__CLASS__ . '::' . __FUNCTION__,
1791
-			__( 'This method would have been protected but was used on a filter callback'
1790
+			__CLASS__.'::'.__FUNCTION__,
1791
+			__('This method would have been protected but was used on a filter callback'
1792 1792
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1793
-				'event_espresso' ),
1793
+				'event_espresso'),
1794 1794
 			'4.8.32.rc.000'
1795 1795
 		);
1796 1796
 		return '
@@ -1809,20 +1809,20 @@  discard block
 block discarded – undo
1809 1809
 	 * @param        string $output
1810 1810
 	 * @return        string
1811 1811
 	 */
1812
-	public function form_after_question_group( $output ) {
1812
+	public function form_after_question_group($output) {
1813 1813
 		EE_Error::doing_it_wrong(
1814
-			__CLASS__ . '::' . __FUNCTION__,
1815
-			__( 'This method would have been protected but was used on a filter callback'
1814
+			__CLASS__.'::'.__FUNCTION__,
1815
+			__('This method would have been protected but was used on a filter callback'
1816 1816
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1817
-				'event_espresso' ),
1817
+				'event_espresso'),
1818 1818
 			'4.8.32.rc.000'
1819 1819
 		);
1820 1820
 		return  '
1821 1821
 			<tr class="hide-if-no-js">
1822 1822
 				<th> </th>
1823 1823
 				<td class="reg-admin-edit-attendee-question-td">
1824
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1825
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1824
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1825
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1826 1826
 						<div class="dashicons dashicons-edit"></div>
1827 1827
 					</a>
1828 1828
 				</td>
@@ -1842,18 +1842,18 @@  discard block
 block discarded – undo
1842 1842
 	 * @param        string $label
1843 1843
 	 * @return        string
1844 1844
 	 */
1845
-	public function form_form_field_label_wrap( $label ) {
1845
+	public function form_form_field_label_wrap($label) {
1846 1846
 		EE_Error::doing_it_wrong(
1847
-			__CLASS__ . '::' . __FUNCTION__,
1848
-			__( 'This method would have been protected but was used on a filter callback'
1847
+			__CLASS__.'::'.__FUNCTION__,
1848
+			__('This method would have been protected but was used on a filter callback'
1849 1849
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1850
-				'event_espresso' ),
1850
+				'event_espresso'),
1851 1851
 			'4.8.32.rc.000'
1852 1852
 		);
1853 1853
 		return '
1854 1854
 			<tr>
1855 1855
 				<th>
1856
-					' . $label  . '
1856
+					' . $label.'
1857 1857
 				</th>';
1858 1858
 	}
1859 1859
 
@@ -1867,17 +1867,17 @@  discard block
 block discarded – undo
1867 1867
 	 * @param        string $input
1868 1868
 	 * @return        string
1869 1869
 	 */
1870
-	public function form_form_field_input__wrap( $input ) {
1870
+	public function form_form_field_input__wrap($input) {
1871 1871
 		EE_Error::doing_it_wrong(
1872
-			__CLASS__ . '::' . __FUNCTION__,
1873
-			__( 'This method would have been protected but was used on a filter callback'
1872
+			__CLASS__.'::'.__FUNCTION__,
1873
+			__('This method would have been protected but was used on a filter callback'
1874 1874
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1875
-				'event_espresso' ),
1875
+				'event_espresso'),
1876 1876
 			'4.8.32.rc.000'
1877 1877
 		);
1878 1878
 		return '
1879 1879
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1880
-					' . $input . '
1880
+					' . $input.'
1881 1881
 				</td>
1882 1882
 			</tr>';
1883 1883
 	}
@@ -1891,14 +1891,14 @@  discard block
 block discarded – undo
1891 1891
 	 * @return void
1892 1892
 	 */
1893 1893
 	protected function _update_attendee_registration_form() {
1894
-		do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this );
1895
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
1896
-			$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1897
-			$success = $this->_save_reg_custom_questions_form( $REG_ID );
1898
-			if( $success ) {
1894
+		do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
1895
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
1896
+			$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1897
+			$success = $this->_save_reg_custom_questions_form($REG_ID);
1898
+			if ($success) {
1899 1899
 				$what = __('Registration Form', 'event_espresso');
1900
-				$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1901
-				$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1900
+				$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1901
+				$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1902 1902
 			}
1903 1903
 		}
1904 1904
 	}
@@ -1909,11 +1909,11 @@  discard block
 block discarded – undo
1909 1909
 	 * @param int $REG_ID
1910 1910
 	 * @return EE_Registration_Custom_Questions_Form
1911 1911
 	 */
1912
-	protected function _get_reg_custom_questions_form( $REG_ID ) {
1913
-		if( ! $this->_reg_custom_questions_form ) {
1914
-			require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' );
1915
-			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) );
1916
-			$this->_reg_custom_questions_form->_construct_finalize( null, null );
1912
+	protected function _get_reg_custom_questions_form($REG_ID) {
1913
+		if ( ! $this->_reg_custom_questions_form) {
1914
+			require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php');
1915
+			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID));
1916
+			$this->_reg_custom_questions_form->_construct_finalize(null, null);
1917 1917
 		}
1918 1918
 		return $this->_reg_custom_questions_form;
1919 1919
 	}
@@ -1926,17 +1926,17 @@  discard block
 block discarded – undo
1926 1926
 	 * @param bool $REG_ID
1927 1927
 	 * @return bool
1928 1928
 	 */
1929
-	private function _save_reg_custom_questions_form( $REG_ID = FALSE ) {
1929
+	private function _save_reg_custom_questions_form($REG_ID = FALSE) {
1930 1930
 
1931 1931
 		if ( ! $REG_ID) {
1932
-			EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1932
+			EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1933 1933
 		}
1934
-		$form = $this->_get_reg_custom_questions_form( $REG_ID );
1935
-		$form->receive_form_submission( $this->_req_data );
1934
+		$form = $this->_get_reg_custom_questions_form($REG_ID);
1935
+		$form->receive_form_submission($this->_req_data);
1936 1936
 		$success = false;
1937
-		if( $form->is_valid() ) {
1938
-			foreach( $form->subforms() as $question_group_id => $question_group_form ) {
1939
-				foreach( $question_group_form->inputs() as $question_id => $input ) {
1937
+		if ($form->is_valid()) {
1938
+			foreach ($form->subforms() as $question_group_id => $question_group_form) {
1939
+				foreach ($question_group_form->inputs() as $question_id => $input) {
1940 1940
 					$where_conditions = array(
1941 1941
 							'QST_ID' => $question_id,
1942 1942
 							'REG_ID' => $REG_ID
@@ -1944,19 +1944,19 @@  discard block
 block discarded – undo
1944 1944
 					$possibly_new_values = array(
1945 1945
 							'ANS_value' => $input->normalized_value()
1946 1946
 						);
1947
-					$answer = EEM_Answer::instance()->get_one( array( $where_conditions ) );
1948
-					if( $answer instanceof EE_Answer ) {
1949
-						$success = $answer->save( $possibly_new_values );
1947
+					$answer = EEM_Answer::instance()->get_one(array($where_conditions));
1948
+					if ($answer instanceof EE_Answer) {
1949
+						$success = $answer->save($possibly_new_values);
1950 1950
 					} else {
1951 1951
 						//insert it then
1952
-						$cols_n_vals = array_merge( $where_conditions, $possibly_new_values );
1953
-						$answer = EE_Answer::new_instance( $cols_n_vals );
1952
+						$cols_n_vals = array_merge($where_conditions, $possibly_new_values);
1953
+						$answer = EE_Answer::new_instance($cols_n_vals);
1954 1954
 						$success = $answer->save();
1955 1955
 					}
1956 1956
 				}
1957 1957
 			}
1958 1958
 		} else {
1959
-			EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ );
1959
+			EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
1960 1960
 		}
1961 1961
 		return $success;
1962 1962
 	}
@@ -1974,31 +1974,31 @@  discard block
 block discarded – undo
1974 1974
 		$registrations = $REG->get_all(array(
1975 1975
 			array(
1976 1976
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1977
-				'REG_ID'=>array('!=',$this->_registration->ID())
1977
+				'REG_ID'=>array('!=', $this->_registration->ID())
1978 1978
 			),
1979 1979
 			'force_join'=>array('Attendee')));
1980 1980
 
1981 1981
 		$this->_template_args['attendees'] = array();
1982 1982
 		$this->_template_args['attendee_notice'] = '';
1983
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1984
-			EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1983
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1984
+			EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1985 1985
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1986 1986
 		} else {
1987 1987
 
1988 1988
 			$att_nmbr = 1;
1989
-			foreach ( $registrations as $registration ) {
1989
+			foreach ($registrations as $registration) {
1990 1990
 				/* @var $registration EE_Registration */
1991 1991
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1992
-				$this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID();
1993
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1994
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1995
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1996
-				$this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1992
+				$this->_template_args['attendees'][$att_nmbr]['STS_ID'] = $registration->status_ID();
1993
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1994
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1995
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1996
+				$this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1997 1997
 
1998
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1998
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1999 1999
 
2000
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
2001
-				$this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name();
2000
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
2001
+				$this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name();
2002 2002
 
2003 2003
 				$att_nmbr++;
2004 2004
 			}
@@ -2008,8 +2008,8 @@  discard block
 block discarded – undo
2008 2008
 
2009 2009
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
2010 2010
 		}
2011
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
2012
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2011
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
2012
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2013 2013
 
2014 2014
 	}
2015 2015
 
@@ -2030,14 +2030,14 @@  discard block
 block discarded – undo
2030 2030
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
2031 2031
 
2032 2032
 		//now let's determine if this is not the primary registration.  If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show create button or not)
2033
-		if ( ! $this->_registration->is_primary_registrant() ) {
2033
+		if ( ! $this->_registration->is_primary_registrant()) {
2034 2034
 
2035 2035
 			$primary_registration = $this->_registration->get_primary_registration();
2036 2036
 			$primary_attendee = $primary_registration instanceof EE_Registration
2037 2037
 				? $primary_registration->attendee()
2038 2038
 				: null;
2039 2039
 
2040
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
2040
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
2041 2041
 				//in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg.
2042 2042
 				$primary_registration = NULL;
2043 2043
 			}
@@ -2046,27 +2046,27 @@  discard block
 block discarded – undo
2046 2046
 		}
2047 2047
 
2048 2048
 		$this->_template_args['ATT_ID'] = $attendee->ID();
2049
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
2050
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
2051
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
2049
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
2050
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
2051
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
2052 2052
 		$this->_template_args['phone'] = $attendee->phone();
2053 2053
 
2054
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
2054
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
2055 2055
 
2056 2056
 
2057 2057
 		//edit link
2058
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
2058
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
2059 2059
 		$this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso');
2060 2060
 
2061 2061
 		//create link
2062
-		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee',  '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): '';
2062
+		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : '';
2063 2063
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
2064 2064
 
2065 2065
 		$this->_template_args['att_check'] = $att_check;
2066 2066
 
2067 2067
 
2068
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
2069
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2068
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
2069
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2070 2070
 	}
2071 2071
 
2072 2072
 
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
 	 * @access protected
2080 2080
 	 * @return void
2081 2081
 	 */
2082
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
2082
+	protected function _trash_or_restore_registrations($trash = TRUE) {
2083 2083
 		$REGM = EEM_Registration::instance();
2084 2084
 
2085 2085
 		$success = 1;
@@ -2089,26 +2089,26 @@  discard block
 block discarded – undo
2089 2089
 		$dtts = array();
2090 2090
 
2091 2091
 		//if empty _REG_ID then get out because there's nothing to do
2092
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
2092
+		if (empty($this->_req_data['_REG_ID'])) {
2093 2093
 			$msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso');
2094
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
2095
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
2094
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
2095
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
2096 2096
 		}
2097 2097
 
2098 2098
 		//Checkboxes
2099
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2099
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2100 2100
 			// if array has more than one element than success message should be plural
2101
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
2101
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
2102 2102
 			// cycle thru checkboxes
2103
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
2103
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
2104 2104
 				/** @var EE_Registration $REG */
2105
-				$REG = $REGM->get_one_by_ID( $REG_ID);
2105
+				$REG = $REGM->get_one_by_ID($REG_ID);
2106 2106
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
2107
-				if ( $payment_count > 0 ) {
2108
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
2107
+				if ($payment_count > 0) {
2108
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
2109 2109
 					$error = 1;
2110 2110
 					$success = 0;
2111
-					EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ );
2111
+					EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__);
2112 2112
 					continue; //can't trash this registration because it has payments.
2113 2113
 				}
2114 2114
 				$ticket = $REG->get_first_related('Ticket');
@@ -2117,7 +2117,7 @@  discard block
 block discarded – undo
2117 2117
 				$dtts = array_merge($dtts, $dtt);
2118 2118
 
2119 2119
 				$updated = $trash ? $REG->delete() : $REG->restore();
2120
-				if ( !$updated ) {
2120
+				if ( ! $updated) {
2121 2121
 					$success = 0;
2122 2122
 				} else {
2123 2123
 					$success = 2;
@@ -2132,7 +2132,7 @@  discard block
 block discarded – undo
2132 2132
 			$tickets[$ticket->ID()] = $ticket;
2133 2133
 			$dtts = $ticket->get_many_related('Datetime');
2134 2134
 			$updated = $trash ? $REG->delete() : $REG->restore();
2135
-			if ( ! $updated ) {
2135
+			if ( ! $updated) {
2136 2136
 				$success = 0;
2137 2137
 			}
2138 2138
 
@@ -2142,10 +2142,10 @@  discard block
 block discarded – undo
2142 2142
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
2143 2143
 		EEM_Datetime::instance()->update_sold($dtts);
2144 2144
 
2145
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
2146
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2145
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
2146
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2147 2147
 		$overwrite_msgs = $error ? TRUE : FALSE;
2148
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
2148
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
2149 2149
 	}
2150 2150
 
2151 2151
 
@@ -2169,16 +2169,16 @@  discard block
 block discarded – undo
2169 2169
 		$success = 1;
2170 2170
 
2171 2171
 		//Checkboxes
2172
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2172
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2173 2173
 			// if array has more than one element than success message should be plural
2174
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
2174
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
2175 2175
 			// cycle thru checkboxes
2176
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
2176
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
2177 2177
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
2178
-				if ( ! $REG instanceof EE_Registration )
2178
+				if ( ! $REG instanceof EE_Registration)
2179 2179
 					continue;
2180 2180
 				$deleted = $this->_delete_registration($REG);
2181
-				if ( !$deleted ) {
2181
+				if ( ! $deleted) {
2182 2182
 					$success = 0;
2183 2183
 				}
2184 2184
 			}
@@ -2188,15 +2188,15 @@  discard block
 block discarded – undo
2188 2188
 			$REG_ID = $this->_req_data['_REG_ID'];
2189 2189
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
2190 2190
 			$deleted = $this->_delete_registration($REG);
2191
-			if ( ! $deleted ) {
2191
+			if ( ! $deleted) {
2192 2192
 				$success = 0;
2193 2193
 			}
2194 2194
 
2195 2195
 		}
2196 2196
 
2197
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
2198
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
2199
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
2197
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
2198
+		$action_desc = __('permanently deleted.', 'event_espresso');
2199
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
2200 2200
 	}
2201 2201
 
2202 2202
 
@@ -2208,31 +2208,31 @@  discard block
 block discarded – undo
2208 2208
 	 * @param  EE_Registration $REG registration to be deleted permenantly
2209 2209
 	 * @return boolean              true = successful deletion, false = fail.
2210 2210
 	 */
2211
-	protected function _delete_registration( EE_Registration $REG ) {
2211
+	protected function _delete_registration(EE_Registration $REG) {
2212 2212
 		//first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed.
2213 2213
 		$TXN = $REG->get_first_related('Transaction');
2214 2214
 		$REGS = $TXN->get_many_related('Registration');
2215 2215
 
2216 2216
 		$all_trashed = TRUE;
2217
-		foreach ( $REGS as $registration ) {
2218
-			if ( ! $registration->get('REG_deleted') )
2217
+		foreach ($REGS as $registration) {
2218
+			if ( ! $registration->get('REG_deleted'))
2219 2219
 				$all_trashed = FALSE;
2220 2220
 		}
2221 2221
 
2222
-		if ( ! $all_trashed ) {
2223
-			EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2222
+		if ( ! $all_trashed) {
2223
+			EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2224 2224
 			return false;
2225 2225
 		}
2226 2226
 
2227 2227
 		//k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one).
2228
-		foreach ( $REGS as $registration ) {
2228
+		foreach ($REGS as $registration) {
2229 2229
 
2230 2230
 			//delete related answers
2231 2231
 			$registration->delete_related_permanently('Answer');
2232 2232
 
2233 2233
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
2234 2234
 			$attendee = $registration->get_first_related('Attendee');
2235
-			if ( $attendee instanceof EE_Attendee ) {
2235
+			if ($attendee instanceof EE_Attendee) {
2236 2236
 				$registration->_remove_relation_to($attendee, 'Attendee');
2237 2237
 			}
2238 2238
 
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
 			//now delete permanently the checkins related to this registration.
2243 2243
 			$registration->delete_related_permanently('Checkin');
2244 2244
 
2245
-			if ( $registration->ID() === $REG->ID() )
2245
+			if ($registration->ID() === $REG->ID())
2246 2246
 				continue; //we don't want to delete permanently the existing registration just yet.
2247 2247
 
2248 2248
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -2279,35 +2279,35 @@  discard block
 block discarded – undo
2279 2279
 	 * @return void
2280 2280
 	 */
2281 2281
 	public function new_registration() {
2282
-		if ( ! $this->_set_reg_event() ) {
2283
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
2282
+		if ( ! $this->_set_reg_event()) {
2283
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
2284 2284
 		}
2285
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2285
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2286 2286
 		// gotta start with a clean slate if we're not coming here via ajax
2287 2287
 		if (
2288
-			! defined('DOING_AJAX' )
2289
-			&& ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) )
2288
+			! defined('DOING_AJAX')
2289
+			&& ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))
2290 2290
 		) {
2291
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2291
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2292 2292
 		}
2293 2293
 
2294
-		$this->_template_args['event_name'] = '' ;
2294
+		$this->_template_args['event_name'] = '';
2295 2295
 		// event name
2296
-		if ( $this->_reg_event ) {
2296
+		if ($this->_reg_event) {
2297 2297
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2298
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2299
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2300
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2298
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2299
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2300
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2301 2301
 		}
2302 2302
 
2303 2303
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2304 2304
 
2305
-		if ( defined('DOING_AJAX' ) ) {
2305
+		if (defined('DOING_AJAX')) {
2306 2306
 			$this->_return_json();
2307 2307
 		}
2308 2308
 		// grab header
2309
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2310
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2309
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2310
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2311 2311
 
2312 2312
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2313 2313
 		// the details template wrapper
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
 	 * @return string html
2325 2325
 	 */
2326 2326
 	protected function _get_registration_step_content() {
2327
-		if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) {
2327
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2328 2328
 			$warning_msg = sprintf(
2329 2329
 				__(
2330 2330
 					'%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s',
@@ -2340,7 +2340,7 @@  discard block
 block discarded – undo
2340 2340
 				'</b>'
2341 2341
 			);
2342 2342
 			return '
2343
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2343
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2344 2344
 	<script >
2345 2345
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2346 2346
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2375,16 +2375,16 @@  discard block
 block discarded – undo
2375 2375
 		$cart = EE_Registry::instance()->SSN->cart();
2376 2376
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2377 2377
 
2378
-		switch ( $step ) {
2378
+		switch ($step) {
2379 2379
 			case 'ticket' :
2380 2380
 				$hidden_fields['processing_registration']['value'] = 1;
2381 2381
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2382
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2382
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2383 2383
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2384 2384
 				$template_args['show_notification_toggle'] = FALSE;
2385 2385
 				break;
2386 2386
 			case 'questions' :
2387
-				$hidden_fields[ 'processing_registration' ][ 'value' ] = 2;
2387
+				$hidden_fields['processing_registration']['value'] = 2;
2388 2388
 				$template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso');
2389 2389
 				//in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run.
2390 2390
 				$template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin();
@@ -2393,10 +2393,10 @@  discard block
 block discarded – undo
2393 2393
 				break;
2394 2394
 		}
2395 2395
 
2396
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2396
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2397 2397
 
2398 2398
 		return EEH_Template::display_template(
2399
-			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2399
+			REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2400 2400
 		);
2401 2401
 	}
2402 2402
 
@@ -2411,11 +2411,11 @@  discard block
 block discarded – undo
2411 2411
 	*		@return boolean
2412 2412
 	*/
2413 2413
 	private function _set_reg_event() {
2414
-		if ( is_object( $this->_reg_event )) {
2414
+		if (is_object($this->_reg_event)) {
2415 2415
 			return TRUE;
2416 2416
 		}
2417
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2418
-		if ( ! $EVT_ID ) {
2417
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2418
+		if ( ! $EVT_ID) {
2419 2419
 			return FALSE;
2420 2420
 		}
2421 2421
 
@@ -2436,80 +2436,80 @@  discard block
 block discarded – undo
2436 2436
 	public function process_reg_step() {
2437 2437
 		EE_System::do_not_cache();
2438 2438
 		$this->_set_reg_event();
2439
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2439
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2440 2440
 
2441 2441
 		//what step are we on?
2442 2442
 		$cart = EE_Registry::instance()->SSN->cart();
2443 2443
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2444 2444
 
2445 2445
 		//if doing ajax then we need to verify the nonce
2446
-		if ( defined( 'DOING_AJAX' ) ) {
2447
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2448
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2446
+		if (defined('DOING_AJAX')) {
2447
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2448
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2449 2449
 		}
2450 2450
 
2451
-		switch ( $step ) {
2451
+		switch ($step) {
2452 2452
 
2453 2453
 			case 'ticket' :
2454 2454
 				//process ticket selection
2455 2455
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2456
-				if ( $success ) {
2457
-					EE_Error::add_success( esc_html__( 'Tickets Selected. Now complete the registration.', 'event_espresso' ) );
2456
+				if ($success) {
2457
+					EE_Error::add_success(esc_html__('Tickets Selected. Now complete the registration.', 'event_espresso'));
2458 2458
 				} else {
2459 2459
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2460 2460
 				}
2461
-				if ( defined('DOING_AJAX') ) {
2461
+				if (defined('DOING_AJAX')) {
2462 2462
 					$this->new_registration(); //display next step
2463 2463
 				} else {
2464 2464
 					$query_args['action'] = 'new_registration';
2465 2465
 					$query_args['processing_registration'] = 1;
2466 2466
 					$query_args['event_id'] = $this->_reg_event->ID();
2467
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2467
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2468 2468
 				}
2469 2469
 				break;
2470 2470
 
2471 2471
 			case 'questions' :
2472
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2473
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2472
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2473
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2474 2474
 				}
2475 2475
 				//process registration
2476 2476
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2477
-				if ( $cart instanceof EE_Cart ) {
2477
+				if ($cart instanceof EE_Cart) {
2478 2478
 					$grand_total = $cart->get_cart_grand_total();
2479
-					if ( $grand_total instanceof EE_Line_Item ) {
2479
+					if ($grand_total instanceof EE_Line_Item) {
2480 2480
 						$grand_total->save_this_and_descendants_to_txn();
2481 2481
 					}
2482 2482
 				}
2483
-				if ( ! $transaction instanceof EE_Transaction ) {
2483
+				if ( ! $transaction instanceof EE_Transaction) {
2484 2484
 					$query_args = array(
2485 2485
 						'action' => 'new_registration',
2486 2486
 						'processing_registration' => 2,
2487 2487
 						'event_id' => $this->_reg_event->ID()
2488 2488
 					);
2489 2489
 
2490
-					if ( defined('DOING_AJAX' )) {
2490
+					if (defined('DOING_AJAX')) {
2491 2491
 						//display registration form again because there are errors (maybe validation?)
2492 2492
 						$this->new_registration();
2493 2493
 						return;
2494 2494
 					} else {
2495
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2495
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2496 2496
 						return;
2497 2497
 					}
2498 2498
 				}
2499 2499
 				// maybe update status, and make sure to save transaction if not done already
2500
-				if ( ! $transaction->update_status_based_on_total_paid() ) {
2500
+				if ( ! $transaction->update_status_based_on_total_paid()) {
2501 2501
 					$transaction->save();
2502 2502
 				}
2503
-				EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2503
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2504 2504
 				$this->_req_data = array();
2505 2505
 				$query_args = array(
2506 2506
 					'action'        => 'redirect_to_txn',
2507 2507
 					'TXN_ID'        => $transaction->ID(),
2508 2508
 					'EVT_ID'        => $this->_reg_event->ID(),
2509
-					'event_name'    => urlencode( $this->_reg_event->name() ),
2509
+					'event_name'    => urlencode($this->_reg_event->name()),
2510 2510
 					'redirect_from' => 'new_registration'
2511 2511
 				);
2512
-				$this->_redirect_after_action( false, '', '', $query_args, true );
2512
+				$this->_redirect_after_action(false, '', '', $query_args, true);
2513 2513
 				break;
2514 2514
 		}
2515 2515
 
@@ -2526,21 +2526,21 @@  discard block
 block discarded – undo
2526 2526
 	 */
2527 2527
 	public function redirect_to_txn() {
2528 2528
 		EE_System::do_not_cache();
2529
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2529
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2530 2530
 		$query_args = array(
2531 2531
 			'action' => 'view_transaction',
2532
-			'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] )  : 0,
2532
+			'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0,
2533 2533
 			'page'   => 'espresso_transactions'
2534 2534
 		);
2535
-		if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) {
2536
-			$query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ];
2537
-			$query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] );
2538
-			$query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ];
2535
+		if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) {
2536
+			$query_args['EVT_ID'] = $this->_req_data['EVT_ID'];
2537
+			$query_args['event_name'] = urlencode($this->_req_data['event_name']);
2538
+			$query_args['redirect_from'] = $this->_req_data['redirect_from'];
2539 2539
 		}
2540 2540
 		EE_Error::add_success(
2541
-			__( 'Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso' )
2541
+			__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')
2542 2542
 		);
2543
-		$this->_redirect_after_action( false, '', '', $query_args, true );
2543
+		$this->_redirect_after_action(false, '', '', $query_args, true);
2544 2544
 	}
2545 2545
 
2546 2546
 
@@ -2551,7 +2551,7 @@  discard block
 block discarded – undo
2551 2551
 	*		@return void
2552 2552
 	*/
2553 2553
 	protected function _attendee_contact_list_table() {
2554
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2554
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2555 2555
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2556 2556
 		$this->display_admin_list_table_page_with_no_sidebar();
2557 2557
 	}
@@ -2566,10 +2566,10 @@  discard block
 block discarded – undo
2566 2566
 	*		@access public
2567 2567
 	*		@return array
2568 2568
 	*/
2569
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2569
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2570 2570
 
2571
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2572
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2571
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2572
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2573 2573
 		$ATT_MDL = EEM_Attendee::instance();
2574 2574
 
2575 2575
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2597,47 +2597,47 @@  discard block
 block discarded – undo
2597 2597
 				$orderby = 'ATT_lname';
2598 2598
 		}
2599 2599
 
2600
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2600
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2601 2601
 
2602
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2603
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2604
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2602
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2603
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2604
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2605 2605
 
2606 2606
 		$_where = array();
2607 2607
 
2608
-		if ( ! empty( $this->_req_data['s'] ) ) {
2609
-			$sstr = '%' . $this->_req_data['s'] . '%';
2608
+		if ( ! empty($this->_req_data['s'])) {
2609
+			$sstr = '%'.$this->_req_data['s'].'%';
2610 2610
 			$_where['OR'] = array(
2611
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2612
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2613
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2614
-				'ATT_fname' => array( 'LIKE', $sstr ),
2615
-				'ATT_lname' => array( 'LIKE', $sstr ),
2616
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2617
-				'ATT_email' => array('LIKE', $sstr ),
2618
-				'ATT_address' => array( 'LIKE', $sstr ),
2619
-				'ATT_address2' => array( 'LIKE', $sstr ),
2620
-				'ATT_city' => array( 'LIKE', $sstr ),
2621
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2622
-				'State.STA_name' => array('LIKE', $sstr ),
2623
-				'ATT_phone' => array( 'LIKE', $sstr ),
2624
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2625
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2626
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2627
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2611
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2612
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2613
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2614
+				'ATT_fname' => array('LIKE', $sstr),
2615
+				'ATT_lname' => array('LIKE', $sstr),
2616
+				'ATT_short_bio' => array('LIKE', $sstr),
2617
+				'ATT_email' => array('LIKE', $sstr),
2618
+				'ATT_address' => array('LIKE', $sstr),
2619
+				'ATT_address2' => array('LIKE', $sstr),
2620
+				'ATT_city' => array('LIKE', $sstr),
2621
+				'Country.CNT_name' => array('LIKE', $sstr),
2622
+				'State.STA_name' => array('LIKE', $sstr),
2623
+				'ATT_phone' => array('LIKE', $sstr),
2624
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2625
+				'Registration.REG_code' => array('LIKE', $sstr),
2626
+				'Registration.REG_count' => array('LIKE', $sstr),
2627
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2628 2628
 				);
2629 2629
 		}
2630 2630
 
2631 2631
 
2632
-		$offset = ($current_page-1)*$per_page;
2633
-		$limit = $count ? NULL : array( $offset, $per_page );
2632
+		$offset = ($current_page - 1) * $per_page;
2633
+		$limit = $count ? NULL : array($offset, $per_page);
2634 2634
 
2635
-		if ( $trash ) {
2636
-			$_where['status'] = array( '!=', 'publish' );
2637
-			$all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true ): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2635
+		if ($trash) {
2636
+			$_where['status'] = array('!=', 'publish');
2637
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2638 2638
 		} else {
2639
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2640
-			$all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit ), 'ATT_ID' , true ) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );
2639
+			$_where['status'] = array('IN', array('publish'));
2640
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2641 2641
 		}
2642 2642
 
2643 2643
 		return $all_attendees;
@@ -2654,10 +2654,10 @@  discard block
 block discarded – undo
2654 2654
 	 */
2655 2655
 	protected function _resend_registration() {
2656 2656
 		$this->_process_resend_registration();
2657
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2657
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2658 2658
 			'action' => 'default'
2659 2659
 		);
2660
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2660
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2661 2661
 	}
2662 2662
 
2663 2663
 
@@ -2665,26 +2665,26 @@  discard block
 block discarded – undo
2665 2665
 
2666 2666
 
2667 2667
 
2668
-	public function _registrations_report(){
2669
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2670
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2668
+	public function _registrations_report() {
2669
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2670
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2671 2671
 				array(
2672 2672
 					'page' => 'espresso_batch',
2673 2673
 					'batch' => 'file',
2674
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2675
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2676
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2677
-				)) );
2674
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2675
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2676
+					'return_url' => urlencode($this->_req_data['return_url']),
2677
+				)));
2678 2678
 		} else {
2679 2679
 			$new_request_args = array(
2680 2680
 				'export' => 'report',
2681 2681
 				'action' => 'registrations_report_for_event',
2682
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2682
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2683 2683
 			);
2684 2684
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2685 2685
 
2686
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2687
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2686
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2687
+				require_once(EE_CLASSES.'EE_Export.class.php');
2688 2688
 				$EE_Export = EE_Export::instance($this->_req_data);
2689 2689
 				$EE_Export->export();
2690 2690
 			}
@@ -2693,26 +2693,26 @@  discard block
 block discarded – undo
2693 2693
 
2694 2694
 
2695 2695
 
2696
-	public function _contact_list_export(){
2697
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2698
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2696
+	public function _contact_list_export() {
2697
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2698
+			require_once(EE_CLASSES.'EE_Export.class.php');
2699 2699
 			$EE_Export = EE_Export::instance($this->_req_data);
2700 2700
 			$EE_Export->export_attendees();
2701 2701
 		}
2702 2702
 	}
2703 2703
 
2704
-	public function _contact_list_report(){
2705
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2706
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2704
+	public function _contact_list_report() {
2705
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2706
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2707 2707
 				array(
2708 2708
 					'page' => 'espresso_batch',
2709 2709
 					'batch' => 'file',
2710
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2711
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2712
-				)) );
2710
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2711
+					'return_url' => urlencode($this->_req_data['return_url']),
2712
+				)));
2713 2713
 		} else {
2714
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2715
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2714
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2715
+				require_once(EE_CLASSES.'EE_Export.class.php');
2716 2716
 				$EE_Export = EE_Export::instance($this->_req_data);
2717 2717
 				$EE_Export->report_attendees();
2718 2718
 			}
@@ -2731,73 +2731,73 @@  discard block
 block discarded – undo
2731 2731
 	 * @return void
2732 2732
 	 */
2733 2733
 	protected function _duplicate_attendee() {
2734
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2734
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2735 2735
 		//verify we have necessary info
2736
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2737
-			EE_Error::add_error( __('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ );
2738
-			$query_args = array( 'action' => $action );
2736
+		if (empty($this->_req_data['_REG_ID'])) {
2737
+			EE_Error::add_error(__('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
2738
+			$query_args = array('action' => $action);
2739 2739
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2740 2740
 		}
2741 2741
 
2742 2742
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2743
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2743
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2744 2744
 		$attendee = $registration->attendee();
2745 2745
 
2746 2746
 		//remove relation of existing attendee on registration
2747
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2747
+		$registration->_remove_relation_to($attendee, 'Attendee');
2748 2748
 		//new attendee
2749 2749
 		$new_attendee = clone $attendee;
2750
-		$new_attendee->set( 'ATT_ID', 0 );
2750
+		$new_attendee->set('ATT_ID', 0);
2751 2751
 		$new_attendee->save();
2752 2752
 
2753 2753
 		//add new attendee to reg
2754
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2754
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2755 2755
 
2756
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2756
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2757 2757
 
2758 2758
 		//redirect to edit page for attendee
2759
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2759
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2760 2760
 
2761
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2761
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2762 2762
 	}
2763 2763
 
2764 2764
 
2765 2765
 	//related to cpt routes
2766 2766
 	protected function _insert_update_cpt_item($post_id, $post) {
2767 2767
 		$success = true;
2768
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2768
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2769 2769
 		//for attendee updates
2770
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2770
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2771 2771
 			//note we should only be UPDATING attendees at this point.
2772 2772
 			$updated_fields = array(
2773 2773
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2774 2774
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2775
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2775
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2776 2776
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2777 2777
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2778
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2779
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2780
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2781
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2782
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2783
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2778
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2779
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2780
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2781
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2782
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2783
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2784 2784
 				);
2785
-			foreach ( $updated_fields as $field => $value ) {
2785
+			foreach ($updated_fields as $field => $value) {
2786 2786
 				$attendee->set($field, $value);
2787 2787
 			}
2788 2788
 
2789 2789
 			$success = $attendee->save();
2790 2790
 
2791
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2792
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2793
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2794
-					throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback ) );
2791
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2792
+			foreach ($attendee_update_callbacks as $a_callback) {
2793
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2794
+					throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback));
2795 2795
 				}
2796 2796
 			}
2797 2797
 		}
2798 2798
 
2799
-		if ( $success === FALSE )
2800
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2799
+		if ($success === FALSE)
2800
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2801 2801
 
2802 2802
 	}
2803 2803
 
@@ -2817,17 +2817,17 @@  discard block
 block discarded – undo
2817 2817
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2818 2818
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2819 2819
 
2820
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2821
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2820
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2821
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2822 2822
 		}
2823 2823
 
2824
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2824
+		if (post_type_supports('espresso_attendees', 'comments')) {
2825 2825
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2826 2826
 		}
2827 2827
 
2828
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2829
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2830
-		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2828
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2829
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2830
+		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2831 2831
 	}
2832 2832
 
2833 2833
 
@@ -2836,10 +2836,10 @@  discard block
 block discarded – undo
2836 2836
 	 * @param  WP_Post $post wp post object
2837 2837
 	 * @return string        attendee contact info ( and form )
2838 2838
 	 */
2839
-	public function attendee_contact_info( $post ) {
2839
+	public function attendee_contact_info($post) {
2840 2840
 		//get attendee object ( should already have it )
2841 2841
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2842
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2842
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2843 2843
 		EEH_Template::display_template($template, $this->_template_args);
2844 2844
 	}
2845 2845
 
@@ -2855,12 +2855,12 @@  discard block
 block discarded – undo
2855 2855
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2856 2856
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2857 2857
 				new EE_Question_Form_Input(
2858
-				EE_Question::new_instance( array(
2858
+				EE_Question::new_instance(array(
2859 2859
 					'QST_ID' => 0,
2860 2860
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2861 2861
 					'QST_system' => 'admin-state'
2862 2862
 					)),
2863
-				EE_Answer::new_instance( array(
2863
+				EE_Answer::new_instance(array(
2864 2864
 					'ANS_ID' => 0,
2865 2865
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2866 2866
 					)),
@@ -2873,12 +2873,12 @@  discard block
 block discarded – undo
2873 2873
 			));
2874 2874
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2875 2875
 				new EE_Question_Form_Input(
2876
-				EE_Question::new_instance( array(
2876
+				EE_Question::new_instance(array(
2877 2877
 					'QST_ID' => 0,
2878 2878
 					'QST_display_text' => __('Country', 'event_espresso'),
2879 2879
 					'QST_system' => 'admin-country'
2880 2880
 					)),
2881
-				EE_Answer::new_instance( array(
2881
+				EE_Answer::new_instance(array(
2882 2882
 					'ANS_ID' => 0,
2883 2883
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2884 2884
 					)),
@@ -2889,8 +2889,8 @@  discard block
 block discarded – undo
2889 2889
 					'append_qstn_id' => FALSE
2890 2890
 					)
2891 2891
 				));
2892
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2893
-		EEH_Template::display_template($template, $this->_template_args );
2892
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2893
+		EEH_Template::display_template($template, $this->_template_args);
2894 2894
 
2895 2895
 	}
2896 2896
 
@@ -2900,11 +2900,11 @@  discard block
 block discarded – undo
2900 2900
 	*		@access protected
2901 2901
 	*		@return void
2902 2902
 	*/
2903
-	public function attendee_registrations_meta_box( $post ) {
2903
+	public function attendee_registrations_meta_box($post) {
2904 2904
 
2905 2905
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2906 2906
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2907
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2907
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2908 2908
 		EEH_Template::display_template($template, $this->_template_args);
2909 2909
 
2910 2910
 	}
@@ -2918,8 +2918,8 @@  discard block
 block discarded – undo
2918 2918
 	 * @return string        html for new form.
2919 2919
 	 */
2920 2920
 	public function after_title_form_fields($post) {
2921
-		if ( $post->post_type == 'espresso_attendees' ) {
2922
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2921
+		if ($post->post_type == 'espresso_attendees') {
2922
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2923 2923
 			$template_args['attendee'] = $this->_cpt_model_obj;
2924 2924
 			EEH_Template::display_template($template, $template_args);
2925 2925
 		}
@@ -2936,21 +2936,21 @@  discard block
 block discarded – undo
2936 2936
 	*		@access protected
2937 2937
 	*		@return void
2938 2938
 	*/
2939
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2939
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2940 2940
 
2941
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2941
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2942 2942
 
2943 2943
 		$ATT_MDL = EEM_Attendee::instance();
2944 2944
 
2945 2945
 		$success = 1;
2946 2946
 		//Checkboxes
2947
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2947
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2948 2948
 			// if array has more than one element than success message should be plural
2949
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2949
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2950 2950
 			// cycle thru checkboxes
2951
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2952
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2953
-				if ( !$updated ) {
2951
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2952
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2953
+				if ( ! $updated) {
2954 2954
 					$success = 0;
2955 2955
 				}
2956 2956
 			}
@@ -2959,18 +2959,18 @@  discard block
 block discarded – undo
2959 2959
 			// grab single id and delete
2960 2960
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2961 2961
 			//get attendee
2962
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2962
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2963 2963
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2964 2964
 			$updated = $att->save();
2965
-			if ( ! $updated ) {
2965
+			if ( ! $updated) {
2966 2966
 				$success = 0;
2967 2967
 			}
2968 2968
 
2969 2969
 		}
2970 2970
 
2971
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2972
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2973
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2971
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2972
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2973
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2974 2974
 
2975 2975
 	}
2976 2976
 
Please login to merge, or discard this patch.
core/services/database/TableAnalysis.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 * @param string $table_name
25 25
 	 * @return string $tableName, having ensured it has the wpdb prefix on the front
26 26
 	 */
27
-	public function ensureTableNameHasPrefix( $table_name )
27
+	public function ensureTableNameHasPrefix($table_name)
28 28
 	{
29 29
 		global $wpdb;
30
-		return strpos( $table_name, $wpdb->base_prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name;
30
+		return strpos($table_name, $wpdb->base_prefix) === 0 ? $table_name : $wpdb->prefix.$table_name;
31 31
 	}
32 32
 
33 33
 
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	 * @param string $table_name
40 40
 	 * @return bool
41 41
 	 */
42
-	public function tableIsEmpty( $table_name )
42
+	public function tableIsEmpty($table_name)
43 43
 	{
44 44
 		global $wpdb;
45
-		$table_name = $this->ensureTableNameHasPrefix( $table_name );
46
-		if ( $this->tableExists( $table_name ) ) {
47
-			$count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" );
48
-			return absint( $count ) === 0 ? true : false;
45
+		$table_name = $this->ensureTableNameHasPrefix($table_name);
46
+		if ($this->tableExists($table_name)) {
47
+			$count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name");
48
+			return absint($count) === 0 ? true : false;
49 49
 		}
50 50
 		return false;
51 51
 	}
@@ -60,24 +60,24 @@  discard block
 block discarded – undo
60 60
 	 * @param $table_name
61 61
 	 * @return bool
62 62
 	 */
63
-	public function tableExists( $table_name )
63
+	public function tableExists($table_name)
64 64
 	{
65 65
 		global $wpdb, $EZSQL_ERROR;
66
-		$table_name = $this->ensureTableNameHasPrefix( $table_name );
66
+		$table_name = $this->ensureTableNameHasPrefix($table_name);
67 67
 		//ignore if this causes an sql error
68 68
 		$old_error = $wpdb->last_error;
69 69
 		$old_suppress_errors = $wpdb->suppress_errors();
70
-		$old_show_errors_value = $wpdb->show_errors( FALSE );
70
+		$old_show_errors_value = $wpdb->show_errors(FALSE);
71 71
 		$ezsql_error_cache = $EZSQL_ERROR;
72
-		$wpdb->get_results( "SELECT * from $table_name LIMIT 1");
73
-		$wpdb->show_errors( $old_show_errors_value );
74
-		$wpdb->suppress_errors( $old_suppress_errors );
72
+		$wpdb->get_results("SELECT * from $table_name LIMIT 1");
73
+		$wpdb->show_errors($old_show_errors_value);
74
+		$wpdb->suppress_errors($old_suppress_errors);
75 75
 		$new_error = $wpdb->last_error;
76 76
 		$wpdb->last_error = $old_error;
77 77
 		$EZSQL_ERROR = $ezsql_error_cache;
78 78
 		//if there was a table doesn't exist error
79
-		if( ! empty( $new_error ) ) {
80
-			if(
79
+		if ( ! empty($new_error)) {
80
+			if (
81 81
 				in_array(
82 82
 					\EEH_Activation::last_wpdb_error_code(),
83 83
 					array(
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 					)
88 88
 				)
89 89
 				||
90
-				preg_match( '~^Table .* doesn\'t exist~', $new_error ) //in case not using mysql and error codes aren't reliable, just check for this error string
90
+				preg_match('~^Table .* doesn\'t exist~', $new_error) //in case not using mysql and error codes aren't reliable, just check for this error string
91 91
 			) {
92 92
 				return false;
93 93
 			} else {
94 94
 				//log this because that's weird. Just use the normal PHP error log
95 95
 				error_log(
96 96
 					sprintf(
97
-						__( 'Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso' ),
97
+						__('Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso'),
98 98
 					$new_error
99 99
 					)
100 100
 				);
Please login to merge, or discard this patch.
core/db_models/helpers/EE_Table_Base.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * Base class for defining the tables that comprise models. This is used to store information
5 5
  * about the table\s alias, private key, etc.
6 6
  */
7
-abstract class EE_Table_Base{
7
+abstract class EE_Table_Base {
8 8
 
9 9
 	/**
10 10
 	 * This holds the table_name without the table prefix.
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 * @param boolean $global whether the table is "global" as in there is only 1 table on an entire multisite install,
42 42
 	 *					or whether each site on a multisite install has a copy of this table
43 43
 	 */
44
-	function __construct($table_name, $pk_column, $global = false ){
44
+	function __construct($table_name, $pk_column, $global = false) {
45 45
 		$this->_global = $global;
46 46
 		$prefix = $this->get_table_prefix();
47 47
 		//if they added the prefix, let's remove it because we delay adding the prefix until right when its needed.
48
-		if ( strpos( $table_name, $prefix ) === 0 ) {
49
-			$table_name = ltrim( $table_name, $prefix );
48
+		if (strpos($table_name, $prefix) === 0) {
49
+			$table_name = ltrim($table_name, $prefix);
50 50
 		}
51 51
 		$this->_table_name = $table_name;
52 52
 		$this->_pk_column = $pk_column;
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	public function get_table_prefix() {
65 65
 		global $wpdb;
66 66
 
67
-		if ( $this->_global ) {
67
+		if ($this->_global) {
68 68
 			$prefix = $wpdb->base_prefix;
69 69
 		} else {
70
-			$prefix = $wpdb->get_blog_prefix( EEM_Base::get_model_query_blog_id() );
70
+			$prefix = $wpdb->get_blog_prefix(EEM_Base::get_model_query_blog_id());
71 71
 		}
72 72
 		return $prefix;
73 73
 	}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @param string $table_alias
80 80
 	 */
81
-	function _construct_finalize_with_alias($table_alias){
81
+	function _construct_finalize_with_alias($table_alias) {
82 82
 		$this->_table_alias = $table_alias;
83 83
 	}
84 84
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 * Returns the fully qualified table name for the database (includes the table prefix current for the blog).
88 88
 	 * @return string
89 89
 	 */
90
-	function get_table_name(){
91
-		return $this->get_table_prefix() . $this->_table_name;
90
+	function get_table_name() {
91
+		return $this->get_table_prefix().$this->_table_name;
92 92
 	}
93 93
 
94 94
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	 * @return string
101 101
 	 * @throws EE_Error
102 102
 	 */
103
-	function get_table_alias(){
104
-		if( ! $this->_table_alias){
103
+	function get_table_alias() {
104
+		if ( ! $this->_table_alias) {
105 105
 			throw new EE_Error("You must call _construct_finalize_with_alias before using the EE_Table_Base. Did you forget to call parent::__construct at the end of your EEMerimental_Base child's __construct?");
106 106
 		}
107 107
 		return $this->_table_alias;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return string name of column of PK
115 115
 	 */
116
-	function get_pk_column(){
116
+	function get_pk_column() {
117 117
 		return $this->_pk_column;
118 118
 	}
119 119
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	 * returns a string with the table alias, a period, and the private key's column.
124 124
 	 * @return string
125 125
 	 */
126
-	function get_fully_qualified_pk_column(){
127
-		$sql =  $this->get_table_alias().".".$this->get_pk_column();
126
+	function get_fully_qualified_pk_column() {
127
+		$sql = $this->get_table_alias().".".$this->get_pk_column();
128 128
 		return $sql;
129 129
 	}
130 130
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 	 * returns the special sql for a inner select with a limit.
134 134
 	 * @return string    SQL select
135 135
 	 */
136
-	public function get_select_join_limit( $limit ) {
137
-		$limit = is_array( $limit ) ? 'LIMIT ' . implode(',', array_map( 'intval', $limit ) ) : 'LIMIT ' . (int) $limit;
138
-		$SQL = SP . '(SELECT * FROM ' . $this->_table_name . SP . $limit . ') AS ' . $this->_table_alias;
136
+	public function get_select_join_limit($limit) {
137
+		$limit = is_array($limit) ? 'LIMIT '.implode(',', array_map('intval', $limit)) : 'LIMIT '.(int) $limit;
138
+		$SQL = SP.'(SELECT * FROM '.$this->_table_name.SP.$limit.') AS '.$this->_table_alias;
139 139
 		return $SQL;
140 140
 	}
141 141
 	
Please login to merge, or discard this patch.
core/CPTs/EE_Register_CPTs.core.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -23,37 +23,37 @@  discard block
 block discarded – undo
23 23
 	 * 	constructor
24 24
 	 * instantiated at init priority 5
25 25
 	 */
26
-	function __construct(){
26
+	function __construct() {
27 27
 		// register taxonomies
28 28
 		$taxonomies = self::get_taxonomies();
29
-		foreach ( $taxonomies as $taxonomy =>  $tax ) {
30
-			$this->register_taxonomy( $taxonomy, $tax['singular_name'], $tax['plural_name'], $tax['args'] );
29
+		foreach ($taxonomies as $taxonomy =>  $tax) {
30
+			$this->register_taxonomy($taxonomy, $tax['singular_name'], $tax['plural_name'], $tax['args']);
31 31
 		}
32 32
 		// register CPTs
33
-		$CPTs =self::get_CPTs();
34
-		foreach ( $CPTs as $CPT_name =>  $CPT ) {
35
-			$this->register_CPT( $CPT_name, $CPT['singular_name'], $CPT['plural_name'], $CPT['args'], $CPT['singular_slug'], $CPT['plural_slug'] );
33
+		$CPTs = self::get_CPTs();
34
+		foreach ($CPTs as $CPT_name =>  $CPT) {
35
+			$this->register_CPT($CPT_name, $CPT['singular_name'], $CPT['plural_name'], $CPT['args'], $CPT['singular_slug'], $CPT['plural_slug']);
36 36
 		}
37 37
 		// setup default terms in any of our taxonomies (but only if we're in admin).
38 38
 		// Why not added via register_activation_hook?
39 39
 		// Because it's possible that in future iterations of EE we may add new defaults for specialized taxonomies (think event_types) and register_activation_hook only reliably runs when a user manually activates the plugin.
40 40
 		// Keep in mind that this will READ these terms if they are deleted by the user.  Hence MUST use terms.
41
-		if ( is_admin() ) {
41
+		if (is_admin()) {
42 42
 			$this->set_must_use_event_types();
43 43
 		}
44 44
 		//set default terms
45
-		$this->set_default_term( 'espresso_event_type', 'single-event', array('espresso_events') );
45
+		$this->set_default_term('espresso_event_type', 'single-event', array('espresso_events'));
46 46
 
47 47
 
48
-		add_action( 'AHEE__EE_System__initialize_last', array( __CLASS__,  'maybe_flush_rewrite_rules' ), 10 );
48
+		add_action('AHEE__EE_System__initialize_last', array(__CLASS__, 'maybe_flush_rewrite_rules'), 10);
49 49
 
50 50
 		//hook into save_post so that we can make sure that the default terms get saved on publish of registered cpts IF they don't have a term for that taxonomy set.
51
-		add_action('save_post', array( $this, 'save_default_term' ), 100, 2 );
51
+		add_action('save_post', array($this, 'save_default_term'), 100, 2);
52 52
 
53 53
 		//remove no html restrictions from core wp saving of term descriptions.  Note. this will affect only registered EE taxonomies.
54 54
 		$this->_allow_html_descriptions_for_ee_taxonomies();
55 55
 
56
-		do_action( 'AHEE__EE_Register_CPTs__construct_end', $this );
56
+		do_action('AHEE__EE_Register_CPTs__construct_end', $this);
57 57
 	}
58 58
 
59 59
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @return void
67 67
 	 */
68 68
 	public static function  maybe_flush_rewrite_rules() {
69
-		if ( get_option( 'ee_flush_rewrite_rules', TRUE )) {
69
+		if (get_option('ee_flush_rewrite_rules', TRUE)) {
70 70
 			flush_rewrite_rules();
71
-			update_option( 'ee_flush_rewrite_rules', FALSE );
71
+			update_option('ee_flush_rewrite_rules', FALSE);
72 72
 		}
73 73
 	}
74 74
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	protected function _allow_html_descriptions_for_ee_taxonomies() {
84 84
 		//first remove default filter for term description but we have to do this earlier before wp sets their own filter
85 85
 		//because they just set a global filter on all term descriptions before the custom term description filter. Really sux.
86
-		add_filter( 'pre_term_description', array( $this, 'ee_filter_ee_term_description_not_wp' ), 1, 2 );
86
+		add_filter('pre_term_description', array($this, 'ee_filter_ee_term_description_not_wp'), 1, 2);
87 87
 	}
88 88
 
89 89
 
@@ -93,16 +93,16 @@  discard block
 block discarded – undo
93 93
 	 * @param string $taxonomy      The taxonomy name for the taxonomy being filtered.
94 94
 	 * @return string
95 95
 	 */
96
-	public function ee_filter_ee_term_description_not_wp( $description, $taxonomy ) {
96
+	public function ee_filter_ee_term_description_not_wp($description, $taxonomy) {
97 97
 		//get a list of EE taxonomies
98
-		$ee_taxonomies = array_keys( self::get_taxonomies() );
98
+		$ee_taxonomies = array_keys(self::get_taxonomies());
99 99
 
100 100
 		//only do our own thing if the taxonomy listed is an ee taxonomy.
101
-		if ( in_array( $taxonomy, $ee_taxonomies ) ) {
101
+		if (in_array($taxonomy, $ee_taxonomies)) {
102 102
 			//remove default wp filter
103
-			remove_filter( 'pre_term_description', 'wp_filter_kses' );
103
+			remove_filter('pre_term_description', 'wp_filter_kses');
104 104
 			//sanitize THIS content.
105
-			$description = wp_kses( $description, wp_kses_allowed_html( 'post' ) );
105
+			$description = wp_kses($description, wp_kses_allowed_html('post'));
106 106
 		}
107 107
 		return $description;
108 108
 	}
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 *  @access 	public
117 117
 	 *  @return 	array
118 118
 	 */
119
-	public static function get_taxonomies(){
119
+	public static function get_taxonomies() {
120 120
 		// define taxonomies
121
-		return apply_filters( 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array(
121
+		return apply_filters('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array(
122 122
 			'espresso_event_categories' => array(
123 123
 				'singular_name' => __("Event Category", "event_espresso"),
124 124
 				'plural_name' => __("Event Categories", "event_espresso"),
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 						'delete_terms' => 'ee_delete_event_category',
132 132
 						'assign_terms' => 'ee_assign_event_category'
133 133
 						),
134
-					'rewrite' => array( 'slug' => __( 'event-category', 'event_espresso' ))
134
+					'rewrite' => array('slug' => __('event-category', 'event_espresso'))
135 135
 				)),
136 136
 			'espresso_venue_categories' => array(
137 137
 				'singular_name' => __("Venue Category", "event_espresso"),
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 						'delete_terms' => 'ee_delete_venue_category',
146 146
 						'assign_terms' => 'ee_assign_venue_category'
147 147
 						),
148
-					'rewrite' => array( 'slug' => __( 'venue-category', 'event_espresso' ))
148
+					'rewrite' => array('slug' => __('venue-category', 'event_espresso'))
149 149
 				)),
150 150
 			'espresso_event_type' => array(
151 151
 				'singular_name' => __("Event Type", "event_espresso"),
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 						'delete_terms' => 'ee_delete_event_type',
160 160
 						'assign_terms' => 'ee_assign_event_type'
161 161
 						),
162
-					'rewrite' => array( 'slug' => __( 'event-type', 'event_espresso' )),
162
+					'rewrite' => array('slug' => __('event-type', 'event_espresso')),
163 163
 					'hierarchical'=>true
164 164
 				))
165
-			) );
165
+			));
166 166
 	}
167 167
 
168 168
 
@@ -180,26 +180,26 @@  discard block
 block discarded – undo
180 180
 	 * @return array 	       Empty array if no matching model names for the given slug or an array of model
181 181
 	 *                                         names indexed by post type slug.
182 182
 	 */
183
-	public static function get_cpt_model_names( $post_type_slug = '' ) {
183
+	public static function get_cpt_model_names($post_type_slug = '') {
184 184
 		$cpts = self::get_CPTs();
185 185
 
186 186
 		//first if slug passed in...
187
-		if ( ! empty( $post_type_slug )  ) {
187
+		if ( ! empty($post_type_slug)) {
188 188
 			//match?
189
-			if ( ! isset( $cpts[$post_type_slug] ) || ( isset( $cpts[$post_type_slug] ) && empty( $cpts[$post_type_slug]['class_name'] ) ) ) {
189
+			if ( ! isset($cpts[$post_type_slug]) || (isset($cpts[$post_type_slug]) && empty($cpts[$post_type_slug]['class_name']))) {
190 190
 				return array();
191 191
 			}
192 192
 
193 193
 			//k let's get the model name for this cpt.
194
-			return array( $post_type_slug => str_replace( 'EE', 'EEM', $cpts[$post_type_slug]['class_name'] ) );
194
+			return array($post_type_slug => str_replace('EE', 'EEM', $cpts[$post_type_slug]['class_name']));
195 195
 		}
196 196
 
197 197
 
198 198
 		//if we made it here then we're returning an array of cpt model names indexed by post_type_slug.
199 199
 		$cpt_models = array();
200
-		foreach ( $cpts as $slug => $args ) {
201
-			if ( ! empty( $args['class_name'] ) ) {
202
-				$cpt_models[$slug] = str_replace( 'EE', 'EEM', $args['class_name'] );
200
+		foreach ($cpts as $slug => $args) {
201
+			if ( ! empty($args['class_name'])) {
202
+				$cpt_models[$slug] = str_replace('EE', 'EEM', $args['class_name']);
203 203
 			}
204 204
 		}
205 205
 		return $cpt_models;
@@ -220,12 +220,12 @@  discard block
 block discarded – undo
220 220
 	 * @return EEM_CPT_Base[]   successful instantiation will return an array of successfully instantiated EEM
221 221
 	 *                                     	  models  indexed by post slug.
222 222
 	 */
223
-	public static function instantiate_cpt_models( $post_type_slug = '' ) {
224
-		$cpt_model_names = self::get_cpt_model_names( $post_type_slug );
223
+	public static function instantiate_cpt_models($post_type_slug = '') {
224
+		$cpt_model_names = self::get_cpt_model_names($post_type_slug);
225 225
 		$instantiated = array();
226
-		foreach ( $cpt_model_names as $slug => $model_name ) {
227
-			$instance = EE_Registry::instance()->load_model( str_replace( 'EEM_', '', $model_name ) );
228
-			if ( $instance instanceof EEM_CPT_Base ) {
226
+		foreach ($cpt_model_names as $slug => $model_name) {
227
+			$instance = EE_Registry::instance()->load_model(str_replace('EEM_', '', $model_name));
228
+			if ($instance instanceof EEM_CPT_Base) {
229 229
 				$instantiated[$slug] = $instance;
230 230
 			}
231 231
 		}
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 	 *  @access 	public
243 243
 	 *  @return 	array
244 244
 	 */
245
-	public static function get_CPTs(){
245
+	public static function get_CPTs() {
246 246
 		// define CPTs
247 247
 		// NOTE the ['args']['page_templates'] array index is something specific to our CPTs and not part of the WP custom post type api.
248
-		return apply_filters( 'FHEE__EE_Register_CPTs__get_CPTs__cpts', array(
248
+		return apply_filters('FHEE__EE_Register_CPTs__get_CPTs__cpts', array(
249 249
 			'espresso_events' => array(
250 250
 				'singular_name' => __("Event", "event_espresso"),
251 251
 				'plural_name' => __("Events", "event_espresso"),
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 					'publicly_queryable'=> FALSE,
321 321
 					'hierarchical'=> FALSE,
322 322
 					'has_archive' => FALSE,
323
-					'taxonomies' => array( 'post_tag' ),
323
+					'taxonomies' => array('post_tag'),
324 324
 					'capability_type' => 'contact',
325 325
 					'capabilities' => array(
326 326
 						'edit_post' => 'ee_edit_contact',
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
 						'edit_private_posts' => 'ee_edit_contacts',
338 338
 						'edit_published_posts' => 'ee_edit_contacts'
339 339
 						),
340
-					'supports' => array( 'editor', 'thumbnail', 'excerpt', 'custom-fields', 'comments' ),
340
+					'supports' => array('editor', 'thumbnail', 'excerpt', 'custom-fields', 'comments'),
341 341
 				))
342
-			) );
342
+			));
343 343
 	}
344 344
 
345 345
 
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
 	public static function get_private_CPTs() {
353 353
 		$CPTs = self::get_CPTs();
354 354
 		$private_CPTs = array();
355
-		foreach ( $CPTs as $CPT => $details ) {
356
-			if ( empty( $details['args']['public'] ) )
357
-				$private_CPTs[ $CPT ] = $details;
355
+		foreach ($CPTs as $CPT => $details) {
356
+			if (empty($details['args']['public']))
357
+				$private_CPTs[$CPT] = $details;
358 358
 		}
359 359
 		return $private_CPTs;
360 360
 	}
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 * @param string $plural_name internationalized plural name
373 373
 	 * @param array $override_args like $args on http://codex.wordpress.org/Function_Reference/register_taxonomy
374 374
 	 */
375
-	function register_taxonomy( $taxonomy_name, $singular_name, $plural_name, $override_args = array() ){
375
+	function register_taxonomy($taxonomy_name, $singular_name, $plural_name, $override_args = array()) {
376 376
 
377 377
 		$args = array(
378 378
 			'hierarchical'      => true,
@@ -389,15 +389,15 @@  discard block
 block discarded – undo
389 389
 			//'rewrite'           => array( 'slug' => 'genre' ),
390 390
 		);
391 391
 
392
-	  if($override_args){
393
-		  if(isset($override_args['labels'])){
394
-			  $labels = array_merge($args['labels'],$override_args['labels']);
392
+	  if ($override_args) {
393
+		  if (isset($override_args['labels'])) {
394
+			  $labels = array_merge($args['labels'], $override_args['labels']);
395 395
 			  $args['labels'] = $labels;
396 396
 		  }
397
-		  $args = array_merge($args,$override_args);
397
+		  $args = array_merge($args, $override_args);
398 398
 
399 399
 	  }
400
-		register_taxonomy($taxonomy_name,null, $args);
400
+		register_taxonomy($taxonomy_name, null, $args);
401 401
 	}
402 402
 
403 403
 
@@ -411,27 +411,27 @@  discard block
 block discarded – undo
411 411
 	 * The default values set in this function will be overridden by whatever you set in $override_args
412 412
 	 * @return void, but registers the custom post type
413 413
 	 */
414
-	function register_CPT($post_type, $singular_name,$plural_name,$override_args = array(), $singular_slug = '', $plural_slug = '' ) {
414
+	function register_CPT($post_type, $singular_name, $plural_name, $override_args = array(), $singular_slug = '', $plural_slug = '') {
415 415
 
416 416
 	  $labels = array(
417 417
 		'name' => $plural_name,
418 418
 		'singular_name' => $singular_name,
419
-		'add_new' => sprintf(__("Add %s", "event_espresso"),$singular_name),
420
-		'add_new_item' => sprintf(__("Add New %s", "event_espresso"),$singular_name),
421
-		'edit_item' => sprintf(__("Edit %s", "event_espresso"),$singular_name),
422
-		'new_item' => sprintf(__("New %s", "event_espresso"),$singular_name),
423
-		'all_items' => sprintf(__("All %s", "event_espresso"),$plural_name),
424
-		'view_item' => sprintf(__("View %s", "event_espresso"),$singular_name),
425
-		'search_items' => sprintf(__("Search %s", "event_espresso"),$plural_name),
426
-		'not_found' => sprintf(__("No %s found", "event_espresso"),$plural_name),
427
-		'not_found_in_trash' => sprintf(__("No %s found in Trash", "event_espresso"),$plural_name),
419
+		'add_new' => sprintf(__("Add %s", "event_espresso"), $singular_name),
420
+		'add_new_item' => sprintf(__("Add New %s", "event_espresso"), $singular_name),
421
+		'edit_item' => sprintf(__("Edit %s", "event_espresso"), $singular_name),
422
+		'new_item' => sprintf(__("New %s", "event_espresso"), $singular_name),
423
+		'all_items' => sprintf(__("All %s", "event_espresso"), $plural_name),
424
+		'view_item' => sprintf(__("View %s", "event_espresso"), $singular_name),
425
+		'search_items' => sprintf(__("Search %s", "event_espresso"), $plural_name),
426
+		'not_found' => sprintf(__("No %s found", "event_espresso"), $plural_name),
427
+		'not_found_in_trash' => sprintf(__("No %s found in Trash", "event_espresso"), $plural_name),
428 428
 		'parent_item_colon' => '',
429
-		'menu_name' => sprintf(__("%s", "event_espresso"),$plural_name)
429
+		'menu_name' => sprintf(__("%s", "event_espresso"), $plural_name)
430 430
 	  );
431 431
 
432 432
 	  //verify plural slug and singular slug, if they aren't we'll use $singular_name and $plural_name
433
-	  $singular_slug = ! empty( $singular_slug ) ? $singular_slug : $singular_name;
434
-	  $plural_slug = ! empty( $plural_slug ) ? $plural_slug : $plural_name;
433
+	  $singular_slug = ! empty($singular_slug) ? $singular_slug : $singular_name;
434
+	  $plural_slug = ! empty($plural_slug) ? $plural_slug : $plural_name;
435 435
 
436 436
 
437 437
 	  //note the page_templates arg in the supports index is something specific to EE.  WordPress doesn't actually have that in their register_post_type api.
@@ -444,24 +444,24 @@  discard block
 block discarded – undo
444 444
 		'show_in_menu' => false,
445 445
 		'show_in_nav_menus' => false,
446 446
 		'query_var' => true,
447
-		'rewrite' => apply_filters( 'FHEE__EE_Register_CPTs__register_CPT__rewrite', array( 'slug' => $plural_slug ), $post_type ),
447
+		'rewrite' => apply_filters('FHEE__EE_Register_CPTs__register_CPT__rewrite', array('slug' => $plural_slug), $post_type),
448 448
 		'capability_type' => 'post',
449 449
 		'map_meta_cap' => true,
450 450
 		'has_archive' => true,
451 451
 		'hierarchical' => true,
452 452
 		'menu_position' => null,
453
-		'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments' )
453
+		'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments')
454 454
 	  );
455 455
 
456
-	  if($override_args){
457
-		  if(isset($override_args['labels'])){
458
-			  $labels = array_merge($args['labels'],$override_args['labels']);
456
+	  if ($override_args) {
457
+		  if (isset($override_args['labels'])) {
458
+			  $labels = array_merge($args['labels'], $override_args['labels']);
459 459
 		  }
460
-		  $args = array_merge($args,$override_args);
460
+		  $args = array_merge($args, $override_args);
461 461
 		  $args['labels'] = $labels;
462 462
 	  }
463 463
 
464
-	  register_post_type( $post_type, $args );
464
+	  register_post_type($post_type, $args);
465 465
 	}
466 466
 
467 467
 
@@ -469,15 +469,15 @@  discard block
 block discarded – undo
469 469
 
470 470
 	function set_must_use_event_types() {
471 471
 		$term_details = array(
472
-			'single-event' => array( __('Single Event', 'event_espresso'), __('A single event that spans one or more consecutive days. Attendee\'s register for the first date-time only', 'event_espresso') ), //example: a party or two-day long workshop
472
+			'single-event' => array(__('Single Event', 'event_espresso'), __('A single event that spans one or more consecutive days. Attendee\'s register for the first date-time only', 'event_espresso')), //example: a party or two-day long workshop
473 473
 
474
-			'multi-event' => array( __('Multi Event', 'event_espresso'), __('Multiple, separate, but related events that occur on consecutive days. Attendee\'s can register for any of the date-times', 'event_espresso') ), //example: a three day music festival or week long conference
474
+			'multi-event' => array(__('Multi Event', 'event_espresso'), __('Multiple, separate, but related events that occur on consecutive days. Attendee\'s can register for any of the date-times', 'event_espresso')), //example: a three day music festival or week long conference
475 475
 
476
-			'event-series' => array( __('Event Series', 'event_espresso'), __(' Multiple events that occur over multiple non-consecutive days. Attendee\'s register for the first date-time only', 'event_espresso') ), //example: an 8 week introduction to basket weaving course
476
+			'event-series' => array(__('Event Series', 'event_espresso'), __(' Multiple events that occur over multiple non-consecutive days. Attendee\'s register for the first date-time only', 'event_espresso')), //example: an 8 week introduction to basket weaving course
477 477
 
478
-			'recurring-event' => array( __('Recurring Event', 'event_espresso'), __('Multiple events that occur over multiple non-consecutive days. Attendee\'s can register for any of the date-times.', 'event_espresso') ), //example: a yoga class
478
+			'recurring-event' => array(__('Recurring Event', 'event_espresso'), __('Multiple events that occur over multiple non-consecutive days. Attendee\'s can register for any of the date-times.', 'event_espresso')), //example: a yoga class
479 479
 
480
-			'ongoing' => array( __('Ongoing Event', 'event_espresso'), __('An "event" that people can purchase tickets to gain access for anytime for this event regardless of date times on the event', 'event_espresso') ) //example: access to a museum
480
+			'ongoing' => array(__('Ongoing Event', 'event_espresso'), __('An "event" that people can purchase tickets to gain access for anytime for this event regardless of date times on the event', 'event_espresso')) //example: access to a museum
481 481
 
482 482
 			//'walk-in' => array( __('Walk In', 'event_espresso'), __('Single datetime and single entry recurring events. Attendees register for one or multiple datetimes individually.', 'event_espresso') ),
483 483
 			//'reservation' => array( __('Reservation', 'event_espresso'), __('Reservations are created by specifying available datetimes and quantities. Attendees choose from the available datetimes and specify the quantity available (if the maximum is greater than 1)') ), //@TODO to avoid confusion we'll implement this in a later iteration > EE4.1
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 			//'appointment' => array( __('Appointments', 'event_espresso'), __('Time slotted events where datetimes are generally in hours or minutes. For example, attendees can register for a single 15 minute or 1 hour time slot and this type of availability frequently reoccurs.', 'event_espresso') )
486 486
 
487 487
 			);
488
-		$this->set_must_use_terms( 'espresso_event_type', $term_details );
488
+		$this->set_must_use_terms('espresso_event_type', $term_details);
489 489
 	}
490 490
 
491 491
 
@@ -499,16 +499,16 @@  discard block
 block discarded – undo
499 499
 	 *
500 500
 	 * @return void
501 501
 	 */
502
-	function set_must_use_terms( $taxonomy, $term_details ) {
502
+	function set_must_use_terms($taxonomy, $term_details) {
503 503
 		$term_details = (array) $term_details;
504 504
 
505
-		foreach ( $term_details as $slug => $details ) {
506
-			if ( !term_exists( $slug, $taxonomy ) ) {
505
+		foreach ($term_details as $slug => $details) {
506
+			if ( ! term_exists($slug, $taxonomy)) {
507 507
 				$insert_arr = array(
508 508
 					'slug' => $slug,
509 509
 					'description' => $details[1]
510 510
 					);
511
-				wp_insert_term( $details[0], $taxonomy, $insert_arr );
511
+				wp_insert_term($details[0], $taxonomy, $insert_arr);
512 512
 			}
513 513
 		}
514 514
 	}
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
 	 * @param string $term_slug The slug of the term that will be the default.
523 523
 	 * @param array $cpt_slugs  An array of custom post types we want the default assigned to
524 524
 	 */
525
-	function set_default_term( $taxonomy, $term_slug, $cpt_slugs = array() ) {
526
-		$this->_default_terms[][$term_slug] = new EE_Default_Term( $taxonomy, $term_slug, $cpt_slugs );
525
+	function set_default_term($taxonomy, $term_slug, $cpt_slugs = array()) {
526
+		$this->_default_terms[][$term_slug] = new EE_Default_Term($taxonomy, $term_slug, $cpt_slugs);
527 527
 	}
528 528
 
529 529
 
@@ -535,20 +535,20 @@  discard block
 block discarded – undo
535 535
 	 * @param  object $post    Post object
536 536
 	 * @return void
537 537
 	 */
538
-	function save_default_term( $post_id, $post ) {
539
-		if ( empty( $this->_default_terms ) )
538
+	function save_default_term($post_id, $post) {
539
+		if (empty($this->_default_terms))
540 540
 			return; //no default terms set so lets just exit.
541 541
 
542
-		foreach ( $this->_default_terms as $defaults ) {
543
-			foreach ( $defaults as $default_obj ) {
544
-				if ( $post->post_status == 'publish' && in_array( $post->post_type, $default_obj->cpt_slugs ) ) {
542
+		foreach ($this->_default_terms as $defaults) {
543
+			foreach ($defaults as $default_obj) {
544
+				if ($post->post_status == 'publish' && in_array($post->post_type, $default_obj->cpt_slugs)) {
545 545
 
546 546
 					//note some error proofing going on here to save unnecessary db queries
547
-					$taxonomies = get_object_taxonomies( $post->post_type );
548
-					foreach ( (array) $taxonomies as $taxonomy ) {
549
-						$terms = wp_get_post_terms( $post_id, $taxonomy);
550
-						if ( empty( $terms ) && $taxonomy == $default_obj->taxonomy ) {
551
-							wp_set_object_terms( $post_id, array( $default_obj->term_slug ), $taxonomy );
547
+					$taxonomies = get_object_taxonomies($post->post_type);
548
+					foreach ((array) $taxonomies as $taxonomy) {
549
+						$terms = wp_get_post_terms($post_id, $taxonomy);
550
+						if (empty($terms) && $taxonomy == $default_obj->taxonomy) {
551
+							wp_set_object_terms($post_id, array($default_obj->term_slug), $taxonomy);
552 552
 						}
553 553
 					}
554 554
 				}
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 	 * @param string $term_slug The slug of the term that will be the default.
581 581
 	 * @param array $cpt_slugs  The custom post type the default term gets saved with
582 582
 	 */
583
-	public function __construct( $taxonomy, $term_slug, $cpt_slugs = array() ) {
583
+	public function __construct($taxonomy, $term_slug, $cpt_slugs = array()) {
584 584
 		$this->taxonomy = $taxonomy;
585 585
 		$this->cpt_slugs = (array) $cpt_slugs;
586 586
 		$this->term_slug = $term_slug;
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page.core.php 2 patches
Braces   +137 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -160,8 +162,9 @@  discard block
 block discarded – undo
160 162
 	 */
161 163
 	public function __construct( $routing = TRUE ) {
162 164
 
163
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
164
-			$this->_is_caf = TRUE;
165
+		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) {
166
+					$this->_is_caf = TRUE;
167
+		}
165 168
 
166 169
 		$this->_yes_no_values = array(
167 170
 			array('id' => TRUE, 'text' => __('Yes', 'event_espresso')),
@@ -192,8 +195,9 @@  discard block
 block discarded – undo
192 195
 		$this->_do_other_page_hooks();
193 196
 
194 197
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
195
-		if ( method_exists( $this, '_before_page_setup' ) )
196
-			$this->_before_page_setup();
198
+		if ( method_exists( $this, '_before_page_setup' ) ) {
199
+					$this->_before_page_setup();
200
+		}
197 201
 
198 202
 		//set up page dependencies
199 203
 		$this->_page_setup();
@@ -500,7 +504,9 @@  discard block
 block discarded – undo
500 504
 		global $ee_menu_slugs;
501 505
 		$ee_menu_slugs = (array) $ee_menu_slugs;
502 506
 
503
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
507
+		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) {
508
+			return FALSE;
509
+		}
504 510
 
505 511
 
506 512
 		// becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first
@@ -535,12 +541,14 @@  discard block
 block discarded – undo
535 541
 		}
536 542
 
537 543
 		//for caffeinated and other extended functionality.  If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays
538
-		if ( method_exists( $this, '_extend_page_config' ) )
539
-			$this->_extend_page_config();
544
+		if ( method_exists( $this, '_extend_page_config' ) ) {
545
+					$this->_extend_page_config();
546
+		}
540 547
 
541 548
 		//for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays.
542
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
543
-			$this->_extend_page_config_for_cpt();
549
+		if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) {
550
+					$this->_extend_page_config_for_cpt();
551
+		}
544 552
 
545 553
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
546 554
 		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
@@ -656,8 +664,9 @@  discard block
 block discarded – undo
656 664
 		//add screen options - global, page child class, and view specific
657 665
 		$this->_add_global_screen_options();
658 666
 		$this->_add_screen_options();
659
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
660
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
667
+		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) {
668
+					call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
669
+		}
661 670
 
662 671
 
663 672
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -668,28 +677,32 @@  discard block
 block discarded – undo
668 677
 		//add feature_pointers - global, page child class, and view specific
669 678
 		$this->_add_feature_pointers();
670 679
 		$this->_add_global_feature_pointers();
671
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
672
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
680
+		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) {
681
+					call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
682
+		}
673 683
 
674 684
 		//enqueue scripts/styles - global, page class, and view specific
675 685
 		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
676 686
 		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
677
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
678
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
687
+		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) {
688
+					add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
689
+		}
679 690
 
680 691
 		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
681 692
 
682 693
 		//admin_print_footer_scripts - global, page child class, and view specific.  NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.  In most cases that's doing_it_wrong().  But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these
683 694
 		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
684 695
 		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
685
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
686
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
696
+		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) {
697
+					add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
698
+		}
687 699
 
688 700
 		//admin footer scripts
689 701
 		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
690 702
 		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
691
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
692
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
703
+		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) {
704
+					add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
705
+		}
693 706
 
694 707
 
695 708
 		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
@@ -762,7 +775,9 @@  discard block
 block discarded – undo
762 775
 	protected function _verify_routes() {
763 776
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
764 777
 
765
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
778
+		if ( !$this->_current_page && !defined( 'DOING_AJAX')) {
779
+			return FALSE;
780
+		}
766 781
 
767 782
 		$this->_route = FALSE;
768 783
 		$func = FALSE;
@@ -872,8 +887,9 @@  discard block
 block discarded – undo
872 887
 	 * @return void
873 888
 	 */
874 889
 	protected function _route_admin_request() {
875
-		if (  ! $this->_is_UI_request )
876
-			$this->_verify_routes();
890
+		if (  ! $this->_is_UI_request ) {
891
+					$this->_verify_routes();
892
+		}
877 893
 
878 894
 		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
879 895
 
@@ -883,8 +899,9 @@  discard block
 block discarded – undo
883 899
 			$this->_verify_nonce( $nonce, $this->_req_nonce );
884 900
 		}
885 901
 		//set the nav_tabs array but ONLY if this is  UI_request
886
-		if ( $this->_is_UI_request )
887
-			$this->_set_nav_tabs();
902
+		if ( $this->_is_UI_request ) {
903
+					$this->_set_nav_tabs();
904
+		}
888 905
 
889 906
 		// grab callback function
890 907
 		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
@@ -921,8 +938,9 @@  discard block
 block discarded – undo
921 938
 			}
922 939
 
923 940
 
924
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
925
-				throw new EE_Error( $error_msg );
941
+			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) {
942
+							throw new EE_Error( $error_msg );
943
+			}
926 944
 		}
927 945
 
928 946
 		//if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route.
@@ -1049,8 +1067,9 @@  discard block
 block discarded – undo
1049 1067
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1050 1068
 				foreach ( $this->_help_tour['tours'] as $tour ) {
1051 1069
 					//if this is the end tour then we don't need to setup a button
1052
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1053
-						continue;
1070
+					if ( $tour instanceof EE_Help_Tour_final_stop ) {
1071
+											continue;
1072
+					}
1054 1073
 					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1055 1074
 				}
1056 1075
 				$tour_buttons .= implode('<br />', $tb);
@@ -1060,8 +1079,9 @@  discard block
 block discarded – undo
1060 1079
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1061 1080
 			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1062 1081
 				//check that the callback given is valid
1063
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1064
-					throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) );
1082
+				if ( !method_exists($this, $config['help_sidebar'] ) ) {
1083
+									throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) );
1084
+				}
1065 1085
 
1066 1086
 				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1067 1087
 
@@ -1085,18 +1105,23 @@  discard block
 block discarded – undo
1085 1105
 				}/**/
1086 1106
 
1087 1107
 
1088
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1108
+			if ( !isset( $config['help_tabs'] ) ) {
1109
+				return;
1110
+			}
1111
+			//no help tabs for this route
1089 1112
 
1090 1113
 			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1091 1114
 				//we're here so there ARE help tabs!
1092 1115
 
1093 1116
 				//make sure we've got what we need
1094
-				if ( !isset( $cfg['title'] ) )
1095
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1117
+				if ( !isset( $cfg['title'] ) ) {
1118
+									throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1119
+				}
1096 1120
 
1097 1121
 
1098
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1099
-					throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') );
1122
+				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) {
1123
+									throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') );
1124
+				}
1100 1125
 
1101 1126
 
1102 1127
 
@@ -1159,14 +1184,16 @@  discard block
 block discarded – undo
1159 1184
 		$this->_help_tour = array();
1160 1185
 
1161 1186
 		//exit early if help tours are turned off globally
1162
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1163
-			return;
1187
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) {
1188
+					return;
1189
+		}
1164 1190
 
1165 1191
 		//loop through _page_config to find any help_tour defined
1166 1192
 		foreach ( $this->_page_config as $route => $config ) {
1167 1193
 			//we're only going to set things up for this route
1168
-			if ( $route !== $this->_req_action )
1169
-				continue;
1194
+			if ( $route !== $this->_req_action ) {
1195
+							continue;
1196
+			}
1170 1197
 
1171 1198
 			if ( isset( $config['help_tour'] ) ) {
1172 1199
 
@@ -1201,8 +1228,9 @@  discard block
 block discarded – undo
1201 1228
 			}
1202 1229
 		}
1203 1230
 
1204
-		if ( !empty( $tours ) )
1205
-			$this->_help_tour['tours'] = $tours;
1231
+		if ( !empty( $tours ) ) {
1232
+					$this->_help_tour['tours'] = $tours;
1233
+		}
1206 1234
 
1207 1235
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
1208 1236
 	}
@@ -1242,15 +1270,21 @@  discard block
 block discarded – undo
1242 1270
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1243 1271
 		$i = 0;
1244 1272
 		foreach ( $this->_page_config as $slug => $config ) {
1245
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1246
-				continue; //no nav tab for this config
1273
+			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) {
1274
+							continue;
1275
+			}
1276
+			//no nav tab for this config
1247 1277
 
1248 1278
 			//check for persistent flag
1249
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1250
-				continue; //nav tab is only to appear when route requested.
1279
+			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) {
1280
+							continue;
1281
+			}
1282
+			//nav tab is only to appear when route requested.
1251 1283
 
1252
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1253
-				continue; //no nav tab becasue current user does not have access.
1284
+			if ( ! $this->check_user_access( $slug, TRUE ) ) {
1285
+							continue;
1286
+			}
1287
+			//no nav tab becasue current user does not have access.
1254 1288
 
1255 1289
 			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1256 1290
 			$this->_nav_tabs[$slug] = array(
@@ -1486,10 +1520,11 @@  discard block
 block discarded – undo
1486 1520
 			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1487 1521
 		}
1488 1522
 
1489
-		if ( $display )
1490
-			echo $content;
1491
-		else
1492
-			return $content;
1523
+		if ( $display ) {
1524
+					echo $content;
1525
+		} else {
1526
+					return $content;
1527
+		}
1493 1528
 	}
1494 1529
 
1495 1530
 
@@ -1506,8 +1541,9 @@  discard block
 block discarded – undo
1506 1541
 		$method_name = '_help_popup_content_' . $this->_req_action;
1507 1542
 
1508 1543
 		//if method doesn't exist let's get out.
1509
-		if ( !method_exists( $this, $method_name ) )
1510
-			return array();
1544
+		if ( !method_exists( $this, $method_name ) ) {
1545
+					return array();
1546
+		}
1511 1547
 
1512 1548
 		//k we're good to go let's retrieve the help array
1513 1549
 		$help_array = call_user_func( array( $this, $method_name ) );
@@ -1538,7 +1574,9 @@  discard block
 block discarded – undo
1538 1574
 	 */
1539 1575
 	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1540 1576
 
1541
-		if ( defined('DOING_AJAX') ) return;
1577
+		if ( defined('DOING_AJAX') ) {
1578
+			return;
1579
+		}
1542 1580
 
1543 1581
 		//let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1544 1582
 		$help_array = $this->_get_help_content();
@@ -1556,10 +1594,11 @@  discard block
 block discarded – undo
1556 1594
 		$content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1557 1595
 		$content = $content . $help_content;
1558 1596
 
1559
-		if ( $display )
1560
-			echo $content;
1561
-		else
1562
-			return $content;
1597
+		if ( $display ) {
1598
+					echo $content;
1599
+		} else {
1600
+					return $content;
1601
+		}
1563 1602
 	}
1564 1603
 
1565 1604
 
@@ -1785,8 +1824,10 @@  discard block
 block discarded – undo
1785 1824
 	protected function _set_list_table() {
1786 1825
 
1787 1826
 		//first is this a list_table view?
1788
-		if ( !isset($this->_route_config['list_table']) )
1789
-			return; //not a list_table view so get out.
1827
+		if ( !isset($this->_route_config['list_table']) ) {
1828
+					return;
1829
+		}
1830
+		//not a list_table view so get out.
1790 1831
 
1791 1832
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1792 1833
 
@@ -2148,8 +2189,9 @@  discard block
 block discarded – undo
2148 2189
 	protected function _espresso_sponsors_post_box() {
2149 2190
 
2150 2191
 		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2151
-		if ( $show_sponsors )
2152
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2192
+		if ( $show_sponsors ) {
2193
+					add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2194
+		}
2153 2195
 	}
2154 2196
 
2155 2197
 
@@ -2446,8 +2488,9 @@  discard block
 block discarded – undo
2446 2488
 
2447 2489
 		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2448 2490
 
2449
-		if ( defined('DOING_AJAX' ) )
2450
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2491
+		if ( defined('DOING_AJAX' ) ) {
2492
+					$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2493
+		}
2451 2494
 
2452 2495
 		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2453 2496
 
@@ -2589,10 +2632,11 @@  discard block
 block discarded – undo
2589 2632
 			true
2590 2633
 		);
2591 2634
 		// the final template wrapper
2592
-		if ( $sidebar )
2593
-			$this->display_admin_page_with_sidebar();
2594
-		else
2595
-			$this->display_admin_page_with_no_sidebar();
2635
+		if ( $sidebar ) {
2636
+					$this->display_admin_page_with_sidebar();
2637
+		} else {
2638
+					$this->display_admin_page_with_no_sidebar();
2639
+		}
2596 2640
 	}
2597 2641
 
2598 2642
 
@@ -2660,8 +2704,9 @@  discard block
 block discarded – undo
2660 2704
 
2661 2705
 
2662 2706
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2663
-		if ( NULL === error_get_last() || ! headers_sent() )
2664
-			header('Content-Type: application/json; charset=UTF-8');
2707
+		if ( NULL === error_get_last() || ! headers_sent() ) {
2708
+					header('Content-Type: application/json; charset=UTF-8');
2709
+		}
2665 2710
                 if( function_exists( 'wp_json_encode' ) ) {
2666 2711
                     echo wp_json_encode( $json );
2667 2712
                 } else {
@@ -2679,10 +2724,9 @@  discard block
 block discarded – undo
2679 2724
 	 * @throws EE_Error
2680 2725
 	 */
2681 2726
 	public function return_json() {
2682
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2683
-			$this->_return_json();
2684
-
2685
-		else {
2727
+		if ( defined('DOING_AJAX') && DOING_AJAX ) {
2728
+					$this->_return_json();
2729
+		} else {
2686 2730
 			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2687 2731
 		}
2688 2732
 	}
@@ -2824,7 +2868,9 @@  discard block
 block discarded – undo
2824 2868
 			$id = $this->_current_view . '_' . $ref;
2825 2869
 			$name = !empty($actions) ? $actions[$key] : $ref;
2826 2870
 			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2827
-			if ( !$both ) break;
2871
+			if ( !$both ) {
2872
+				break;
2873
+			}
2828 2874
 		}
2829 2875
 
2830 2876
 	}
@@ -3180,13 +3226,15 @@  discard block
 block discarded – undo
3180 3226
 		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3181 3227
 			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3182 3228
 
3183
-			if ( !$user = wp_get_current_user() )
3184
-			return;
3229
+			if ( !$user = wp_get_current_user() ) {
3230
+						return;
3231
+			}
3185 3232
 			$option = $_POST['wp_screen_options']['option'];
3186 3233
 			$value = $_POST['wp_screen_options']['value'];
3187 3234
 
3188
-			if ( $option != sanitize_key( $option ) )
3189
-				return;
3235
+			if ( $option != sanitize_key( $option ) ) {
3236
+							return;
3237
+			}
3190 3238
 
3191 3239
 			$map_option = $option;
3192 3240
 
@@ -3195,13 +3243,15 @@  discard block
 block discarded – undo
3195 3243
 			switch ( $map_option ) {
3196 3244
 				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3197 3245
 					$value = (int) $value;
3198
-					if ( $value < 1 || $value > 999 )
3199
-						return;
3246
+					if ( $value < 1 || $value > 999 ) {
3247
+											return;
3248
+					}
3200 3249
 					break;
3201 3250
 				default:
3202 3251
 					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3203
-					if ( false === $value )
3204
-						return;
3252
+					if ( false === $value ) {
3253
+											return;
3254
+					}
3205 3255
 					break;
3206 3256
 			}
3207 3257
 
@@ -3237,8 +3287,9 @@  discard block
 block discarded – undo
3237 3287
 	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3238 3288
 		$user_id = get_current_user_id();
3239 3289
 
3240
-		if ( !$skip_route_verify )
3241
-			$this->_verify_route($route);
3290
+		if ( !$skip_route_verify ) {
3291
+					$this->_verify_route($route);
3292
+		}
3242 3293
 
3243 3294
 
3244 3295
 		//now let's set the string for what kind of transient we're setting
Please login to merge, or discard this patch.
Spacing   +608 added lines, -608 removed lines patch added patch discarded remove patch
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
159 159
 	 * 		@access public
160 160
 	 */
161
-	public function __construct( $routing = TRUE ) {
161
+	public function __construct($routing = TRUE) {
162 162
 
163
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
163
+		if (strpos($this->_get_dir(), 'caffeinated') !== false)
164 164
 			$this->_is_caf = TRUE;
165 165
 
166 166
 		$this->_yes_no_values = array(
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 
173 173
 		//set the _req_data property.
174
-		$this->_req_data = array_merge( $_GET, $_POST );
174
+		$this->_req_data = array_merge($_GET, $_POST);
175 175
 
176 176
 
177 177
 		//routing enabled?
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		$this->_do_other_page_hooks();
193 193
 
194 194
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
195
-		if ( method_exists( $this, '_before_page_setup' ) )
195
+		if (method_exists($this, '_before_page_setup'))
196 196
 			$this->_before_page_setup();
197 197
 
198 198
 		//set up page dependencies
@@ -462,16 +462,16 @@  discard block
 block discarded – undo
462 462
 	 */
463 463
 	protected function _global_ajax_hooks() {
464 464
 		//for lazy loading of metabox content
465
-		add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 );
465
+		add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10);
466 466
 	}
467 467
 
468 468
 
469 469
 
470 470
 	public function ajax_metabox_content() {
471
-		$contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : '';
472
-		$url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : '';
471
+		$contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : '';
472
+		$url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : '';
473 473
 
474
-		self::cached_rss_display( $contentid, $url );
474
+		self::cached_rss_display($contentid, $url);
475 475
 		wp_die();
476 476
 	}
477 477
 
@@ -490,87 +490,87 @@  discard block
 block discarded – undo
490 490
 		//requires?
491 491
 
492 492
 		//admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can.  But keep in mind, not everything is available from the EE_Admin Page object at this point.
493
-		add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 );
493
+		add_action('admin_init', array($this, 'admin_init_global'), 5);
494 494
 
495 495
 
496 496
 		//next verify if we need to load anything...
497
-		$this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : '';
498
-		$this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) );
497
+		$this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : '';
498
+		$this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this))));
499 499
 
500 500
 		global $ee_menu_slugs;
501 501
 		$ee_menu_slugs = (array) $ee_menu_slugs;
502 502
 
503
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
503
+		if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE;
504 504
 
505 505
 
506 506
 		// becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first
507
-		if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) {
508
-			$this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
507
+		if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) {
508
+			$this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
509 509
 		}
510 510
 		// then set blank or -1 action values to 'default'
511
-		$this->_req_action = isset( $this->_req_data['action'] ) && ! empty( $this->_req_data['action'] ) && $this->_req_data['action'] != -1 ? sanitize_key( $this->_req_data['action'] ) : 'default';
511
+		$this->_req_action = isset($this->_req_data['action']) && ! empty($this->_req_data['action']) && $this->_req_data['action'] != -1 ? sanitize_key($this->_req_data['action']) : 'default';
512 512
 
513 513
 		//if action is 'default' after the above BUT we have  'route' var set, then let's use the route as the action.  This covers cases where we're coming in from a list table that isn't on the default route.
514
-		$this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action;
514
+		$this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
515 515
 
516 516
 		//however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
517 517
 		$this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
518 518
 
519 519
 		$this->_current_view = $this->_req_action;
520
-		$this->_req_nonce = $this->_req_action . '_nonce';
520
+		$this->_req_nonce = $this->_req_action.'_nonce';
521 521
 		$this->_define_page_props();
522 522
 
523
-		$this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ),  $this->_admin_base_url );
523
+		$this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url);
524 524
 
525 525
 		//default things
526
-		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' );
526
+		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box');
527 527
 
528 528
 		//set page configs
529 529
 		$this->_set_page_routes();
530 530
 		$this->_set_page_config();
531 531
 
532 532
 		//let's include any referrer data in our default_query_args for this route for "stickiness".
533
-		if ( isset( $this->_req_data['wp_referer'] ) ) {
533
+		if (isset($this->_req_data['wp_referer'])) {
534 534
 			$this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
535 535
 		}
536 536
 
537 537
 		//for caffeinated and other extended functionality.  If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays
538
-		if ( method_exists( $this, '_extend_page_config' ) )
538
+		if (method_exists($this, '_extend_page_config'))
539 539
 			$this->_extend_page_config();
540 540
 
541 541
 		//for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays.
542
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
542
+		if (method_exists($this, '_extend_page_config_for_cpt'))
543 543
 			$this->_extend_page_config_for_cpt();
544 544
 
545 545
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
546
-		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
547
-		$this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this );
546
+		$this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this);
547
+		$this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this);
548 548
 
549 549
 
550 550
 		//if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
551
-		if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) {
552
-			add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 );
551
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
552
+			add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2);
553 553
 		}
554 554
 
555 555
 
556 556
 		//next route only if routing enabled
557
-		if ( $this->_routing && !defined('DOING_AJAX') ) {
557
+		if ($this->_routing && ! defined('DOING_AJAX')) {
558 558
 
559 559
 			$this->_verify_routes();
560 560
 
561 561
 			//next let's just check user_access and kill if no access
562 562
 			$this->check_user_access();
563 563
 
564
-			if ( $this->_is_UI_request ) {
564
+			if ($this->_is_UI_request) {
565 565
 				//admin_init stuff - global, all views for this page class, specific view
566
-				add_action( 'admin_init', array( $this, 'admin_init' ), 10 );
567
-				if ( method_exists( $this, 'admin_init_' . $this->_current_view )) {
568
-					add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 );
566
+				add_action('admin_init', array($this, 'admin_init'), 10);
567
+				if (method_exists($this, 'admin_init_'.$this->_current_view)) {
568
+					add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15);
569 569
 				}
570 570
 
571 571
 			} else {
572 572
 				//hijack regular WP loading and route admin request immediately
573
-				@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
573
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
574 574
 				$this->route_admin_request();
575 575
 			}
576 576
 		}
@@ -587,18 +587,18 @@  discard block
 block discarded – undo
587 587
 	 * @return void
588 588
 	 */
589 589
 	private function _do_other_page_hooks() {
590
-		$registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() );
590
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array());
591 591
 
592
-		foreach ( $registered_pages as $page ) {
592
+		foreach ($registered_pages as $page) {
593 593
 
594 594
 			//now let's setup the file name and class that should be present
595 595
 			$classname = str_replace('.class.php', '', $page);
596 596
 
597 597
 			//autoloaders should take care of loading file
598
-			if ( !class_exists( $classname ) ) {
599
-				$error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page);
600
-				$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname );
601
-				throw new EE_Error( implode( '||', $error_msg ));
598
+			if ( ! class_exists($classname)) {
599
+				$error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page);
600
+				$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname);
601
+				throw new EE_Error(implode('||', $error_msg));
602 602
 			}
603 603
 
604 604
 			$a = new ReflectionClass($classname);
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	public function load_page_dependencies() {
614 614
 		try {
615 615
 			$this->_load_page_dependencies();
616
-		} catch ( EE_Error $e ) {
616
+		} catch (EE_Error $e) {
617 617
 			$e->get_error();
618 618
 		}
619 619
 	}
@@ -631,16 +631,16 @@  discard block
 block discarded – undo
631 631
 		$this->_current_screen = get_current_screen();
632 632
 
633 633
 		//load admin_notices - global, page class, and view specific
634
-		add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 );
635
-		add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 );
636
-		if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) {
637
-			add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 );
634
+		add_action('admin_notices', array($this, 'admin_notices_global'), 5);
635
+		add_action('admin_notices', array($this, 'admin_notices'), 10);
636
+		if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
637
+			add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15);
638 638
 		}
639 639
 
640 640
 		//load network admin_notices - global, page class, and view specific
641
-		add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 );
642
-		if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) {
643
-			add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) );
641
+		add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
642
+		if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
643
+			add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view));
644 644
 		}
645 645
 
646 646
 		//this will save any per_page screen options if they are present
@@ -656,8 +656,8 @@  discard block
 block discarded – undo
656 656
 		//add screen options - global, page child class, and view specific
657 657
 		$this->_add_global_screen_options();
658 658
 		$this->_add_screen_options();
659
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
660
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
659
+		if (method_exists($this, '_add_screen_options_'.$this->_current_view))
660
+			call_user_func(array($this, '_add_screen_options_'.$this->_current_view));
661 661
 
662 662
 
663 663
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -668,33 +668,33 @@  discard block
 block discarded – undo
668 668
 		//add feature_pointers - global, page child class, and view specific
669 669
 		$this->_add_feature_pointers();
670 670
 		$this->_add_global_feature_pointers();
671
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
672
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
671
+		if (method_exists($this, '_add_feature_pointer_'.$this->_current_view))
672
+			call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view));
673 673
 
674 674
 		//enqueue scripts/styles - global, page class, and view specific
675
-		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
676
-		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
677
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
678
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
675
+		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
676
+		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
677
+		if (method_exists($this, 'load_scripts_styles_'.$this->_current_view))
678
+			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15);
679 679
 
680
-		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
680
+		add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
681 681
 
682 682
 		//admin_print_footer_scripts - global, page child class, and view specific.  NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.  In most cases that's doing_it_wrong().  But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these
683
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
684
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
685
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
686
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
683
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
684
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
685
+		if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view))
686
+			add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101);
687 687
 
688 688
 		//admin footer scripts
689
-		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
690
-		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
691
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
692
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
689
+		add_action('admin_footer', array($this, 'admin_footer_global'), 99);
690
+		add_action('admin_footer', array($this, 'admin_footer'), 100);
691
+		if (method_exists($this, 'admin_footer_'.$this->_current_view))
692
+			add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101);
693 693
 
694 694
 
695
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
695
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
696 696
 		//targeted hook
697
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action );
697
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action);
698 698
 
699 699
 	}
700 700
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	private function _set_defaults() {
710 710
 		$this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL;
711 711
 
712
-		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config =  $this->_default_route_query_args = array();
712
+		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array();
713 713
 
714 714
 		$this->default_nav_tab_name = 'overview';
715 715
 
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 	public function route_admin_request() {
737 737
 		try {
738 738
 			$this->_route_admin_request();
739
-		} catch ( EE_Error $e ) {
739
+		} catch (EE_Error $e) {
740 740
 			$e->get_error();
741 741
 		}
742 742
 	}
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 		$this->_wp_page_slug = $wp_page_slug;
748 748
 
749 749
 		//if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
750
-		if ( is_network_admin() ) {
750
+		if (is_network_admin()) {
751 751
 			$this->_wp_page_slug .= '-network';
752 752
 		}
753 753
 	}
@@ -760,53 +760,53 @@  discard block
 block discarded – undo
760 760
 	 * @return void
761 761
 	 */
762 762
 	protected function _verify_routes() {
763
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
763
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
764 764
 
765
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
765
+		if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE;
766 766
 
767 767
 		$this->_route = FALSE;
768 768
 		$func = FALSE;
769 769
 		$args = array();
770 770
 
771 771
 		// check that the page_routes array is not empty
772
-		if ( empty( $this->_page_routes )) {
772
+		if (empty($this->_page_routes)) {
773 773
 			// user error msg
774
-			$error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title );
774
+			$error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
775 775
 			// developer error msg
776
-			$error_msg .=  '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' );
777
-			throw new EE_Error( $error_msg );
776
+			$error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso');
777
+			throw new EE_Error($error_msg);
778 778
 		}
779 779
 
780 780
 		// and that the requested page route exists
781
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
782
-			$this->_route = $this->_page_routes[ $this->_req_action ];
781
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
782
+			$this->_route = $this->_page_routes[$this->_req_action];
783 783
 			$this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array();
784 784
 		} else {
785 785
 			// user error msg
786
-			$error_msg =  sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
786
+			$error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
787 787
 			// developer error msg
788
-			$error_msg .=  '||' . $error_msg . sprintf( __( ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso' ), $this->_req_action );
789
-			throw new EE_Error( $error_msg );
788
+			$error_msg .= '||'.$error_msg.sprintf(__(' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso'), $this->_req_action);
789
+			throw new EE_Error($error_msg);
790 790
 		}
791 791
 
792 792
 		// and that a default route exists
793
-		if ( ! array_key_exists( 'default', $this->_page_routes )) {
793
+		if ( ! array_key_exists('default', $this->_page_routes)) {
794 794
 			// user error msg
795
-			$error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title );
795
+			$error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title);
796 796
 			// developer error msg
797
-			$error_msg .=  '||' . $error_msg . __( ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso' );
798
-			throw new EE_Error( $error_msg );
797
+			$error_msg .= '||'.$error_msg.__(' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso');
798
+			throw new EE_Error($error_msg);
799 799
 		}
800 800
 
801 801
 
802 802
 		//first lets' catch if the UI request has EVER been set.
803
-		if ( $this->_is_UI_request === NULL ) {
803
+		if ($this->_is_UI_request === NULL) {
804 804
 			//lets set if this is a UI request or not.
805
-			$this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE;
805
+			$this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE;
806 806
 
807 807
 
808 808
 			//wait a minute... we might have a noheader in the route array
809
-			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
809
+			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
810 810
 		}
811 811
 
812 812
 		$this->_set_current_labels();
@@ -821,15 +821,15 @@  discard block
 block discarded – undo
821 821
 	 * @param  string $route the route name we're verifying
822 822
 	 * @return mixed  (bool|Exception)      we'll throw an exception if this isn't a valid route.
823 823
 	 */
824
-	protected function _verify_route( $route ) {
825
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
824
+	protected function _verify_route($route) {
825
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
826 826
 			return true;
827 827
 		} else {
828 828
 			// user error msg
829
-			$error_msg =  sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
829
+			$error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
830 830
 			// developer error msg
831
-			$error_msg .=  '||' . $error_msg . sprintf( __( ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso' ), $route );
832
-			throw new EE_Error( $error_msg );
831
+			$error_msg .= '||'.$error_msg.sprintf(__(' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso'), $route);
832
+			throw new EE_Error($error_msg);
833 833
 		}
834 834
 	}
835 835
 
@@ -843,18 +843,18 @@  discard block
 block discarded – undo
843 843
 	 * @param  string $nonce_ref The nonce reference string (name0)
844 844
 	 * @return mixed (bool|die)
845 845
 	 */
846
-	protected function _verify_nonce( $nonce, $nonce_ref ) {
846
+	protected function _verify_nonce($nonce, $nonce_ref) {
847 847
 		// verify nonce against expected value
848
-		if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) {
848
+		if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
849 849
 			// these are not the droids you are looking for !!!
850
-			$msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' );
851
-			if ( WP_DEBUG ) {
852
-				$msg .= "\n  " . sprintf( __('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso' ), __CLASS__  );
850
+			$msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>');
851
+			if (WP_DEBUG) {
852
+				$msg .= "\n  ".sprintf(__('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso'), __CLASS__);
853 853
 			}
854
-			if ( ! defined( 'DOING_AJAX' )) {
855
-				wp_die( $msg );
854
+			if ( ! defined('DOING_AJAX')) {
855
+				wp_die($msg);
856 856
 			} else {
857
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
857
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
858 858
 				$this->_return_json();
859 859
 			}
860 860
 		}
@@ -872,63 +872,63 @@  discard block
 block discarded – undo
872 872
 	 * @return void
873 873
 	 */
874 874
 	protected function _route_admin_request() {
875
-		if (  ! $this->_is_UI_request )
875
+		if ( ! $this->_is_UI_request)
876 876
 			$this->_verify_routes();
877 877
 
878
-		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
878
+		$nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE;
879 879
 
880
-		if ( $this->_req_action != 'default' && $nonce_check ) {
880
+		if ($this->_req_action != 'default' && $nonce_check) {
881 881
 			// set nonce from post data
882
-			$nonce = isset($this->_req_data[ $this->_req_nonce  ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce  ] ) : '';
883
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
882
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
883
+			$this->_verify_nonce($nonce, $this->_req_nonce);
884 884
 		}
885 885
 		//set the nav_tabs array but ONLY if this is  UI_request
886
-		if ( $this->_is_UI_request )
886
+		if ($this->_is_UI_request)
887 887
 			$this->_set_nav_tabs();
888 888
 
889 889
 		// grab callback function
890
-		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
890
+		$func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
891 891
 
892 892
 		// check if callback has args
893
-		$args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array();
893
+		$args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
894 894
 
895 895
 		$error_msg = '';
896 896
 
897 897
 		//action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
898
-		if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) {
899
-			do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this );
898
+		if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
899
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
900 900
 		}
901 901
 
902 902
 		//right before calling the route, let's remove _wp_http_referer from the $_SERVER[REQUEST_URI] global (its now in _req_data for route processing).
903
-		$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
903
+		$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI']));
904 904
 
905
-		if ( ! empty( $func )) {
905
+		if ( ! empty($func)) {
906 906
 			$base_call = $addon_call = FALSE;
907 907
 			//try to access page route via this class
908
-			if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func  ), $args ) ) === FALSE ) {
908
+			if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) {
909 909
 				// user error msg
910
-				$error_msg =  __( 'An error occurred. The  requested page route could not be found.', 'event_espresso' );
910
+				$error_msg = __('An error occurred. The  requested page route could not be found.', 'event_espresso');
911 911
 				// developer error msg
912
-				$error_msg .= '||' . sprintf( __( 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso' ), $func );
912
+				$error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso'), $func);
913 913
 			}
914 914
 
915 915
 			//for pluggability by addons first let's see if just the function exists (this will also work in the case where $func is an array indicating class/method)
916 916
 			$args['admin_page_object'] = $this; //send along this admin page object for access by addons.
917 917
 
918
-			if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) {
919
-				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' );
920
-				$error_msg .= '||' . sprintf( __('Page route "%s" could not be called.  Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func );
918
+			if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) {
919
+				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso');
920
+				$error_msg .= '||'.sprintf(__('Page route "%s" could not be called.  Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func);
921 921
 			}
922 922
 
923 923
 
924
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
925
-				throw new EE_Error( $error_msg );
924
+			if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE)
925
+				throw new EE_Error($error_msg);
926 926
 		}
927 927
 
928 928
 		//if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route.
929 929
 		//now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent.
930
-		if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) {
931
-			$this->_reset_routing_properties( $this->_route['headers_sent_route'] );
930
+		if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) {
931
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
932 932
 		}
933 933
 	}
934 934
 
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 	 * @param  string    $new_route   New (non header) route to redirect to.
945 945
 	 * @return   void
946 946
 	 */
947
-	protected function _reset_routing_properties( $new_route ) {
947
+	protected function _reset_routing_properties($new_route) {
948 948
 		$this->_is_UI_request = TRUE;
949 949
 		//now we set the current route to whatever the headers_sent_route is set at
950 950
 		$this->_req_data['action'] = $new_route;
@@ -990,23 +990,23 @@  discard block
 block discarded – undo
990 990
 	 * @param   bool    $exclude_nonce  If true, the the nonce will be excluded from the generated nonce.
991 991
 	 * 	@return string
992 992
 	 */
993
-	public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) {
993
+	public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) {
994 994
 
995 995
 		//if there is a _wp_http_referer include the values from the request but only if sticky = true
996
-		if ( $sticky ) {
996
+		if ($sticky) {
997 997
 			$request = $_REQUEST;
998
-			unset( $request['_wp_http_referer'] );
999
-			unset( $request['wp_referer'] );
1000
-			foreach ( $request as $key => $value ) {
998
+			unset($request['_wp_http_referer']);
999
+			unset($request['wp_referer']);
1000
+			foreach ($request as $key => $value) {
1001 1001
 				//do not add nonces
1002
-				if ( strpos( $key, 'nonce' ) !== false ) {
1002
+				if (strpos($key, 'nonce') !== false) {
1003 1003
 					continue;
1004 1004
 				}
1005
-				$args['wp_referer[' . $key . ']'] = $value;
1005
+				$args['wp_referer['.$key.']'] = $value;
1006 1006
 			}
1007 1007
 		}
1008 1008
 
1009
-		return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce );
1009
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1010 1010
 	}
1011 1011
 
1012 1012
 
@@ -1022,8 +1022,8 @@  discard block
 block discarded – undo
1022 1022
 	 * @uses EEH_Template::get_help_tab_link()
1023 1023
 	 * @return string              generated link
1024 1024
 	 */
1025
-	protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) {
1026
-		return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text );
1025
+	protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) {
1026
+		return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text);
1027 1027
 	}
1028 1028
 
1029 1029
 
@@ -1040,30 +1040,30 @@  discard block
 block discarded – undo
1040 1040
 	 */
1041 1041
 	protected function _add_help_tabs() {
1042 1042
 		$tour_buttons = '';
1043
-		if ( isset( $this->_page_config[$this->_req_action] ) ) {
1043
+		if (isset($this->_page_config[$this->_req_action])) {
1044 1044
 			$config = $this->_page_config[$this->_req_action];
1045 1045
 
1046 1046
 			//is there a help tour for the current route?  if there is let's setup the tour buttons
1047
-			if ( isset( $this->_help_tour[$this->_req_action]) ) {
1047
+			if (isset($this->_help_tour[$this->_req_action])) {
1048 1048
 				$tb = array();
1049 1049
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1050
-				foreach ( $this->_help_tour['tours'] as $tour ) {
1050
+				foreach ($this->_help_tour['tours'] as $tour) {
1051 1051
 					//if this is the end tour then we don't need to setup a button
1052
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1052
+					if ($tour instanceof EE_Help_Tour_final_stop)
1053 1053
 						continue;
1054
-					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1054
+					$tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>';
1055 1055
 				}
1056 1056
 				$tour_buttons .= implode('<br />', $tb);
1057 1057
 				$tour_buttons .= '</div></div>';
1058 1058
 			}
1059 1059
 
1060 1060
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1061
-			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1061
+			if (is_array($config) && isset($config['help_sidebar'])) {
1062 1062
 				//check that the callback given is valid
1063
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1064
-					throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) );
1063
+				if ( ! method_exists($this, $config['help_sidebar']))
1064
+					throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this)));
1065 1065
 
1066
-				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1066
+				$content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar'])));
1067 1067
 
1068 1068
 				$content .= $tour_buttons; //add help tour buttons.
1069 1069
 
@@ -1072,49 +1072,49 @@  discard block
 block discarded – undo
1072 1072
 			}
1073 1073
 
1074 1074
 			//if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar.
1075
-			if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) {
1075
+			if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1076 1076
 				$this->_current_screen->set_help_sidebar($tour_buttons);
1077 1077
 			}
1078 1078
 
1079 1079
 			//handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1080
-			if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) {
1080
+			if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1081 1081
 				$_ht['id'] = $this->page_slug;
1082 1082
 				$_ht['title'] = __('Help Tours', 'event_espresso');
1083
-				$_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>';
1083
+				$_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>';
1084 1084
 				$this->_current_screen->add_help_tab($_ht);
1085 1085
 				}/**/
1086 1086
 
1087 1087
 
1088
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1088
+			if ( ! isset($config['help_tabs'])) return; //no help tabs for this route
1089 1089
 
1090
-			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1090
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1091 1091
 				//we're here so there ARE help tabs!
1092 1092
 
1093 1093
 				//make sure we've got what we need
1094
-				if ( !isset( $cfg['title'] ) )
1095
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1094
+				if ( ! isset($cfg['title']))
1095
+					throw new EE_Error(__('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso'));
1096 1096
 
1097 1097
 
1098
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1099
-					throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') );
1098
+				if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content']))
1099
+					throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso'));
1100 1100
 
1101 1101
 
1102 1102
 
1103 1103
 				//first priority goes to content.
1104
-				if ( !empty($cfg['content'] ) ) {
1105
-					$content = !empty($cfg['content']) ? $cfg['content'] : NULL;
1104
+				if ( ! empty($cfg['content'])) {
1105
+					$content = ! empty($cfg['content']) ? $cfg['content'] : NULL;
1106 1106
 
1107 1107
 				//second priority goes to filename
1108
-				} else if ( !empty($cfg['filename'] ) ) {
1109
-					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1108
+				} else if ( ! empty($cfg['filename'])) {
1109
+					$file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1110 1110
 
1111 1111
 
1112 1112
 					//it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too)
1113
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path;
1113
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path;
1114 1114
 
1115 1115
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1116
-					if ( !is_readable($file_path) && !isset($cfg['callback']) ) {
1117
-						EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ );
1116
+					if ( ! is_readable($file_path) && ! isset($cfg['callback'])) {
1117
+						EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__);
1118 1118
 						return;
1119 1119
 					}
1120 1120
 					$template_args['admin_page_obj'] = $this;
@@ -1125,21 +1125,21 @@  discard block
 block discarded – undo
1125 1125
 
1126 1126
 
1127 1127
 				//check if callback is valid
1128
-				if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) {
1129
-					EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ );
1128
+				if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) {
1129
+					EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__);
1130 1130
 					return;
1131 1131
 				}
1132 1132
 
1133 1133
 				//setup config array for help tab method
1134
-				$id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1134
+				$id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1135 1135
 				$_ht = array(
1136 1136
 					'id' => $id,
1137 1137
 					'title' => $cfg['title'],
1138
-					'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL,
1138
+					'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL,
1139 1139
 					'content' => $content
1140 1140
 					);
1141 1141
 
1142
-				$this->_current_screen->add_help_tab( $_ht );
1142
+				$this->_current_screen->add_help_tab($_ht);
1143 1143
 			}
1144 1144
 		}
1145 1145
 	}
@@ -1159,49 +1159,49 @@  discard block
 block discarded – undo
1159 1159
 		$this->_help_tour = array();
1160 1160
 
1161 1161
 		//exit early if help tours are turned off globally
1162
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1162
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS))
1163 1163
 			return;
1164 1164
 
1165 1165
 		//loop through _page_config to find any help_tour defined
1166
-		foreach ( $this->_page_config as $route => $config ) {
1166
+		foreach ($this->_page_config as $route => $config) {
1167 1167
 			//we're only going to set things up for this route
1168
-			if ( $route !== $this->_req_action )
1168
+			if ($route !== $this->_req_action)
1169 1169
 				continue;
1170 1170
 
1171
-			if ( isset( $config['help_tour'] ) ) {
1171
+			if (isset($config['help_tour'])) {
1172 1172
 
1173
-				foreach( $config['help_tour'] as $tour ) {
1174
-					$file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1173
+				foreach ($config['help_tour'] as $tour) {
1174
+					$file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php';
1175 1175
 					//let's see if we can get that file... if not its possible this is a decaf route not set in caffienated so lets try and get the caffeinated equivalent
1176
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path;
1176
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path;
1177 1177
 
1178 1178
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1179
-					if ( !is_readable($file_path) ) {
1180
-						EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ );
1179
+					if ( ! is_readable($file_path)) {
1180
+						EE_Error::add_error(sprintf(__('The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour), __FILE__, __FUNCTION__, __LINE__);
1181 1181
 						return;
1182 1182
 					}
1183 1183
 
1184 1184
 					require_once $file_path;
1185
-					if ( !class_exists( $tour ) ) {
1186
-						$error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour);
1187
-						$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this) );
1188
-						throw new EE_Error( implode( '||', $error_msg ));
1185
+					if ( ! class_exists($tour)) {
1186
+						$error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour);
1187
+						$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this));
1188
+						throw new EE_Error(implode('||', $error_msg));
1189 1189
 					}
1190 1190
 					$a = new ReflectionClass($tour);
1191 1191
 					$tour_obj = $a->newInstance($this->_is_caf);
1192 1192
 
1193 1193
 					$tours[] = $tour_obj;
1194
-					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj );
1194
+					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj);
1195 1195
 				}
1196 1196
 
1197 1197
 				//let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1198 1198
 				$end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1199 1199
 				$tours[] = $end_stop_tour;
1200
-				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour );
1200
+				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1201 1201
 			}
1202 1202
 		}
1203 1203
 
1204
-		if ( !empty( $tours ) )
1204
+		if ( ! empty($tours))
1205 1205
 			$this->_help_tour['tours'] = $tours;
1206 1206
 
1207 1207
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
@@ -1217,12 +1217,12 @@  discard block
 block discarded – undo
1217 1217
 	 * @return void
1218 1218
 	 */
1219 1219
 	protected function _add_qtips() {
1220
-		if ( isset( $this->_route_config['qtips'] ) ) {
1220
+		if (isset($this->_route_config['qtips'])) {
1221 1221
 			$qtips = (array) $this->_route_config['qtips'];
1222 1222
 			//load qtip loader
1223 1223
 			$path = array(
1224
-				$this->_get_dir() . '/qtips/',
1225
-				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/'
1224
+				$this->_get_dir().'/qtips/',
1225
+				EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/'
1226 1226
 				);
1227 1227
 			EEH_Qtip_Loader::instance()->register($qtips, $path);
1228 1228
 		}
@@ -1239,41 +1239,41 @@  discard block
 block discarded – undo
1239 1239
 	 * @return void
1240 1240
 	 */
1241 1241
 	protected function _set_nav_tabs() {
1242
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1242
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1243 1243
 		$i = 0;
1244
-		foreach ( $this->_page_config as $slug => $config ) {
1245
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1244
+		foreach ($this->_page_config as $slug => $config) {
1245
+			if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav'])))
1246 1246
 				continue; //no nav tab for this config
1247 1247
 
1248 1248
 			//check for persistent flag
1249
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1249
+			if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action)
1250 1250
 				continue; //nav tab is only to appear when route requested.
1251 1251
 
1252
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1252
+			if ( ! $this->check_user_access($slug, TRUE))
1253 1253
 				continue; //no nav tab becasue current user does not have access.
1254 1254
 
1255
-			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1255
+			$css_class = isset($config['css_class']) ? $config['css_class'].' ' : '';
1256 1256
 			$this->_nav_tabs[$slug] = array(
1257
-				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ),
1258
-				'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ),
1259
-				'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class,
1260
-				'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i
1257
+				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url),
1258
+				'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)),
1259
+				'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class,
1260
+				'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i
1261 1261
 				);
1262 1262
 			$i++;
1263 1263
 		}
1264 1264
 
1265 1265
 		//if $this->_nav_tabs is empty then lets set the default
1266
-		if ( empty( $this->_nav_tabs ) ) {
1266
+		if (empty($this->_nav_tabs)) {
1267 1267
 			$this->_nav_tabs[$this->default_nav_tab_name] = array(
1268 1268
 				'url' => $this->admin_base_url,
1269
-				'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ),
1269
+				'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)),
1270 1270
 				'css_class' => 'nav-tab-active',
1271 1271
 				'order' => 10
1272 1272
 				);
1273 1273
 		}
1274 1274
 
1275 1275
 		//now let's sort the tabs according to order
1276
-		usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' ));
1276
+		usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1277 1277
 
1278 1278
 	}
1279 1279
 
@@ -1289,10 +1289,10 @@  discard block
 block discarded – undo
1289 1289
 	 * @return void
1290 1290
 	 */
1291 1291
 	private function _set_current_labels() {
1292
-		if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) {
1293
-			foreach ( $this->_route_config['labels'] as $label => $text ) {
1294
-				if ( is_array($text) ) {
1295
-					foreach ( $text as $sublabel => $subtext ) {
1292
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1293
+			foreach ($this->_route_config['labels'] as $label => $text) {
1294
+				if (is_array($text)) {
1295
+					foreach ($text as $sublabel => $subtext) {
1296 1296
 						$this->_labels[$label][$sublabel] = $subtext;
1297 1297
 					}
1298 1298
 				} else {
@@ -1313,24 +1313,24 @@  discard block
 block discarded – undo
1313 1313
 	 * 		@param bool   $verify_only Default is FALSE which means if user check fails then wp_die().  Otherwise just return false if verify fail.
1314 1314
 	*		@return 		BOOL|wp_die()
1315 1315
 	*/
1316
-	public function check_user_access( $route_to_check = '', $verify_only = FALSE ) {
1317
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1318
-		$route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check;
1319
-		$capability = ! empty( $route_to_check ) && isset( $this->_page_routes[$route_to_check] ) && is_array( $this->_page_routes[$route_to_check] ) && ! empty( $this->_page_routes[$route_to_check]['capability'] ) ? $this->_page_routes[$route_to_check]['capability'] : NULL;
1316
+	public function check_user_access($route_to_check = '', $verify_only = FALSE) {
1317
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1318
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1319
+		$capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL;
1320 1320
 
1321
-		if ( empty( $capability ) && empty( $route_to_check )  ) {
1322
-			$capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability'];
1321
+		if (empty($capability) && empty($route_to_check)) {
1322
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability'];
1323 1323
 		} else {
1324
-			$capability = empty( $capability ) ? 'manage_options' : $capability;
1324
+			$capability = empty($capability) ? 'manage_options' : $capability;
1325 1325
 		}
1326 1326
 
1327
-		$id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0;
1327
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1328 1328
 
1329
-		if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) {
1330
-			if ( $verify_only ) {
1329
+		if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) {
1330
+			if ($verify_only) {
1331 1331
 				return FALSE;
1332 1332
 			} else {
1333
-				wp_die( __('You do not have access to this route.', 'event_espresso' ) );
1333
+				wp_die(__('You do not have access to this route.', 'event_espresso'));
1334 1334
 			}
1335 1335
 		}
1336 1336
 		return TRUE;
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 		$this->_add_admin_page_overlay();
1408 1408
 
1409 1409
 		//if metaboxes are present we need to add the nonce field
1410
-		if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) {
1410
+		if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) {
1411 1411
 			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1412 1412
 			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1413 1413
 		}
@@ -1426,19 +1426,19 @@  discard block
 block discarded – undo
1426 1426
 	 */
1427 1427
 	public function admin_footer_global() {
1428 1428
 		//dialog container for dialog helper
1429
-		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1429
+		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n";
1430 1430
 		$d_cont .= '<div class="ee-notices"></div>';
1431 1431
 		$d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1432 1432
 		$d_cont .= '</div>';
1433 1433
 		echo $d_cont;
1434 1434
 
1435 1435
 		//help tour stuff?
1436
-		if ( isset( $this->_help_tour[$this->_req_action] ) ) {
1436
+		if (isset($this->_help_tour[$this->_req_action])) {
1437 1437
 			echo implode('<br />', $this->_help_tour[$this->_req_action]);
1438 1438
 		}
1439 1439
 
1440 1440
 		//current set timezone for timezone js
1441
-		echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1441
+		echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>';
1442 1442
 	}
1443 1443
 
1444 1444
 
@@ -1462,18 +1462,18 @@  discard block
 block discarded – undo
1462 1462
 	 * @access protected
1463 1463
 	 * @return string content
1464 1464
 	 */
1465
-	protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) {
1465
+	protected function _set_help_popup_content($help_array = array(), $display = FALSE) {
1466 1466
 		$content = '';
1467 1467
 
1468
-		$help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array;
1469
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php';
1468
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1469
+		$template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php';
1470 1470
 
1471 1471
 
1472 1472
 		//loop through the array and setup content
1473
-		foreach ( $help_array as $trigger => $help ) {
1473
+		foreach ($help_array as $trigger => $help) {
1474 1474
 			//make sure the array is setup properly
1475
-			if ( !isset($help['title']) || !isset($help['content'] ) ) {
1476
-				throw new EE_Error( __('Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') );
1475
+			if ( ! isset($help['title']) || ! isset($help['content'])) {
1476
+				throw new EE_Error(__('Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso'));
1477 1477
 			}
1478 1478
 
1479 1479
 			//we're good so let'd setup the template vars and then assign parsed template content to our content.
@@ -1483,10 +1483,10 @@  discard block
 block discarded – undo
1483 1483
 				'help_popup_content' => $help['content']
1484 1484
 				);
1485 1485
 
1486
-			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1486
+			$content .= EEH_Template::display_template($template_path, $template_args, TRUE);
1487 1487
 		}
1488 1488
 
1489
-		if ( $display )
1489
+		if ($display)
1490 1490
 			echo $content;
1491 1491
 		else
1492 1492
 			return $content;
@@ -1503,18 +1503,18 @@  discard block
 block discarded – undo
1503 1503
 	 */
1504 1504
 	private function _get_help_content() {
1505 1505
 		//what is the method we're looking for?
1506
-		$method_name = '_help_popup_content_' . $this->_req_action;
1506
+		$method_name = '_help_popup_content_'.$this->_req_action;
1507 1507
 
1508 1508
 		//if method doesn't exist let's get out.
1509
-		if ( !method_exists( $this, $method_name ) )
1509
+		if ( ! method_exists($this, $method_name))
1510 1510
 			return array();
1511 1511
 
1512 1512
 		//k we're good to go let's retrieve the help array
1513
-		$help_array = call_user_func( array( $this, $method_name ) );
1513
+		$help_array = call_user_func(array($this, $method_name));
1514 1514
 
1515 1515
 		//make sure we've got an array!
1516
-		if ( !is_array($help_array) ) {
1517
-			throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) );
1516
+		if ( ! is_array($help_array)) {
1517
+			throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso'));
1518 1518
 		}
1519 1519
 
1520 1520
 		return $help_array;
@@ -1536,27 +1536,27 @@  discard block
 block discarded – undo
1536 1536
 	 * @param array $dimensions an array of dimensions for the box (array(h,w))
1537 1537
 	 * @return string
1538 1538
 	 */
1539
-	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1539
+	protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) {
1540 1540
 
1541
-		if ( defined('DOING_AJAX') ) return;
1541
+		if (defined('DOING_AJAX')) return;
1542 1542
 
1543 1543
 		//let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1544 1544
 		$help_array = $this->_get_help_content();
1545 1545
 		$help_content = '';
1546 1546
 
1547
-		if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) {
1547
+		if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1548 1548
 			$help_array[$trigger_id] = array(
1549 1549
 				'title' => __('Missing Content', 'event_espresso'),
1550 1550
 				'content' => __('A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)', 'event_espresso')
1551 1551
 				);
1552
-			$help_content = $this->_set_help_popup_content( $help_array, FALSE );
1552
+			$help_content = $this->_set_help_popup_content($help_array, FALSE);
1553 1553
 		}
1554 1554
 
1555 1555
 		//let's setup the trigger
1556
-		$content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1557
-		$content = $content . $help_content;
1556
+		$content = '<a class="ee-dialog" href="?height='.$dimensions[0].'&width='.$dimensions[1].'&inlineId='.$trigger_id.'" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1557
+		$content = $content.$help_content;
1558 1558
 
1559
-		if ( $display )
1559
+		if ($display)
1560 1560
 			echo $content;
1561 1561
 		else
1562 1562
 			return $content;
@@ -1613,15 +1613,15 @@  discard block
 block discarded – undo
1613 1613
 	public function load_global_scripts_styles() {
1614 1614
 		/** STYLES **/
1615 1615
 		// add debugging styles
1616
-		if ( WP_DEBUG ) {
1617
-			add_action('admin_head', array( $this, 'add_xdebug_style' ));
1616
+		if (WP_DEBUG) {
1617
+			add_action('admin_head', array($this, 'add_xdebug_style'));
1618 1618
 		}
1619 1619
 
1620 1620
 		//register all styles
1621
-		wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(),EVENT_ESPRESSO_VERSION );
1622
-		wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1621
+		wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION);
1622
+		wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1623 1623
 		//helpers styles
1624
-		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION );
1624
+		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION);
1625 1625
 		//enqueue global styles
1626 1626
 		wp_enqueue_style('ee-admin-css');
1627 1627
 
@@ -1629,66 +1629,66 @@  discard block
 block discarded – undo
1629 1629
 		/** SCRIPTS **/
1630 1630
 
1631 1631
 		//register all scripts
1632
-		wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1633
-		wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE );
1634
-		wp_register_script('ee_admin_js', EE_ADMIN_URL . 'assets/ee-admin-page.js', array( 'espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true );
1632
+		wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1633
+		wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE);
1634
+		wp_register_script('ee_admin_js', EE_ADMIN_URL.'assets/ee-admin-page.js', array('espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true);
1635 1635
 
1636
-		wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true );
1636
+		wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true);
1637 1637
 		// register jQuery Validate - see /includes/functions/wp_hooks.php
1638
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1638
+		add_filter('FHEE_load_jquery_validate', '__return_true');
1639 1639
 		add_filter('FHEE_load_joyride', '__return_true');
1640 1640
 
1641 1641
 		//script for sorting tables
1642
-		wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL . "assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
1642
+		wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL."assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
1643 1643
 		//script for parsing uri's
1644
-		wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1644
+		wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1645 1645
 		//and parsing associative serialized form elements
1646
-		wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1646
+		wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1647 1647
 		//helpers scripts
1648
-		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1649
-		wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1650
-		wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE );
1651
-		wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE );
1648
+		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1649
+		wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1650
+		wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE);
1651
+		wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE);
1652 1652
 
1653 1653
 		//google charts
1654
-		wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false );
1654
+		wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false);
1655 1655
 
1656 1656
 		//enqueue global scripts
1657 1657
 
1658 1658
 		//taking care of metaboxes
1659
-		if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) {
1659
+		if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) {
1660 1660
 			wp_enqueue_script('dashboard');
1661 1661
 		}
1662 1662
 
1663 1663
 		//enqueue thickbox for ee help popups.  default is to enqueue unless its explicitly set to false since we're assuming all EE pages will have popups
1664
-		if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) {
1664
+		if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) {
1665 1665
 			wp_enqueue_script('ee_admin_js');
1666 1666
 			wp_enqueue_style('ee-admin-css');
1667 1667
 		}
1668 1668
 
1669 1669
 
1670 1670
 		//localize script for ajax lazy loading
1671
-		$lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') );
1672
-		wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1671
+		$lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content'));
1672
+		wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1673 1673
 
1674 1674
 
1675 1675
 		/**
1676 1676
 		 * help tour stuff
1677 1677
 		 */
1678
-		if ( !empty( $this->_help_tour ) ) {
1678
+		if ( ! empty($this->_help_tour)) {
1679 1679
 
1680 1680
 			//register the js for kicking things off
1681
-			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE );
1681
+			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE);
1682 1682
 
1683 1683
 			//setup tours for the js tour object
1684
-			foreach ( $this->_help_tour['tours'] as $tour ) {
1684
+			foreach ($this->_help_tour['tours'] as $tour) {
1685 1685
 				$tours[] = array(
1686 1686
 					'id' => $tour->get_slug(),
1687 1687
 					'options' => $tour->get_options()
1688 1688
 					);
1689 1689
 			}
1690 1690
 
1691
-			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) );
1691
+			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
1692 1692
 
1693 1693
 			//admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1694 1694
 		}
@@ -1706,52 +1706,52 @@  discard block
 block discarded – undo
1706 1706
 	public function admin_footer_scripts_eei18n_js_strings() {
1707 1707
 
1708 1708
 		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1709
-		EE_Registry::$i18n_js_strings['confirm_delete'] = __( 'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso' );
1710
-
1711
-		EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' );
1712
-		EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' );
1713
-		EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' );
1714
-		EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' );
1715
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1716
-		EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' );
1717
-		EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' );
1718
-		EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' );
1719
-		EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' );
1720
-		EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' );
1721
-		EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' );
1722
-		EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' );
1723
-		EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' );
1724
-		EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' );
1725
-		EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' );
1726
-		EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' );
1727
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1728
-		EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' );
1729
-		EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' );
1730
-		EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' );
1731
-		EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' );
1732
-		EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' );
1733
-		EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' );
1734
-		EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' );
1735
-
1736
-		EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' );
1737
-		EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' );
1738
-		EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' );
1739
-		EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' );
1740
-		EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' );
1741
-		EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' );
1742
-		EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' );
1743
-		EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' );
1744
-		EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' );
1745
-		EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' );
1746
-		EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' );
1747
-		EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' );
1748
-		EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' );
1749
-		EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' );
1709
+		EE_Registry::$i18n_js_strings['confirm_delete'] = __('Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso');
1710
+
1711
+		EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso');
1712
+		EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso');
1713
+		EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso');
1714
+		EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso');
1715
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1716
+		EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso');
1717
+		EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso');
1718
+		EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso');
1719
+		EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso');
1720
+		EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso');
1721
+		EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso');
1722
+		EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso');
1723
+		EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso');
1724
+		EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso');
1725
+		EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso');
1726
+		EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso');
1727
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1728
+		EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso');
1729
+		EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso');
1730
+		EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso');
1731
+		EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso');
1732
+		EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso');
1733
+		EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso');
1734
+		EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso');
1735
+
1736
+		EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso');
1737
+		EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso');
1738
+		EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso');
1739
+		EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso');
1740
+		EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso');
1741
+		EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso');
1742
+		EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso');
1743
+		EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso');
1744
+		EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso');
1745
+		EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso');
1746
+		EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso');
1747
+		EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso');
1748
+		EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso');
1749
+		EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso');
1750 1750
 
1751 1751
 		//setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance
1752 1752
 		//admin page when in maintenance mode and ee_admin_js is not loaded then.  This works everywhere else because
1753 1753
 		//espresso_core is listed as a dependency of ee_admin_js.
1754
-		wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
1754
+		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
1755 1755
 
1756 1756
 	}
1757 1757
 
@@ -1785,23 +1785,23 @@  discard block
 block discarded – undo
1785 1785
 	protected function _set_list_table() {
1786 1786
 
1787 1787
 		//first is this a list_table view?
1788
-		if ( !isset($this->_route_config['list_table']) )
1788
+		if ( ! isset($this->_route_config['list_table']))
1789 1789
 			return; //not a list_table view so get out.
1790 1790
 
1791 1791
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1792 1792
 
1793
-		if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) {
1793
+		if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) {
1794 1794
 			//user error msg
1795
-			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' );
1795
+			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso');
1796 1796
 			//developer error msg
1797
-			$error_msg .= '||' . sprintf( __('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso' ), $this->_req_action, '_set_list_table_views_' . $this->_req_action );
1798
-			throw new EE_Error( $error_msg );
1797
+			$error_msg .= '||'.sprintf(__('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso'), $this->_req_action, '_set_list_table_views_'.$this->_req_action);
1798
+			throw new EE_Error($error_msg);
1799 1799
 		}
1800 1800
 
1801 1801
 		//let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1802
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views );
1803
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views );
1804
-		$this->_views = apply_filters( 'FHEE_list_table_views', $this->_views );
1802
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views);
1803
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
1804
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1805 1805
 
1806 1806
 		$this->_set_list_table_view();
1807 1807
 		$this->_set_list_table_object();
@@ -1823,14 +1823,14 @@  discard block
 block discarded – undo
1823 1823
 	*		@return array
1824 1824
 	*/
1825 1825
 	protected function _set_list_table_view() {
1826
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1826
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1827 1827
 
1828 1828
 
1829 1829
 		// looking at active items or dumpster diving ?
1830
-		if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) {
1831
-			$this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all';
1830
+		if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
1831
+			$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
1832 1832
 		} else {
1833
-			$this->_view = sanitize_key( $this->_req_data['status'] );
1833
+			$this->_view = sanitize_key($this->_req_data['status']);
1834 1834
 		}
1835 1835
 	}
1836 1836
 
@@ -1843,8 +1843,8 @@  discard block
 block discarded – undo
1843 1843
 	 * @throws \EE_Error
1844 1844
 	 */
1845 1845
 	protected function _set_list_table_object() {
1846
-		if ( isset( $this->_route_config['list_table'] ) ) {
1847
-			if ( ! class_exists( $this->_route_config['list_table'] ) ) {
1846
+		if (isset($this->_route_config['list_table'])) {
1847
+			if ( ! class_exists($this->_route_config['list_table'])) {
1848 1848
 				throw new EE_Error(
1849 1849
 					sprintf(
1850 1850
 						__(
@@ -1852,12 +1852,12 @@  discard block
 block discarded – undo
1852 1852
 							'event_espresso'
1853 1853
 						),
1854 1854
 						$this->_route_config['list_table'],
1855
-						get_class( $this )
1855
+						get_class($this)
1856 1856
 					)
1857 1857
 				);
1858 1858
 			}
1859 1859
 			$list_table = $this->_route_config['list_table'];
1860
-			$this->_list_table_object = new $list_table( $this );
1860
+			$this->_list_table_object = new $list_table($this);
1861 1861
 		}
1862 1862
 	}
1863 1863
 
@@ -1874,27 +1874,27 @@  discard block
 block discarded – undo
1874 1874
 	 *
1875 1875
 	 * @return array
1876 1876
 	 */
1877
-	public function get_list_table_view_RLs( $extra_query_args = array() ) {
1877
+	public function get_list_table_view_RLs($extra_query_args = array()) {
1878 1878
 
1879
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1879
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1880 1880
 
1881
-		if ( empty( $this->_views )) {
1881
+		if (empty($this->_views)) {
1882 1882
 			$this->_views = array();
1883 1883
 		}
1884 1884
 
1885 1885
 		// cycle thru views
1886
-		foreach ( $this->_views as $key => $view ) {
1886
+		foreach ($this->_views as $key => $view) {
1887 1887
 			$query_args = array();
1888 1888
 			// check for current view
1889
-			$this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1889
+			$this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1890 1890
 			$query_args['action'] = $this->_req_action;
1891
-			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
1891
+			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
1892 1892
 			$query_args['status'] = $view['slug'];
1893 1893
 			//merge any other arguments sent in.
1894
-			if ( isset( $extra_query_args[$view['slug']] ) ) {
1895
-				$query_args = array_merge( $query_args, $extra_query_args[$view['slug']] );
1894
+			if (isset($extra_query_args[$view['slug']])) {
1895
+				$query_args = array_merge($query_args, $extra_query_args[$view['slug']]);
1896 1896
 			}
1897
-			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1897
+			$this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1898 1898
 		}
1899 1899
 
1900 1900
 		return $this->_views;
@@ -1911,15 +1911,15 @@  discard block
 block discarded – undo
1911 1911
 	 * @param int $max_entries total number of rows in the table
1912 1912
 	 * @return string
1913 1913
 	*/
1914
-	protected function _entries_per_page_dropdown( $max_entries = FALSE ) {
1914
+	protected function _entries_per_page_dropdown($max_entries = FALSE) {
1915 1915
 
1916
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1917
-		$values = array( 10, 25, 50, 100 );
1918
-		$per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10;
1916
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1917
+		$values = array(10, 25, 50, 100);
1918
+		$per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
1919 1919
 
1920
-		if ( $max_entries ) {
1920
+		if ($max_entries) {
1921 1921
 			$values[] = $max_entries;
1922
-			sort( $values );
1922
+			sort($values);
1923 1923
 		}
1924 1924
 
1925 1925
 		$entries_per_page_dropdown = '
@@ -1928,15 +1928,15 @@  discard block
 block discarded – undo
1928 1928
 					Show
1929 1929
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
1930 1930
 
1931
-		foreach ( $values as $value ) {
1932
-			if ( $value < $max_entries ) {
1933
-				$selected = $value == $per_page ?  ' selected="' . $per_page . '"' : '';
1931
+		foreach ($values as $value) {
1932
+			if ($value < $max_entries) {
1933
+				$selected = $value == $per_page ? ' selected="'.$per_page.'"' : '';
1934 1934
 				$entries_per_page_dropdown .= '
1935 1935
 						<option value="'.$value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
1936 1936
 			}
1937 1937
 		}
1938 1938
 
1939
-		$selected = $max_entries == $per_page ?  ' selected="' . $per_page . '"' : '';
1939
+		$selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : '';
1940 1940
 		$entries_per_page_dropdown .= '
1941 1941
 						<option value="'.$max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
1942 1942
 
@@ -1959,8 +1959,8 @@  discard block
 block discarded – undo
1959 1959
 	*		@return 		void
1960 1960
 	*/
1961 1961
 	public function _set_search_attributes() {
1962
-		$this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label );
1963
-		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
1962
+		$this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label);
1963
+		$this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
1964 1964
 	}
1965 1965
 
1966 1966
 	/*** END LIST TABLE METHODS **/
@@ -1979,10 +1979,10 @@  discard block
 block discarded – undo
1979 1979
 	 * @return void
1980 1980
 	*/
1981 1981
 	private function _add_registered_meta_boxes() {
1982
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1982
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1983 1983
 
1984 1984
 		//we only add meta boxes if the page_route calls for it
1985
-		if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] )
1985
+		if (is_array($this->_route_config) && isset($this->_route_config['metaboxes'])
1986 1986
 			 && is_array(
1987 1987
 			 $this->_route_config['metaboxes']
1988 1988
 			 )
@@ -1990,27 +1990,27 @@  discard block
 block discarded – undo
1990 1990
 			// this simply loops through the callbacks provided
1991 1991
 			// and checks if there is a corresponding callback registered by the child
1992 1992
 			// if there is then we go ahead and process the metabox loader.
1993
-			foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) {
1993
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
1994 1994
 				// first check for Closures
1995
-				if ( $metabox_callback instanceof Closure ) {
1995
+				if ($metabox_callback instanceof Closure) {
1996 1996
 					$result = $metabox_callback();
1997
-				} else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) {
1998
-					$result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) );
1997
+				} else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) {
1998
+					$result = call_user_func(array($metabox_callback[0], $metabox_callback[1]));
1999 1999
 				} else {
2000
-					$result = call_user_func( array( $this, &$metabox_callback ) );
2000
+					$result = call_user_func(array($this, &$metabox_callback));
2001 2001
 				}
2002
-				if ( $result === FALSE ) {
2002
+				if ($result === FALSE) {
2003 2003
 					// user error msg
2004
-					$error_msg =  __( 'An error occurred. The  requested metabox could not be found.', 'event_espresso' );
2004
+					$error_msg = __('An error occurred. The  requested metabox could not be found.', 'event_espresso');
2005 2005
 					// developer error msg
2006
-					$error_msg .= '||' . sprintf(
2006
+					$error_msg .= '||'.sprintf(
2007 2007
 						__(
2008 2008
 							'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.',
2009 2009
 							'event_espresso'
2010 2010
 						),
2011 2011
 						$metabox_callback
2012 2012
 					);
2013
-					throw new EE_Error( $error_msg );
2013
+					throw new EE_Error($error_msg);
2014 2014
 				}
2015 2015
 			}
2016 2016
 		}
@@ -2027,17 +2027,17 @@  discard block
 block discarded – undo
2027 2027
 	 * @return void
2028 2028
 	 */
2029 2029
 	private function _add_screen_columns() {
2030
-		if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) {
2030
+		if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) {
2031 2031
 
2032
-			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) );
2032
+			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1]));
2033 2033
 			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2034 2034
 			$screen_id = $this->_current_screen->id;
2035 2035
 			$screen_columns = (int) get_user_option("screen_layout_$screen_id");
2036
-			$total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2037
-			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2036
+			$total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2037
+			$this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2038 2038
 			$this->_template_args['current_page'] = $this->_wp_page_slug;
2039 2039
 			$this->_template_args['screen'] = $this->_current_screen;
2040
-			$this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php';
2040
+			$this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php';
2041 2041
 
2042 2042
 			//finally if we don't have has_metaboxes set in the route config let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2043 2043
 			$this->_route_config['has_metaboxes'] = TRUE;
@@ -2054,11 +2054,11 @@  discard block
 block discarded – undo
2054 2054
 	 */
2055 2055
 
2056 2056
 	private function _espresso_news_post_box() {
2057
-		$news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) );
2058
-		add_meta_box( 'espresso_news_post_box', $news_box_title, array(
2057
+		$news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso'));
2058
+		add_meta_box('espresso_news_post_box', $news_box_title, array(
2059 2059
 			$this,
2060 2060
 			'espresso_news_post_box'
2061
-		), $this->_wp_page_slug, 'side' );
2061
+		), $this->_wp_page_slug, 'side');
2062 2062
 	}
2063 2063
 
2064 2064
 
@@ -2066,14 +2066,14 @@  discard block
 block discarded – undo
2066 2066
 	 * Code for setting up espresso ratings request metabox.
2067 2067
 	 */
2068 2068
 	protected function _espresso_ratings_request() {
2069
-		if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) {
2069
+		if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2070 2070
 			return '';
2071 2071
 		}
2072
-		$ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') );
2073
-		add_meta_box( 'espresso_ratings_request', $ratings_box_title, array(
2072
+		$ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso'));
2073
+		add_meta_box('espresso_ratings_request', $ratings_box_title, array(
2074 2074
 			$this,
2075 2075
 			'espresso_ratings_request'
2076
-		), $this->_wp_page_slug, 'side' );
2076
+		), $this->_wp_page_slug, 'side');
2077 2077
 	}
2078 2078
 
2079 2079
 
@@ -2081,34 +2081,34 @@  discard block
 block discarded – undo
2081 2081
 	 * Code for setting up espresso ratings request metabox content.
2082 2082
 	 */
2083 2083
 	public function espresso_ratings_request() {
2084
-		$template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php';
2085
-		EEH_Template::display_template( $template_path, array() );
2084
+		$template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php';
2085
+		EEH_Template::display_template($template_path, array());
2086 2086
 	}
2087 2087
 
2088 2088
 
2089 2089
 
2090 2090
 
2091
-	public static function cached_rss_display( $rss_id, $url ) {
2092
-		$loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
2093
-		$doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
2094
-		$pre = '<div class="espresso-rss-display">' . "\n\t";
2095
-		$pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2096
-		$post = '</div>' . "\n";
2091
+	public static function cached_rss_display($rss_id, $url) {
2092
+		$loading = '<p class="widget-loading hide-if-no-js">'.__('Loading&#8230;').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>';
2093
+		$doing_ajax = (defined('DOING_AJAX') && DOING_AJAX);
2094
+		$pre = '<div class="espresso-rss-display">'."\n\t";
2095
+		$pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>';
2096
+		$post = '</div>'."\n";
2097 2097
 
2098
-		$cache_key = 'ee_rss_' . md5( $rss_id );
2099
-		if ( FALSE != ( $output = get_transient( $cache_key ) ) ) {
2100
-			echo $pre . $output . $post;
2098
+		$cache_key = 'ee_rss_'.md5($rss_id);
2099
+		if (FALSE != ($output = get_transient($cache_key))) {
2100
+			echo $pre.$output.$post;
2101 2101
 			return TRUE;
2102 2102
 		}
2103 2103
 
2104
-		if ( ! $doing_ajax ) {
2105
-			echo $pre . $loading . $post;
2104
+		if ( ! $doing_ajax) {
2105
+			echo $pre.$loading.$post;
2106 2106
 			return FALSE;
2107 2107
 		}
2108 2108
 
2109 2109
 		ob_start();
2110
-		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) );
2111
-		set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
2110
+		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2111
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2112 2112
 		return TRUE;
2113 2113
 
2114 2114
 	}
@@ -2120,13 +2120,13 @@  discard block
 block discarded – undo
2120 2120
 	  	<div id="espresso_news_post_box_content" class="infolinks">
2121 2121
 	  		<?php
2122 2122
 	  		// Get RSS Feed(s)
2123
-	  		$feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' );
2123
+	  		$feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/');
2124 2124
 	  		$url = urlencode($feed_url);
2125
-	  		self::cached_rss_display( 'espresso_news_post_box_content', $url );
2125
+	  		self::cached_rss_display('espresso_news_post_box_content', $url);
2126 2126
 
2127 2127
 	  		?>
2128 2128
 	  	</div>
2129
-	  	<?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2129
+	  	<?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2130 2130
 	  </div>
2131 2131
 		<?php
2132 2132
 	}
@@ -2147,32 +2147,32 @@  discard block
 block discarded – undo
2147 2147
 
2148 2148
 	protected function _espresso_sponsors_post_box() {
2149 2149
 
2150
-		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2151
-		if ( $show_sponsors )
2152
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2150
+		$show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE);
2151
+		if ($show_sponsors)
2152
+			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2153 2153
 	}
2154 2154
 
2155 2155
 
2156 2156
 	public function espresso_sponsors_post_box() {
2157
-		$templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php';
2158
-		EEH_Template::display_template( $templatepath );
2157
+		$templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php';
2158
+		EEH_Template::display_template($templatepath);
2159 2159
 	}
2160 2160
 
2161 2161
 
2162 2162
 
2163 2163
 	private function _publish_post_box() {
2164
-		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2164
+		$meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2165 2165
 
2166 2166
 		//if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array then we'll use that for the metabox label.  Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2167
-		if ( !empty( $this->_labels['publishbox'] ) ) {
2168
-			$box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2167
+		if ( ! empty($this->_labels['publishbox'])) {
2168
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2169 2169
 		} else {
2170 2170
 			$box_label = __('Publish', 'event_espresso');
2171 2171
 		}
2172 2172
 
2173
-		$box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this );
2173
+		$box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this);
2174 2174
 
2175
-		add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' );
2175
+		add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high');
2176 2176
 
2177 2177
 	}
2178 2178
 
@@ -2180,9 +2180,9 @@  discard block
 block discarded – undo
2180 2180
 
2181 2181
 	public function editor_overview() {
2182 2182
 		//if we have extra content set let's add it in if not make sure its empty
2183
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2184
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php';
2185
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2183
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2184
+		$template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php';
2185
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2186 2186
 	}
2187 2187
 
2188 2188
 
@@ -2198,8 +2198,8 @@  discard block
 block discarded – undo
2198 2198
 	 * @see $this->_set_publish_post_box_vars for param details
2199 2199
 	 * @since 4.6.0
2200 2200
 	 */
2201
-	public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) {
2202
-		$this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns );
2201
+	public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) {
2202
+		$this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns);
2203 2203
 	}
2204 2204
 
2205 2205
 
@@ -2227,17 +2227,17 @@  discard block
 block discarded – undo
2227 2227
 		$both_btns = true
2228 2228
 	) {
2229 2229
 		// if Save & Close, use a custom redirect URL or default to the main page?
2230
-		$save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url;
2230
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url;
2231 2231
 		// create the Save & Close and Save buttons
2232
-		$this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL );
2232
+		$this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2233 2233
 		//if we have extra content set let's add it in if not make sure its empty
2234
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2234
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2235 2235
 
2236 2236
 
2237
-		if ( $delete && ! empty( $id )  ) {
2237
+		if ($delete && ! empty($id)) {
2238 2238
 			//make sure we have a default if just true is sent.
2239 2239
 			$delete = ! empty($delete) ? $delete : 'delete';
2240
-			$delete_link_args = array( $name => $id );
2240
+			$delete_link_args = array($name => $id);
2241 2241
 			$delete = $this->get_action_link_or_button(
2242 2242
 				$delete,
2243 2243
 				$delete,
@@ -2248,8 +2248,8 @@  discard block
 block discarded – undo
2248 2248
 			);
2249 2249
 		}
2250 2250
 
2251
-		$this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : '';
2252
-		if ( ! empty( $name ) && ! empty( $id ) ) {
2251
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2252
+		if ( ! empty($name) && ! empty($id)) {
2253 2253
 			$hidden_field_arr[$name] = array(
2254 2254
 				'type' => 'hidden',
2255 2255
 				'value' => $id
@@ -2259,7 +2259,7 @@  discard block
 block discarded – undo
2259 2259
 			$hf = '';
2260 2260
 		}
2261 2261
 		// add hidden field
2262
-		$this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf;
2262
+		$this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf;
2263 2263
 
2264 2264
 	}
2265 2265
 
@@ -2276,8 +2276,8 @@  discard block
 block discarded – undo
2276 2276
 		<noscript>
2277 2277
 			<div id="no-js-message" class="error">
2278 2278
 				<p style="font-size:1.3em;">
2279
-					<span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span>
2280
-					<?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?>
2279
+					<span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span>
2280
+					<?php _e('Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso'); ?>
2281 2281
 				</p>
2282 2282
 			</div>
2283 2283
 		</noscript>
@@ -2297,7 +2297,7 @@  discard block
 block discarded – undo
2297 2297
 	*		@return 		string
2298 2298
 	*/
2299 2299
 	private function _display_espresso_notices() {
2300
-		$notices = $this->_get_transient( TRUE );
2300
+		$notices = $this->_get_transient(TRUE);
2301 2301
 		echo stripslashes($notices);
2302 2302
 	}
2303 2303
 
@@ -2349,11 +2349,11 @@  discard block
 block discarded – undo
2349 2349
 	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2350 2350
 	 * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function created but just set our own callback for wp's add_meta_box.
2351 2351
 	 */
2352
-	public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) {
2353
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback );
2352
+	public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) {
2353
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2354 2354
 
2355 2355
 		//if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated.
2356
-		if ( empty( $callback_args ) && $create_func ) {
2356
+		if (empty($callback_args) && $create_func) {
2357 2357
 			$callback_args = array(
2358 2358
 				'template_path' => $this->_template_path,
2359 2359
 				'template_args' => $this->_template_args,
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
 		//if $create_func is true (default) then we automatically create the function for displaying the actual meta box.  If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish)
2364 2364
 		$call_back_func = $create_func ? create_function('$post, $metabox', 'do_action( "AHEE_log", __FILE__, __FUNCTION__, ""); echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );') : $callback;
2365 2365
 
2366
-		add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args );
2366
+		add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args);
2367 2367
 	}
2368 2368
 
2369 2369
 
@@ -2376,7 +2376,7 @@  discard block
 block discarded – undo
2376 2376
 	 */
2377 2377
 	public function display_admin_page_with_metabox_columns() {
2378 2378
 		$this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2379
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE);
2379
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE);
2380 2380
 
2381 2381
 		//the final wrapper
2382 2382
 		$this->admin_page_wrapper();
@@ -2419,7 +2419,7 @@  discard block
 block discarded – undo
2419 2419
 	 * @return void
2420 2420
 	 */
2421 2421
 	public function display_about_admin_page() {
2422
-		$this->_display_admin_page( FALSE, TRUE );
2422
+		$this->_display_admin_page(FALSE, TRUE);
2423 2423
 	}
2424 2424
 
2425 2425
 
@@ -2435,26 +2435,26 @@  discard block
 block discarded – undo
2435 2435
 	 * @return void
2436 2436
 	 */
2437 2437
 	private function _display_admin_page($sidebar = false, $about = FALSE) {
2438
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2438
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2439 2439
 
2440 2440
 		//custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2441
-		do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' );
2441
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2442 2442
 
2443 2443
 		// set current wp page slug - looks like: event-espresso_page_event_categories
2444 2444
 		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2445 2445
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2446 2446
 
2447
-		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2447
+		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2448 2448
 
2449
-		if ( defined('DOING_AJAX' ) )
2450
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2449
+		if (defined('DOING_AJAX'))
2450
+			$template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2451 2451
 
2452
-		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2452
+		$template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2453 2453
 
2454
-		$this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '';
2454
+		$this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '';
2455 2455
 		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '';
2456 2456
 		$this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '';
2457
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2457
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2458 2458
 
2459 2459
 
2460 2460
 		// the final template wrapper
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
 	 * @return void
2473 2473
 	 * @throws \EE_Error
2474 2474
 	 */
2475
-	public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) {
2475
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) {
2476 2476
 		//let's generate a default preview action button if there isn't one already present.
2477 2477
 		$this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso');
2478 2478
 		$buy_now_url = add_query_arg(
@@ -2485,7 +2485,7 @@  discard block
 block discarded – undo
2485 2485
 			),
2486 2486
 		'http://eventespresso.com/pricing/'
2487 2487
 		);
2488
-		$this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] )
2488
+		$this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button'])
2489 2489
 			? $this->get_action_link_or_button(
2490 2490
 				'',
2491 2491
 				'buy_now',
@@ -2495,13 +2495,13 @@  discard block
 block discarded – undo
2495 2495
 				true
2496 2496
 			)
2497 2497
 			: $this->_template_args['preview_action_button'];
2498
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php';
2498
+		$template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php';
2499 2499
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2500 2500
 			$template_path,
2501 2501
 			$this->_template_args,
2502 2502
 			true
2503 2503
 		);
2504
-		$this->_display_admin_page( $display_sidebar );
2504
+		$this->_display_admin_page($display_sidebar);
2505 2505
 	}
2506 2506
 
2507 2507
 
@@ -2535,49 +2535,49 @@  discard block
 block discarded – undo
2535 2535
 	 * @param boolean $sidebar whether to display with sidebar or not.
2536 2536
 	 * @return void
2537 2537
 	 */
2538
-	private function _display_admin_list_table_page( $sidebar = false ) {
2538
+	private function _display_admin_list_table_page($sidebar = false) {
2539 2539
 		//setup search attributes
2540 2540
 		$this->_set_search_attributes();
2541 2541
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2542
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2542
+		$template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2543 2543
 
2544
-		$this->_template_args['table_url'] = defined( 'DOING_AJAX')
2545
-			? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url )
2546
-			: add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url);
2544
+		$this->_template_args['table_url'] = defined('DOING_AJAX')
2545
+			? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url)
2546
+			: add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2547 2547
 		$this->_template_args['list_table'] = $this->_list_table_object;
2548 2548
 		$this->_template_args['current_route'] = $this->_req_action;
2549
-		$this->_template_args['list_table_class'] = get_class( $this->_list_table_object );
2549
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2550 2550
 
2551 2551
 		$ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2552
-		if( ! empty( $ajax_sorting_callback )) {
2552
+		if ( ! empty($ajax_sorting_callback)) {
2553 2553
 			$sortable_list_table_form_fields = wp_nonce_field(
2554
-				$ajax_sorting_callback . '_nonce',
2555
-				$ajax_sorting_callback . '_nonce',
2554
+				$ajax_sorting_callback.'_nonce',
2555
+				$ajax_sorting_callback.'_nonce',
2556 2556
 				FALSE,
2557 2557
 				FALSE
2558 2558
 			);
2559 2559
 //			$reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce';
2560 2560
 //			$sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE );
2561
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />';
2562
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />';
2561
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />';
2562
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />';
2563 2563
 		} else {
2564 2564
 			$sortable_list_table_form_fields = '';
2565 2565
 		}
2566 2566
 
2567 2567
 		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2568
-		$hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : '';
2569
-		$nonce_ref = $this->_req_action . '_nonce';
2570
-		$hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">';
2568
+		$hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : '';
2569
+		$nonce_ref = $this->_req_action.'_nonce';
2570
+		$hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">';
2571 2571
 		$this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2572 2572
 
2573 2573
 		//display message about search results?
2574 2574
 		$this->_template_args['before_list_table'] .= apply_filters(
2575 2575
 			'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg',
2576
-			! empty( $this->_req_data['s'] )
2577
-				? '<p class="ee-search-results">' . sprintf(
2578
-					__( 'Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso' ),
2579
-					trim( $this->_req_data['s'], '%' )
2580
-					) . '</p>'
2576
+			! empty($this->_req_data['s'])
2577
+				? '<p class="ee-search-results">'.sprintf(
2578
+					__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'),
2579
+					trim($this->_req_data['s'], '%')
2580
+					).'</p>'
2581 2581
 				: '',
2582 2582
 			$this->page_slug,
2583 2583
 			$this->_req_data,
@@ -2589,7 +2589,7 @@  discard block
 block discarded – undo
2589 2589
 			true
2590 2590
 		);
2591 2591
 		// the final template wrapper
2592
-		if ( $sidebar )
2592
+		if ($sidebar)
2593 2593
 			$this->display_admin_page_with_sidebar();
2594 2594
 		else
2595 2595
 			$this->display_admin_page_with_no_sidebar();
@@ -2612,9 +2612,9 @@  discard block
 block discarded – undo
2612 2612
 	 * @param  array $items  see above for format of array
2613 2613
 	 * @return string        html string of legend
2614 2614
 	 */
2615
-	protected function _display_legend( $items ) {
2616
-		$this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this );
2617
-		$legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php';
2615
+	protected function _display_legend($items) {
2616
+		$this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this);
2617
+		$legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php';
2618 2618
 		return EEH_Template::display_template($legend_template, $this->_template_args, TRUE);
2619 2619
 	}
2620 2620
 
@@ -2639,33 +2639,33 @@  discard block
 block discarded – undo
2639 2639
 	 *
2640 2640
 	 * @return void
2641 2641
 	 */
2642
-	protected function _return_json( $sticky_notices = false ) {
2642
+	protected function _return_json($sticky_notices = false) {
2643 2643
 
2644 2644
 		//make sure any EE_Error notices have been handled.
2645
-		$this->_process_notices( array(), true, $sticky_notices );
2645
+		$this->_process_notices(array(), true, $sticky_notices);
2646 2646
 
2647 2647
 
2648
-		$data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array();
2648
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
2649 2649
 		unset($this->_template_args['data']);
2650 2650
 		$json = array(
2651
-			'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false,
2652
-			'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false,
2653
-			'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false,
2654
-			'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false,
2651
+			'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
2652
+			'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
2653
+			'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
2654
+			'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
2655 2655
 			'notices' => EE_Error::get_notices(),
2656
-			'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '',
2657
-			'data' => array_merge( $data, array('template_args' => $this->_template_args ) ),
2656
+			'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '',
2657
+			'data' => array_merge($data, array('template_args' => $this->_template_args)),
2658 2658
 			'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
2659 2659
 			);
2660 2660
 
2661 2661
 
2662 2662
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2663
-		if ( NULL === error_get_last() || ! headers_sent() )
2663
+		if (NULL === error_get_last() || ! headers_sent())
2664 2664
 			header('Content-Type: application/json; charset=UTF-8');
2665
-                if( function_exists( 'wp_json_encode' ) ) {
2666
-                    echo wp_json_encode( $json );
2665
+                if (function_exists('wp_json_encode')) {
2666
+                    echo wp_json_encode($json);
2667 2667
                 } else {
2668
-                    echo json_encode( $json );
2668
+                    echo json_encode($json);
2669 2669
                 }
2670 2670
 		exit();
2671 2671
 	}
@@ -2679,11 +2679,11 @@  discard block
 block discarded – undo
2679 2679
 	 * @throws EE_Error
2680 2680
 	 */
2681 2681
 	public function return_json() {
2682
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2682
+		if (defined('DOING_AJAX') && DOING_AJAX)
2683 2683
 			$this->_return_json();
2684 2684
 
2685 2685
 		else {
2686
-			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2686
+			throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__));
2687 2687
 		}
2688 2688
 	}
2689 2689
 
@@ -2696,7 +2696,7 @@  discard block
 block discarded – undo
2696 2696
 	 *
2697 2697
 	 * @access   public
2698 2698
 	 */
2699
-	public function set_hook_object( EE_Admin_Hooks $hook_obj ) {
2699
+	public function set_hook_object(EE_Admin_Hooks $hook_obj) {
2700 2700
 		$this->_hook_obj = $hook_obj;
2701 2701
 	}
2702 2702
 
@@ -2712,33 +2712,33 @@  discard block
 block discarded – undo
2712 2712
 	*/
2713 2713
 	public function admin_page_wrapper($about = FALSE) {
2714 2714
 
2715
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2715
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2716 2716
 
2717 2717
 		$this->_nav_tabs = $this->_get_main_nav_tabs();
2718 2718
 
2719 2719
 		$this->_template_args['nav_tabs'] = $this->_nav_tabs;
2720 2720
 		$this->_template_args['admin_page_title'] = $this->_admin_page_title;
2721 2721
 
2722
-		$this->_template_args['before_admin_page_content'] = apply_filters( 'FHEE_before_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['before_admin_page_content'] ) ? $this->_template_args['before_admin_page_content'] : '');
2723
-		$this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : '');
2722
+		$this->_template_args['before_admin_page_content'] = apply_filters('FHEE_before_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '');
2723
+		$this->_template_args['after_admin_page_content'] = apply_filters('FHEE_after_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '');
2724 2724
 
2725 2725
 		$this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
2726 2726
 
2727 2727
 
2728 2728
 
2729 2729
 		// load settings page wrapper template
2730
-		$template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php';
2730
+		$template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php';
2731 2731
 
2732 2732
 		//about page?
2733 2733
 		$template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path;
2734 2734
 
2735 2735
 
2736
-		if ( defined( 'DOING_AJAX' ) ) {
2737
-			$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2736
+		if (defined('DOING_AJAX')) {
2737
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2738 2738
 
2739 2739
 			$this->_return_json();
2740 2740
 		} else {
2741
-			EEH_Template::display_template( $template_path, $this->_template_args );
2741
+			EEH_Template::display_template($template_path, $this->_template_args);
2742 2742
 		}
2743 2743
 
2744 2744
 	}
@@ -2764,7 +2764,7 @@  discard block
 block discarded – undo
2764 2764
 	 * @param $b
2765 2765
 	 * @return int
2766 2766
 	 */
2767
-	private function _sort_nav_tabs( $a, $b ) {
2767
+	private function _sort_nav_tabs($a, $b) {
2768 2768
 		if ($a['order'] == $b['order']) {
2769 2769
 	        return 0;
2770 2770
 	    }
@@ -2784,7 +2784,7 @@  discard block
 block discarded – undo
2784 2784
 	 * 	@uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
2785 2785
 	 * 	@uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
2786 2786
 	 */
2787
-	protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) {
2787
+	protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) {
2788 2788
 		$content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars);
2789 2789
 		return $content;
2790 2790
 	}
@@ -2806,25 +2806,25 @@  discard block
 block discarded – undo
2806 2806
 	 * @param array $actions if included allows us to set the actions that each button will carry out (i.e. via the "name" value in the button).  We can also use this to just dump default actions by submitting some other value.
2807 2807
 	 * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it will use the $referrer string. IF null, then we don't do ANYTHING on save and close (normal form handling).
2808 2808
 	 */
2809
-	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) {
2809
+	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) {
2810 2810
 		//make sure $text and $actions are in an array
2811 2811
 		$text = (array) $text;
2812 2812
 		$actions = (array) $actions;
2813 2813
 		$referrer_url = empty($referrer) ? '' : $referrer;
2814
-		$referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $_SERVER['REQUEST_URI'] .'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $referrer .'" />';
2814
+		$referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />';
2815 2815
 
2816
-		$button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') );
2817
-		$default_names = array( 'save', 'save_and_close' );
2816
+		$button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso'));
2817
+		$default_names = array('save', 'save_and_close');
2818 2818
 
2819 2819
 		//add in a hidden index for the current page (so save and close redirects properly)
2820 2820
 		$this->_template_args['save_buttons'] = $referrer_url;
2821 2821
 
2822
-		foreach ( $button_text as $key => $button ) {
2822
+		foreach ($button_text as $key => $button) {
2823 2823
 			$ref = $default_names[$key];
2824
-			$id = $this->_current_view . '_' . $ref;
2825
-			$name = !empty($actions) ? $actions[$key] : $ref;
2826
-			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2827
-			if ( !$both ) break;
2824
+			$id = $this->_current_view.'_'.$ref;
2825
+			$name = ! empty($actions) ? $actions[$key] : $ref;
2826
+			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />';
2827
+			if ( ! $both) break;
2828 2828
 		}
2829 2829
 
2830 2830
 	}
@@ -2839,8 +2839,8 @@  discard block
 block discarded – undo
2839 2839
 	 * @param string $route
2840 2840
 	 * @param array  $additional_hidden_fields
2841 2841
 	 */
2842
-	public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2843
-		$this->_set_add_edit_form_tags( $route, $additional_hidden_fields );
2842
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2843
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
2844 2844
 	}
2845 2845
 
2846 2846
 
@@ -2853,30 +2853,30 @@  discard block
 block discarded – undo
2853 2853
 	 * @param array $additional_hidden_fields any additional hidden fields required in the form header
2854 2854
 	 * @return void
2855 2855
 	 */
2856
-	protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2856
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2857 2857
 
2858
-		if ( empty( $route )) {
2858
+		if (empty($route)) {
2859 2859
 			$user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso');
2860
-			$dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ );
2861
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
2860
+			$dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__);
2861
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
2862 2862
 		}
2863 2863
 		// open form
2864
-		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >';
2864
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >';
2865 2865
 		// add nonce
2866
-		$nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE );
2866
+		$nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE);
2867 2867
 //		$nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE );
2868
-		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
2868
+		$this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
2869 2869
 		// add REQUIRED form action
2870 2870
 		$hidden_fields = array(
2871
-				'action' => array( 'type' => 'hidden', 'value' => $route ),
2871
+				'action' => array('type' => 'hidden', 'value' => $route),
2872 2872
 			);
2873 2873
 		// merge arrays
2874
-		$hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields;
2874
+		$hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields;
2875 2875
 		// generate form fields
2876
-		$form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' );
2876
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
2877 2877
 		// add fields to form
2878
-		foreach ( (array)$form_fields as $field_name => $form_field ) {
2879
-			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
2878
+		foreach ((array) $form_fields as $field_name => $form_field) {
2879
+			$this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
2880 2880
 		}
2881 2881
 
2882 2882
 		// close form
@@ -2893,8 +2893,8 @@  discard block
 block discarded – undo
2893 2893
 	 * @see EE_Admin_Page::_redirect_after_action() for params.
2894 2894
 	 * @since 4.5.0
2895 2895
 	 */
2896
-	public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2897
-		$this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite );
2896
+	public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2897
+		$this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite);
2898 2898
 	}
2899 2899
 
2900 2900
 
@@ -2910,38 +2910,38 @@  discard block
 block discarded – undo
2910 2910
 	 *	@access protected
2911 2911
 	 *	@return void
2912 2912
 	 */
2913
-	protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2913
+	protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2914 2914
 
2915
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2915
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2916 2916
 
2917 2917
 		//class name for actions/filters.
2918 2918
 		$classname = get_class($this);
2919 2919
 
2920 2920
 		//set redirect url. Note if there is a "page" index in the $query_args then we go with vanilla admin.php route, otherwise we go with whatever is set as the _admin_base_url
2921
-		$redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url;
2922
-		$notices = EE_Error::get_notices( FALSE );
2921
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
2922
+		$notices = EE_Error::get_notices(FALSE);
2923 2923
 
2924 2924
 		// overwrite default success messages //BUT ONLY if overwrite not overridden
2925
-		if ( ! $override_overwrite || ! empty( $notices['errors'] )) {
2925
+		if ( ! $override_overwrite || ! empty($notices['errors'])) {
2926 2926
 			EE_Error::overwrite_success();
2927 2927
 		}
2928
-		if ( ! empty( $what ) && ! empty( $action_desc ) ) {
2928
+		if ( ! empty($what) && ! empty($action_desc)) {
2929 2929
 			// how many records affected ? more than one record ? or just one ?
2930
-			if ( $success > 1 && empty( $notices[ 'errors' ] ) ) {
2930
+			if ($success > 1 && empty($notices['errors'])) {
2931 2931
 				// set plural msg
2932 2932
 				EE_Error::add_success(
2933 2933
 					sprintf(
2934
-						__( 'The "%s" have been successfully %s.', 'event_espresso' ),
2934
+						__('The "%s" have been successfully %s.', 'event_espresso'),
2935 2935
 						$what,
2936 2936
 						$action_desc
2937 2937
 					),
2938 2938
 					__FILE__, __FUNCTION__, __LINE__
2939 2939
 				);
2940
-			} else if ( $success == 1 && empty( $notices[ 'errors' ] ) ) {
2940
+			} else if ($success == 1 && empty($notices['errors'])) {
2941 2941
 				// set singular msg
2942 2942
 				EE_Error::add_success(
2943 2943
 					sprintf(
2944
-						__( 'The "%s" has been successfully %s.', 'event_espresso' ),
2944
+						__('The "%s" has been successfully %s.', 'event_espresso'),
2945 2945
 						$what,
2946 2946
 						$action_desc
2947 2947
 					),
@@ -2950,7 +2950,7 @@  discard block
 block discarded – undo
2950 2950
 			}
2951 2951
 		}
2952 2952
 		// check that $query_args isn't something crazy
2953
-		if ( ! is_array( $query_args )) {
2953
+		if ( ! is_array($query_args)) {
2954 2954
 			$query_args = array();
2955 2955
 		}
2956 2956
 
@@ -2963,36 +2963,36 @@  discard block
 block discarded – undo
2963 2963
 		 * @param array $query_args   The original query_args array coming into the
2964 2964
 		 *                          		method.
2965 2965
 		 */
2966
-		do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args );
2966
+		do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args);
2967 2967
 
2968 2968
 		//calculate where we're going (if we have a "save and close" button pushed)
2969
-		if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) {
2969
+		if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) {
2970 2970
 			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
2971
-			$parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] );
2971
+			$parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
2972 2972
 			// regenerate query args array from referrer URL
2973
-			parse_str( $parsed_url['query'], $query_args );
2973
+			parse_str($parsed_url['query'], $query_args);
2974 2974
 			// correct page and action will be in the query args now
2975
-			$redirect_url = admin_url( 'admin.php' );
2975
+			$redirect_url = admin_url('admin.php');
2976 2976
 		}
2977 2977
 
2978 2978
 		//merge any default query_args set in _default_route_query_args property
2979
-		if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) {
2979
+		if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
2980 2980
 			$args_to_merge = array();
2981
-			foreach ( $this->_default_route_query_args as $query_param => $query_value ) {
2981
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
2982 2982
 				//is there a wp_referer array in our _default_route_query_args property?
2983
-				if ( $query_param == 'wp_referer'  ) {
2983
+				if ($query_param == 'wp_referer') {
2984 2984
 					$query_value = (array) $query_value;
2985
-					foreach ( $query_value as $reference => $value ) {
2986
-						if ( strpos( $reference, 'nonce' ) !== false ) {
2985
+					foreach ($query_value as $reference => $value) {
2986
+						if (strpos($reference, 'nonce') !== false) {
2987 2987
 							continue;
2988 2988
 						}
2989 2989
 
2990 2990
 						//finally we will override any arguments in the referer with
2991 2991
 						//what might be set on the _default_route_query_args array.
2992
-						if ( isset( $this->_default_route_query_args[$reference] ) ) {
2993
-							$args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] );
2992
+						if (isset($this->_default_route_query_args[$reference])) {
2993
+							$args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
2994 2994
 						} else {
2995
-							$args_to_merge[$reference] = urlencode( $value );
2995
+							$args_to_merge[$reference] = urlencode($value);
2996 2996
 						}
2997 2997
 					}
2998 2998
 					continue;
@@ -3003,7 +3003,7 @@  discard block
 block discarded – undo
3003 3003
 
3004 3004
 			//now let's merge these arguments but override with what was specifically sent in to the
3005 3005
 			//redirect.
3006
-			$query_args = array_merge( $args_to_merge, $query_args );
3006
+			$query_args = array_merge($args_to_merge, $query_args);
3007 3007
 		}
3008 3008
 
3009 3009
 		$this->_process_notices($query_args);
@@ -3012,19 +3012,19 @@  discard block
 block discarded – undo
3012 3012
 		// generate redirect url
3013 3013
 
3014 3014
 		// if redirecting to anything other than the main page, add a nonce
3015
-		if ( isset( $query_args['action'] )) {
3015
+		if (isset($query_args['action'])) {
3016 3016
 			// manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars
3017
-			$query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
3017
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
3018 3018
 		}
3019 3019
 
3020 3020
 		//we're adding some hooks and filters in here for processing any things just before redirects (example: an admin page has done an insert or update and we want to run something after that).
3021
-		do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args );
3021
+		do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
3022 3022
 
3023
-		$redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args );
3023
+		$redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args);
3024 3024
 
3025 3025
 
3026 3026
 		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3027
-		if ( defined('DOING_AJAX' ) ) {
3027
+		if (defined('DOING_AJAX')) {
3028 3028
 			$default_data = array(
3029 3029
 				'close' => TRUE,
3030 3030
 				'redirect_url' => $redirect_url,
@@ -3033,11 +3033,11 @@  discard block
 block discarded – undo
3033 3033
 				);
3034 3034
 
3035 3035
 			$this->_template_args['success'] = $success;
3036
-			$this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data;
3036
+			$this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data;
3037 3037
 			$this->_return_json();
3038 3038
 		}
3039 3039
 
3040
-		wp_safe_redirect( $redirect_url );
3040
+		wp_safe_redirect($redirect_url);
3041 3041
 		exit();
3042 3042
 	}
3043 3043
 
@@ -3053,30 +3053,30 @@  discard block
 block discarded – undo
3053 3053
 	 * @param bool    $sticky_notices      This is used to flag that regardless of whether this is doing_ajax or not, we still save a transient for the notice.
3054 3054
 	 * @return void
3055 3055
 	 */
3056
-	protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) {
3056
+	protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) {
3057 3057
 
3058 3058
 		//first let's set individual error properties if doing_ajax and the properties aren't already set.
3059
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
3060
-			$notices = EE_Error::get_notices( false );
3061
-			if ( empty( $this->_template_args['success'] ) ) {
3062
-				$this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false;
3059
+		if (defined('DOING_AJAX') && DOING_AJAX) {
3060
+			$notices = EE_Error::get_notices(false);
3061
+			if (empty($this->_template_args['success'])) {
3062
+				$this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
3063 3063
 			}
3064 3064
 
3065
-			if ( empty( $this->_template_args['errors'] ) ) {
3066
-				$this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false;
3065
+			if (empty($this->_template_args['errors'])) {
3066
+				$this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
3067 3067
 			}
3068 3068
 
3069
-			if ( empty( $this->_template_args['attention'] ) ) {
3070
-				$this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false;
3069
+			if (empty($this->_template_args['attention'])) {
3070
+				$this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
3071 3071
 			}
3072 3072
 		}
3073 3073
 
3074 3074
 		$this->_template_args['notices'] = EE_Error::get_notices();
3075 3075
 
3076 3076
 		//IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3077
-		if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) {
3078
-			$route = isset( $query_args['action'] ) ? $query_args['action'] : 'default';
3079
-			$this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify );
3077
+		if ( ! defined('DOING_AJAX') || $sticky_notices) {
3078
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
3079
+			$this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify);
3080 3080
 		}
3081 3081
 	}
3082 3082
 
@@ -3106,7 +3106,7 @@  discard block
 block discarded – undo
3106 3106
 		$exclude_nonce = false
3107 3107
 	) {
3108 3108
 		//first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3109
-		if ( empty( $base_url ) && ! isset( $this->_page_routes[ $action ] ) ) {
3109
+		if (empty($base_url) && ! isset($this->_page_routes[$action])) {
3110 3110
 			throw new EE_Error(
3111 3111
 				sprintf(
3112 3112
 					__(
@@ -3117,7 +3117,7 @@  discard block
 block discarded – undo
3117 3117
 				)
3118 3118
 			);
3119 3119
 		}
3120
-		if ( ! isset( $this->_labels['buttons'][ $type ] ) ) {
3120
+		if ( ! isset($this->_labels['buttons'][$type])) {
3121 3121
 			throw new EE_Error(
3122 3122
 				sprintf(
3123 3123
 					__(
@@ -3129,8 +3129,8 @@  discard block
 block discarded – undo
3129 3129
 			);
3130 3130
 		}
3131 3131
 		//finally check user access for this button.
3132
-		$has_access = $this->check_user_access( $action, true );
3133
-		if ( ! $has_access ) {
3132
+		$has_access = $this->check_user_access($action, true);
3133
+		if ( ! $has_access) {
3134 3134
 			return '';
3135 3135
 		}
3136 3136
 		$_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
@@ -3138,11 +3138,11 @@  discard block
 block discarded – undo
3138 3138
 			'action' => $action
3139 3139
 		);
3140 3140
 		//merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3141
-		if ( ! empty( $extra_request ) ) {
3142
-			$query_args = array_merge( $extra_request, $query_args );
3141
+		if ( ! empty($extra_request)) {
3142
+			$query_args = array_merge($extra_request, $query_args);
3143 3143
 		}
3144
-		$url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce );
3145
-		return EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][ $type ], $class );
3144
+		$url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3145
+		return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3146 3146
 	}
3147 3147
 
3148 3148
 
@@ -3157,11 +3157,11 @@  discard block
 block discarded – undo
3157 3157
 		$args = array(
3158 3158
 			'label' => $this->_admin_page_title,
3159 3159
 			'default' => 10,
3160
-			'option' => $this->_current_page . '_' . $this->_current_view . '_per_page'
3160
+			'option' => $this->_current_page.'_'.$this->_current_view.'_per_page'
3161 3161
 			);
3162 3162
 		//ONLY add the screen option if the user has access to it.
3163
-		if ( $this->check_user_access( $this->_current_view, true ) ) {
3164
-			add_screen_option( $option, $args );
3163
+		if ($this->check_user_access($this->_current_view, true)) {
3164
+			add_screen_option($option, $args);
3165 3165
 		}
3166 3166
 	}
3167 3167
 
@@ -3177,36 +3177,36 @@  discard block
 block discarded – undo
3177 3177
 	 * @return void
3178 3178
 	 */
3179 3179
 	private function _set_per_page_screen_options() {
3180
-		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3181
-			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3180
+		if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3181
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3182 3182
 
3183
-			if ( !$user = wp_get_current_user() )
3183
+			if ( ! $user = wp_get_current_user())
3184 3184
 			return;
3185 3185
 			$option = $_POST['wp_screen_options']['option'];
3186 3186
 			$value = $_POST['wp_screen_options']['value'];
3187 3187
 
3188
-			if ( $option != sanitize_key( $option ) )
3188
+			if ($option != sanitize_key($option))
3189 3189
 				return;
3190 3190
 
3191 3191
 			$map_option = $option;
3192 3192
 
3193 3193
 			$option = str_replace('-', '_', $option);
3194 3194
 
3195
-			switch ( $map_option ) {
3196
-				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3195
+			switch ($map_option) {
3196
+				case $this->_current_page.'_'.$this->_current_view.'_per_page':
3197 3197
 					$value = (int) $value;
3198
-					if ( $value < 1 || $value > 999 )
3198
+					if ($value < 1 || $value > 999)
3199 3199
 						return;
3200 3200
 					break;
3201 3201
 				default:
3202
-					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3203
-					if ( false === $value )
3202
+					$value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value);
3203
+					if (false === $value)
3204 3204
 						return;
3205 3205
 					break;
3206 3206
 			}
3207 3207
 
3208 3208
 			update_user_meta($user->ID, $option, $value);
3209
-			wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
3209
+			wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3210 3210
 			exit;
3211 3211
 		}
3212 3212
 	}
@@ -3217,8 +3217,8 @@  discard block
 block discarded – undo
3217 3217
 	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3218 3218
 	 * @param array $data array that will be assigned to template args.
3219 3219
 	 */
3220
-	public function set_template_args( $data ) {
3221
-		$this->_template_args = array_merge( $this->_template_args, (array) $data );
3220
+	public function set_template_args($data) {
3221
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3222 3222
 	}
3223 3223
 
3224 3224
 
@@ -3234,26 +3234,26 @@  discard block
 block discarded – undo
3234 3234
 	 * @param bool $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used when we are adding a transient before page_routes have been defined.
3235 3235
 	 * @return void
3236 3236
 	 */
3237
-	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3237
+	protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) {
3238 3238
 		$user_id = get_current_user_id();
3239 3239
 
3240
-		if ( !$skip_route_verify )
3240
+		if ( ! $skip_route_verify)
3241 3241
 			$this->_verify_route($route);
3242 3242
 
3243 3243
 
3244 3244
 		//now let's set the string for what kind of transient we're setting
3245
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3246
-		$data = $notices ? array( 'notices' => $data ) : $data;
3245
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3246
+		$data = $notices ? array('notices' => $data) : $data;
3247 3247
 		//is there already a transient for this route?  If there is then let's ADD to that transient
3248
-		$existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3249
-		if ( $existing ) {
3250
-			$data = array_merge( (array) $data, (array) $existing );
3248
+		$existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3249
+		if ($existing) {
3250
+			$data = array_merge((array) $data, (array) $existing);
3251 3251
 		}
3252 3252
 
3253
-		if ( is_multisite() && is_network_admin() ) {
3254
-			set_site_transient( $transient, $data, 8 );
3253
+		if (is_multisite() && is_network_admin()) {
3254
+			set_site_transient($transient, $data, 8);
3255 3255
 		} else {
3256
-			set_transient( $transient, $data, 8 );
3256
+			set_transient($transient, $data, 8);
3257 3257
 		}
3258 3258
 	}
3259 3259
 
@@ -3265,18 +3265,18 @@  discard block
 block discarded – undo
3265 3265
 	 * @param bool $notices true we get notices transient. False we just return normal route transient
3266 3266
 	 * @return mixed data
3267 3267
 	 */
3268
-	protected function _get_transient( $notices = FALSE, $route = FALSE ) {
3268
+	protected function _get_transient($notices = FALSE, $route = FALSE) {
3269 3269
 		$user_id = get_current_user_id();
3270
-		$route = !$route ? $this->_req_action : $route;
3271
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3272
-		$data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3270
+		$route = ! $route ? $this->_req_action : $route;
3271
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3272
+		$data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3273 3273
 		//delete transient after retrieval (just in case it hasn't expired);
3274
-		if ( is_multisite() && is_network_admin() ) {
3275
-			delete_site_transient( $transient );
3274
+		if (is_multisite() && is_network_admin()) {
3275
+			delete_site_transient($transient);
3276 3276
 		} else {
3277
-			delete_transient( $transient );
3277
+			delete_transient($transient);
3278 3278
 		}
3279
-		return $notices && isset( $data['notices'] ) ? $data['notices'] : $data;
3279
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3280 3280
 	}
3281 3281
 
3282 3282
 
@@ -3293,12 +3293,12 @@  discard block
 block discarded – undo
3293 3293
 
3294 3294
 		//retrieve all existing transients
3295 3295
 		$query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3296
-		if ( $results = $wpdb->get_results( $query ) ) {
3297
-			foreach ( $results as $result ) {
3298
-				$transient = str_replace( '_transient_', '', $result->option_name );
3299
-				get_transient( $transient );
3300
-				if ( is_multisite() && is_network_admin() ) {
3301
-					get_site_transient( $transient );
3296
+		if ($results = $wpdb->get_results($query)) {
3297
+			foreach ($results as $result) {
3298
+				$transient = str_replace('_transient_', '', $result->option_name);
3299
+				get_transient($transient);
3300
+				if (is_multisite() && is_network_admin()) {
3301
+					get_site_transient($transient);
3302 3302
 				}
3303 3303
 			}
3304 3304
 		}
@@ -3448,23 +3448,23 @@  discard block
 block discarded – undo
3448 3448
 	 * @param string $line	line no where error occurred
3449 3449
 	 * @return boolean
3450 3450
 	 */
3451
-	protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) {
3451
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') {
3452 3452
 
3453 3453
 		//remove any options that are NOT going to be saved with the config settings.
3454
-		if ( isset( $config->core->ee_ueip_optin ) ) {
3454
+		if (isset($config->core->ee_ueip_optin)) {
3455 3455
 			$config->core->ee_ueip_has_notified = TRUE;
3456 3456
 			// TODO: remove the following two lines and make sure values are migrated from 3.1
3457
-			update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin);
3458
-			update_option( 'ee_ueip_has_notified', TRUE );
3457
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3458
+			update_option('ee_ueip_has_notified', TRUE);
3459 3459
 		}
3460 3460
 		// and save it (note we're also doing the network save here)
3461
-		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE;
3462
-		$config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE );
3463
-		if ( $config_saved && $net_saved ) {
3464
-			EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab ));
3461
+		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE;
3462
+		$config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE);
3463
+		if ($config_saved && $net_saved) {
3464
+			EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3465 3465
 			return TRUE;
3466 3466
 		} else {
3467
-			EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line  );
3467
+			EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3468 3468
 			return FALSE;
3469 3469
 		}
3470 3470
 	}
@@ -3477,7 +3477,7 @@  discard block
 block discarded – undo
3477 3477
 	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
3478 3478
 	 * @return array
3479 3479
 	 */
3480
-	public function get_yes_no_values(){
3480
+	public function get_yes_no_values() {
3481 3481
 		return $this->_yes_no_values;
3482 3482
 	}
3483 3483
 
@@ -3499,8 +3499,8 @@  discard block
 block discarded – undo
3499 3499
 	 *
3500 3500
 	 * @return string
3501 3501
 	 */
3502
-	protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) {
3503
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3502
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') {
3503
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3504 3504
 	}
3505 3505
 
3506 3506
 
@@ -3514,8 +3514,8 @@  discard block
 block discarded – undo
3514 3514
 	 *
3515 3515
 	 * @return string
3516 3516
 	 */
3517
-	protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) {
3518
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3517
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') {
3518
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3519 3519
 	}
3520 3520
 
3521 3521
 
@@ -3534,8 +3534,8 @@  discard block
 block discarded – undo
3534 3534
 	 * @return bool success/fail
3535 3535
 	 */
3536 3536
 	protected function _process_resend_registration() {
3537
-		$this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data );
3538
-		do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data );
3537
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
3538
+		do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data);
3539 3539
 		return $this->_template_args['success'];
3540 3540
 	}
3541 3541
 
@@ -3548,11 +3548,11 @@  discard block
 block discarded – undo
3548 3548
 	 * @param \EE_Payment $payment
3549 3549
 	 * @return bool success/fail
3550 3550
 	 */
3551
-	protected function _process_payment_notification( EE_Payment $payment ) {
3552
-		add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' );
3553
-		do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment );
3554
-		$this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment );
3555
-		return $this->_template_args[ 'success' ];
3551
+	protected function _process_payment_notification(EE_Payment $payment) {
3552
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
3553
+		do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
3554
+		$this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment);
3555
+		return $this->_template_args['success'];
3556 3556
 	}
3557 3557
 
3558 3558
 
Please login to merge, or discard this patch.
modules/ticket_selector/templates/ticket_selector_chart_iframe.template.php 1 patch
Indentation   -3 removed lines patch added patch discarded remove patch
@@ -1,16 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3 3
  * Template for the ticket selector when displayed in an iframe.
4
-
5 4
  * Following template arguments are available:
6
-
7 5
  * @type string $notices	HTML for notices and ajax gif
8 6
  * @type string $ticket_selector This is the html for the ticket selector.
9 7
  * @type string $powered_by credit link
10 8
  * @type array $css 		An array of css urls.
11 9
  * @type string $eei18n 	localized JSON vars
12 10
  * @type array $js 			An array of js urls.
13
-
14 11
  * @since 4.6.7
15 12
  * @package Event Espresso
16 13
  * @subpackage module
Please login to merge, or discard this patch.
admin_pages/transactions/Transactions_Admin_Page.core.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 
107 107
 	/**
108 108
 	 * 		grab url requests and route them
109
-	*		@access private
110
-	*		@return void
111
-	*/
109
+	 *		@access private
110
+	 *		@return void
111
+	 */
112 112
 	public function _set_page_routes() {
113 113
 
114 114
 		$this->_set_transaction_status_array();
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 	/**
264 264
 	 * _set_transaction_status_array
265 265
 	 * sets list of transaction statuses
266
-	*
266
+	 *
267 267
 	 * @access private
268
-	*	@return void
269
-	*/
268
+	 *	@return void
269
+	 */
270 270
 	private function _set_transaction_status_array() {
271 271
 		self::$_txn_status = EEM_Transaction::instance()->status_array(TRUE);
272 272
 	}
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 
289 289
 	/**
290 290
 	 * 	get list of payment statuses
291
-	*
291
+	 *
292 292
 	 * @access private
293
-	*	@return void
294
-	*/
293
+	 *	@return void
294
+	 */
295 295
 	private function _get_payment_status_array() {
296 296
 		self::$_pay_status = EEM_Payment::instance()->status_array(TRUE);
297 297
 		$this->_template_args['payment_status'] = self::$_pay_status;
@@ -399,19 +399,19 @@  discard block
 block discarded – undo
399 399
 		if ( is_object( $this->_transaction) )
400 400
 			return; //get out we've already set the object
401 401
 
402
-	    $TXN = EEM_Transaction::instance();
402
+		$TXN = EEM_Transaction::instance();
403 403
 
404
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
404
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
405 405
 
406
-	    //get transaction object
407
-	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
408
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
406
+		//get transaction object
407
+		$this->_transaction = $TXN->get_one_by_ID($TXN_ID);
408
+		$this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
409 409
 		$this->_transaction->verify_abandoned_transaction_status();
410 410
 
411 411
 	 	if ( empty( $this->_transaction ) ) {
412
-	    	$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  esc_html__(' could not be retrieved.', 'event_espresso');
412
+			$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  esc_html__(' could not be retrieved.', 'event_espresso');
413 413
 			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
414
-	    }
414
+		}
415 415
 	}
416 416
 
417 417
 
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
 
527 527
 
528 528
 	/**
529
-	* 	_transaction_details
529
+	 * 	_transaction_details
530 530
 	 * generates HTML for the View Transaction Details Admin page
531
-	*
531
+	 *
532 532
 	 * @access protected
533
-	*	@return void
534
-	*/
533
+	 *	@return void
534
+	 */
535 535
 	protected function _transaction_details() {
536 536
 		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
537 537
 
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 						'button secondary-button right',
583 583
 						'dashicons dashicons-email-alt'
584 584
 					)
585
-				    : '';
585
+					: '';
586 586
 		} else {
587 587
 			$this->_template_args['send_payment_reminder_button'] = '';
588 588
 		}
@@ -736,10 +736,10 @@  discard block
 block discarded – undo
736 736
 	/**
737 737
 	 * txn_details_meta_box
738 738
 	 * generates HTML for the Transaction main meta box
739
-	*
739
+	 *
740 740
 	 * @access public
741
-	*	@return void
742
-	*/
741
+	 *	@return void
742
+	 */
743 743
 	public function txn_details_meta_box() {
744 744
 
745 745
 		$this->_set_transaction_object();
@@ -1115,10 +1115,10 @@  discard block
 block discarded – undo
1115 1115
 	/**
1116 1116
 	 * txn_billing_info_side_meta_box
1117 1117
 	 * 	generates HTML for the Edit Transaction side meta box
1118
-	*
1118
+	 *
1119 1119
 	 * @access public
1120
-	*	@return void
1121
-	*/
1120
+	 *	@return void
1121
+	 */
1122 1122
 	public function txn_billing_info_side_meta_box() {
1123 1123
 
1124 1124
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
@@ -1136,10 +1136,10 @@  discard block
 block discarded – undo
1136 1136
 	/**
1137 1137
 	 * apply_payments_or_refunds
1138 1138
 	 * 	registers a payment or refund made towards a transaction
1139
-	*
1139
+	 *
1140 1140
 	 * @access public
1141
-	*	@return void
1142
-	*/
1141
+	 *	@return void
1142
+	 */
1143 1143
 	public function apply_payments_or_refunds() {
1144 1144
 		$json_response_data = array( 'return_data' => FALSE );
1145 1145
 		$valid_data = $this->_validate_payment_request_data();
@@ -1293,9 +1293,9 @@  discard block
 block discarded – undo
1293 1293
 							'default' => '',
1294 1294
 							'required' => false,
1295 1295
 							'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ),
1296
-                                                        'validation_strategies' => array(
1297
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1298
-                                                        )
1296
+														'validation_strategies' => array(
1297
+															new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1298
+														)
1299 1299
 						)
1300 1300
 					),
1301 1301
 					'po_number' => new EE_Text_Input(
@@ -1303,9 +1303,9 @@  discard block
 block discarded – undo
1303 1303
 							'default' => '',
1304 1304
 							'required' => false,
1305 1305
 							'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ),
1306
-                                                        'validation_strategies' => array(
1307
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1308
-                                                        )
1306
+														'validation_strategies' => array(
1307
+															new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1308
+														)
1309 1309
 						)
1310 1310
 					),
1311 1311
 					'accounting' => new EE_Text_Input(
@@ -1313,9 +1313,9 @@  discard block
 block discarded – undo
1313 1313
 							'default' => '',
1314 1314
 							'required' => false,
1315 1315
 							'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ),
1316
-                                                        'validation_strategies' => array(
1317
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1318
-                                                        )
1316
+														'validation_strategies' => array(
1317
+															new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1318
+														)
1319 1319
 						)
1320 1320
 					),
1321 1321
 				)
@@ -1610,10 +1610,10 @@  discard block
 block discarded – undo
1610 1610
 	/**
1611 1611
 	 * delete_payment
1612 1612
 	 * 	delete a payment or refund made towards a transaction
1613
-	*
1613
+	 *
1614 1614
 	 * @access public
1615
-	*	@return void
1616
-	*/
1615
+	 *	@return void
1616
+	 */
1617 1617
 	public function delete_payment() {
1618 1618
 		$json_response_data = array( 'return_data' => FALSE );
1619 1619
 		$PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0;
@@ -1730,12 +1730,12 @@  discard block
 block discarded – undo
1730 1730
 	/**
1731 1731
 	 * _send_payment_reminder
1732 1732
 	 * 	generates HTML for the View Transaction Details Admin page
1733
-	*
1733
+	 *
1734 1734
 	 * @access protected
1735
-	*	@return void
1736
-	*/
1735
+	 *	@return void
1736
+	 */
1737 1737
 	protected function _send_payment_reminder() {
1738
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1738
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1739 1739
 		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1740 1740
 		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1741 1741
 		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
@@ -1757,29 +1757,29 @@  discard block
 block discarded – undo
1757 1757
 
1758 1758
 		$TXN = EEM_Transaction::instance();
1759 1759
 
1760
-	    $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1761
-	    $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1760
+		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1761
+		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1762 1762
 
1763
-	    //make sure our timestamps start and end right at the boundaries for each day
1764
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1765
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1763
+		//make sure our timestamps start and end right at the boundaries for each day
1764
+		$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1765
+		$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1766 1766
 
1767 1767
 
1768
-	    //convert to timestamps
1769
-	    $start_date = strtotime( $start_date );
1770
-	    $end_date = strtotime( $end_date );
1768
+		//convert to timestamps
1769
+		$start_date = strtotime( $start_date );
1770
+		$end_date = strtotime( $end_date );
1771 1771
 
1772
-	    //makes sure start date is the lowest value and vice versa
1773
-	    $start_date = min( $start_date, $end_date );
1774
-	    $end_date = max( $start_date, $end_date );
1772
+		//makes sure start date is the lowest value and vice versa
1773
+		$start_date = min( $start_date, $end_date );
1774
+		$end_date = max( $start_date, $end_date );
1775 1775
 
1776
-	    //convert to correct format for query
1776
+		//convert to correct format for query
1777 1777
 	$start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
1778 1778
 	$end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
1779 1779
 
1780 1780
 
1781 1781
 
1782
-	    //set orderby
1782
+		//set orderby
1783 1783
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1784 1784
 
1785 1785
 		switch ( $this->_req_data['orderby'] ) {
Please login to merge, or discard this patch.
Spacing   +418 added lines, -418 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Transactions_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61 61
 	}
62 62
 
63 63
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @return void
81 81
 	 */
82 82
 	protected function _ajax_hooks() {
83
-		add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds'));
84
-		add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds'));
85
-		add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment'));
83
+		add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds'));
84
+		add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds'));
85
+		add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment'));
86 86
 	}
87 87
 
88 88
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			'buttons' => array(
98 98
 				'add' => esc_html__('Add New Transaction', 'event_espresso'),
99 99
 				'edit' => esc_html__('Edit Transaction', 'event_espresso'),
100
-				'delete' => esc_html__('Delete Transaction','event_espresso'),
100
+				'delete' => esc_html__('Delete Transaction', 'event_espresso'),
101 101
 			)
102 102
 		);
103 103
 	}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$this->_set_transaction_status_array();
115 115
 
116
-		$txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0;
116
+		$txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0;
117 117
 
118 118
 		$this->_page_routes = array(
119 119
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 						'filename' => 'transactions_overview_views_filters_search'
186 186
 					),
187 187
 				),
188
-				'help_tour' => array( 'Transactions_Overview_Help_Tour' ),
188
+				'help_tour' => array('Transactions_Overview_Help_Tour'),
189 189
 				/**
190 190
 				 * commented out because currently we are not displaying tips for transaction list table status but this
191 191
 				 * may change in a later iteration so want to keep the code for then.
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 				'nav' => array(
198 198
 					'label' => esc_html__('View Transaction', 'event_espresso'),
199 199
 					'order' => 5,
200
-					'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
200
+					'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
201 201
 					'persistent' => FALSE
202 202
 					),
203 203
 				'help_tabs' => array(
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 						'filename' => 'transactions_view_transaction_primary_registrant_billing_information'
219 219
 					),
220 220
 				),
221
-				'qtips' => array( 'Transaction_Details_Tips' ),
222
-				'help_tour' => array( 'Transaction_Details_Help_Tour' ),
221
+				'qtips' => array('Transaction_Details_Tips'),
222
+				'help_tour' => array('Transaction_Details_Help_Tour'),
223 223
 				'metaboxes' => array('_transaction_details_metaboxes'),
224 224
 
225 225
 				'require_nonce' => FALSE
@@ -237,23 +237,23 @@  discard block
 block discarded – undo
237 237
 		// IF a registration was JUST added via the admin...
238 238
 		if (
239 239
 		isset(
240
-			$this->_req_data[ 'redirect_from' ],
241
-			$this->_req_data[ 'EVT_ID' ],
242
-			$this->_req_data[ 'event_name' ]
240
+			$this->_req_data['redirect_from'],
241
+			$this->_req_data['EVT_ID'],
242
+			$this->_req_data['event_name']
243 243
 		)
244 244
 		) {
245 245
 			// then set a cookie so that we can block any attempts to use
246 246
 			// the back button as a way to enter another registration.
247
-			setcookie( 'ee_registration_added', $this->_req_data[ 'EVT_ID' ], time() + WEEK_IN_SECONDS, '/' );
247
+			setcookie('ee_registration_added', $this->_req_data['EVT_ID'], time() + WEEK_IN_SECONDS, '/');
248 248
 			// and update the global
249
-			$_COOKIE[ 'ee_registration_added' ] = $this->_req_data[ 'EVT_ID' ];
249
+			$_COOKIE['ee_registration_added'] = $this->_req_data['EVT_ID'];
250 250
 		}
251
-		EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = esc_html__( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' );
252
-		EE_Registry::$i18n_js_strings[ 'error_occurred' ] = esc_html__( 'An error occurred! Please refresh the page and try again.', 'event_espresso' );
253
-		EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status;
254
-		EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status;
255
-		EE_Registry::$i18n_js_strings[ 'payments_total' ] = esc_html__( 'Payments Total', 'event_espresso' );
256
-		EE_Registry::$i18n_js_strings[ 'transaction_overpaid' ] = esc_html__( 'This transaction has been overpaid ! Payments Total', 'event_espresso' );
251
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = esc_html__('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso');
252
+		EE_Registry::$i18n_js_strings['error_occurred'] = esc_html__('An error occurred! Please refresh the page and try again.', 'event_espresso');
253
+		EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status;
254
+		EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status;
255
+		EE_Registry::$i18n_js_strings['payments_total'] = esc_html__('Payments Total', 'event_espresso');
256
+		EE_Registry::$i18n_js_strings['transaction_overpaid'] = esc_html__('This transaction has been overpaid ! Payments Total', 'event_espresso');
257 257
 	}
258 258
 	public function admin_notices() {}
259 259
 	public function admin_footer_scripts() {}
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	public function load_scripts_styles() {
322 322
 		//enqueue style
323
-		wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION );
323
+		wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION);
324 324
 		wp_enqueue_style('espresso_txn');
325 325
 
326 326
 		//scripts
327 327
 		add_filter('FHEE_load_accounting_js', '__return_true');
328 328
 
329 329
 		//scripts
330
-		wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
330
+		wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
331 331
 		wp_enqueue_script('espresso_txn');
332 332
 
333 333
 	}
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	 *	@return void
368 368
 	 */
369 369
 	protected function _set_list_table_views_default() {
370
-		$this->_views = array (
371
-			'all' => array (
370
+		$this->_views = array(
371
+			'all' => array(
372 372
 				'slug' 		=> 'all',
373 373
 				'label' 		=> esc_html__('View All Transactions', 'event_espresso'),
374 374
 				'count' 	=> 0
@@ -396,21 +396,21 @@  discard block
 block discarded – undo
396 396
 	 *	@return void
397 397
 	 */
398 398
 	private function _set_transaction_object() {
399
-		if ( is_object( $this->_transaction) )
399
+		if (is_object($this->_transaction))
400 400
 			return; //get out we've already set the object
401 401
 
402 402
 	    $TXN = EEM_Transaction::instance();
403 403
 
404
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
404
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
405 405
 
406 406
 	    //get transaction object
407 407
 	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
408
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
408
+	    $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL;
409 409
 		$this->_transaction->verify_abandoned_transaction_status();
410 410
 
411
-	 	if ( empty( $this->_transaction ) ) {
412
-	    	$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  esc_html__(' could not be retrieved.', 'event_espresso');
413
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
411
+	 	if (empty($this->_transaction)) {
412
+	    	$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.esc_html__(' could not be retrieved.', 'event_espresso');
413
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
414 414
 	    }
415 415
 	}
416 416
 
@@ -423,12 +423,12 @@  discard block
 block discarded – undo
423 423
 	 *	@return array
424 424
 	 */
425 425
 	protected function _transaction_legend_items() {
426
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
426
+		EE_Registry::instance()->load_helper('MSG_Template');
427 427
 		$items = array();
428 428
 
429
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
430
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
431
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
429
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
430
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
431
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
432 432
 				$items['view_related_messages'] = array(
433 433
 					'class' => $related_for_icon['css_class'],
434 434
 					'desc' => $related_for_icon['label'],
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
 		$items = apply_filters(
440 440
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__items',
441
-			array_merge( $items,
441
+			array_merge($items,
442 442
 				array(
443 443
 					'view_details' => array(
444 444
 						'class' => 'dashicons dashicons-cart',
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 					),
451 451
 					'view_receipt' => array(
452 452
 						'class' => 'dashicons dashicons-media-default',
453
-						'desc' => esc_html__('View Transaction Receipt', 'event_espresso' )
453
+						'desc' => esc_html__('View Transaction Receipt', 'event_espresso')
454 454
 					),
455 455
 					'view_registration' => array(
456 456
 						'class' => 'dashicons dashicons-clipboard',
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 			)
461 461
 		);
462 462
 
463
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) {
464
-			if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
463
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) {
464
+			if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
465 465
 				$items['send_payment_reminder'] = array(
466 466
 					'class' => 'dashicons dashicons-email-alt',
467 467
 					'desc' => esc_html__('Send Payment Reminder', 'event_espresso')
@@ -482,29 +482,29 @@  discard block
 block discarded – undo
482 482
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items',
483 483
 			array(
484 484
 				'overpaid'   => array(
485
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code,
486
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' )
485
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code,
486
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence')
487 487
 				),
488 488
 				'complete'   => array(
489
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code,
490
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' )
489
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code,
490
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence')
491 491
 				),
492 492
 				'incomplete' => array(
493
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code,
494
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' )
493
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code,
494
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence')
495 495
 				),
496 496
 				'abandoned'  => array(
497
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code,
498
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' )
497
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code,
498
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence')
499 499
 				),
500 500
 				'failed'     => array(
501
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code,
502
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' )
501
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code,
502
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence')
503 503
 				)
504 504
 			)
505 505
 		);
506 506
 
507
-		return array_merge( $items, $more_items);
507
+		return array_merge($items, $more_items);
508 508
 	}
509 509
 
510 510
 
@@ -517,9 +517,9 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	protected function _transactions_overview_list_table() {
519 519
 		$this->_admin_page_title = esc_html__('Transactions', 'event_espresso');
520
-		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL;
521
-		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : '';
522
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() );
520
+		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL;
521
+		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : '';
522
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items());
523 523
 		$this->display_admin_list_table_page_with_no_sidebar();
524 524
 	}
525 525
 
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 	*	@return void
534 534
 	*/
535 535
 	protected function _transaction_details() {
536
-		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
536
+		do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction);
537 537
 
538 538
 		$this->_set_transaction_status_array();
539 539
 
@@ -546,14 +546,14 @@  discard block
 block discarded – undo
546 546
 		$attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL;
547 547
 
548 548
 		$this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID();
549
-		$this->_template_args['txn_nmbr']['label'] = esc_html__( 'Transaction Number', 'event_espresso' );
549
+		$this->_template_args['txn_nmbr']['label'] = esc_html__('Transaction Number', 'event_espresso');
550 550
 
551 551
 		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp');
552
-		$this->_template_args['txn_datetime']['label'] = esc_html__( 'Date', 'event_espresso' );
552
+		$this->_template_args['txn_datetime']['label'] = esc_html__('Date', 'event_espresso');
553 553
 
554
-		$this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ];
555
-		$this->_template_args['txn_status']['label'] = esc_html__( 'Transaction Status', 'event_espresso' );
556
-		$this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID');
554
+		$this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')];
555
+		$this->_template_args['txn_status']['label'] = esc_html__('Transaction Status', 'event_espresso');
556
+		$this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID');
557 557
 
558 558
 		$this->_template_args['grand_total'] = $this->_transaction->get('TXN_total');
559 559
 		$this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid');
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 			)
567 567
 		) {
568 568
 			$this->_template_args['send_payment_reminder_button'] =
569
-				EEH_MSG_Template::is_mt_active( 'payment_reminder' )
569
+				EEH_MSG_Template::is_mt_active('payment_reminder')
570 570
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code
571 571
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code
572 572
 					? EEH_Template::get_button_or_link(
@@ -588,40 +588,40 @@  discard block
 block discarded – undo
588 588
 		}
589 589
 
590 590
 		$amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid');
591
-		$this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE );
592
-		if ( EE_Registry::instance()->CFG->currency->sign_b4 ) {
593
-			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due'];
591
+		$this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE);
592
+		if (EE_Registry::instance()->CFG->currency->sign_b4) {
593
+			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due'];
594 594
 		} else {
595
-			$this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign;
595
+			$this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign;
596 596
 		}
597
-		$this->_template_args['amount_due_class'] =  '';
597
+		$this->_template_args['amount_due_class'] = '';
598 598
 
599
-		if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) {
599
+		if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) {
600 600
 			// paid in full
601
-			$this->_template_args['amount_due'] =  FALSE;
602
-		} elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) {
601
+			$this->_template_args['amount_due'] = FALSE;
602
+		} elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) {
603 603
 			// overpaid
604
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
605
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) {
604
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
605
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) {
606 606
 			// monies owing
607
-			$this->_template_args['amount_due_class'] =  'txn-overview-part-payment-spn';
608
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) {
607
+			$this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn';
608
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) {
609 609
 			// no payments made yet
610
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
611
-		} elseif ( $this->_transaction->get('TXN_total') == 0 ) {
610
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
611
+		} elseif ($this->_transaction->get('TXN_total') == 0) {
612 612
 			// free event
613
-			$this->_template_args['amount_due'] =  FALSE;
613
+			$this->_template_args['amount_due'] = FALSE;
614 614
 		}
615 615
 
616 616
 		$payment_method = $this->_transaction->payment_method();
617 617
 
618 618
 		$this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method
619 619
 			? $payment_method->admin_name()
620
-			: esc_html__( 'Unknown', 'event_espresso' );
620
+			: esc_html__('Unknown', 'event_espresso');
621 621
 
622 622
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
623 623
 		// link back to overview
624
-		$this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] )
624
+		$this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER'])
625 625
 			? $_SERVER['HTTP_REFERER']
626 626
 			: TXN_ADMIN_URL;
627 627
 
@@ -629,13 +629,13 @@  discard block
 block discarded – undo
629 629
 		// next link
630 630
 		$next_txn = $this->_transaction->next(
631 631
 			null,
632
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
632
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
633 633
 			'TXN_ID'
634 634
 		);
635 635
 		$this->_template_args['next_transaction'] = $next_txn
636 636
 			? $this->_next_link(
637 637
 				EE_Admin_Page::add_query_args_and_nonce(
638
-					array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ),
638
+					array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']),
639 639
 					TXN_ADMIN_URL
640 640
 				),
641 641
 				'dashicons dashicons-arrow-right ee-icon-size-22'
@@ -644,13 +644,13 @@  discard block
 block discarded – undo
644 644
 		// previous link
645 645
 		$previous_txn = $this->_transaction->previous(
646 646
 			null,
647
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
647
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
648 648
 			'TXN_ID'
649 649
 		);
650 650
 		$this->_template_args['previous_transaction'] = $previous_txn
651 651
 			? $this->_previous_link(
652 652
 				EE_Admin_Page::add_query_args_and_nonce(
653
-					array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ),
653
+					array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']),
654 654
 					TXN_ADMIN_URL
655 655
 				),
656 656
 				'dashicons dashicons-arrow-left ee-icon-size-22'
@@ -660,16 +660,16 @@  discard block
 block discarded – undo
660 660
 		// were we just redirected here after adding a new registration ???
661 661
 		if (
662 662
 			isset(
663
-				$this->_req_data[ 'redirect_from' ],
664
-				$this->_req_data[ 'EVT_ID' ],
665
-				$this->_req_data[ 'event_name' ]
663
+				$this->_req_data['redirect_from'],
664
+				$this->_req_data['EVT_ID'],
665
+				$this->_req_data['event_name']
666 666
 			)
667 667
 		) {
668 668
 			if (
669 669
 				EE_Registry::instance()->CAP->current_user_can(
670 670
 					'ee_edit_registrations',
671 671
 					'espresso_registrations_new_registration',
672
-					$this->_req_data[ 'EVT_ID' ]
672
+					$this->_req_data['EVT_ID']
673 673
 				)
674 674
 			) {
675 675
 				$this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="';
@@ -679,25 +679,25 @@  discard block
 block discarded – undo
679 679
 						'action'   => 'new_registration',
680 680
 						'return'   => 'default',
681 681
 						'TXN_ID'   => $this->_transaction->ID(),
682
-						'event_id' => $this->_req_data[ 'EVT_ID' ],
682
+						'event_id' => $this->_req_data['EVT_ID'],
683 683
 					),
684 684
 					REG_ADMIN_URL
685 685
 				);
686 686
 				$this->_admin_page_title .= '">';
687 687
 
688 688
 				$this->_admin_page_title .= sprintf(
689
-					esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso' ),
690
-					htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' )
689
+					esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso'),
690
+					htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8')
691 691
 				);
692 692
 				$this->_admin_page_title .= '</a>';
693 693
 			}
694
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
694
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
695 695
 		}
696 696
 		// grab messages at the last second
697 697
 		$this->_template_args['notices'] = EE_Error::get_notices();
698 698
 		// path to template
699
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php';
700
-		$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
699
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php';
700
+		$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
701 701
 
702 702
 		// the details template wrapper
703 703
 		$this->display_admin_page_with_sidebar();
@@ -716,18 +716,18 @@  discard block
 block discarded – undo
716 716
 
717 717
 		$this->_set_transaction_object();
718 718
 
719
-		add_meta_box( 'edit-txn-details-mbox', esc_html__( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' );
719
+		add_meta_box('edit-txn-details-mbox', esc_html__('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high');
720 720
 		add_meta_box(
721 721
 			'edit-txn-attendees-mbox',
722
-			esc_html__( 'Attendees Registered in this Transaction', 'event_espresso' ),
723
-			array( $this, 'txn_attendees_meta_box' ),
722
+			esc_html__('Attendees Registered in this Transaction', 'event_espresso'),
723
+			array($this, 'txn_attendees_meta_box'),
724 724
 			$this->_wp_page_slug,
725 725
 			'normal',
726 726
 			'high',
727
-			array( 'TXN_ID' => $this->_transaction->ID() )
727
+			array('TXN_ID' => $this->_transaction->ID())
728 728
 		);
729
-		add_meta_box( 'edit-txn-registrant-mbox', esc_html__( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
730
-		add_meta_box( 'edit-txn-billing-info-mbox', esc_html__( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
729
+		add_meta_box('edit-txn-registrant-mbox', esc_html__('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
730
+		add_meta_box('edit-txn-billing-info-mbox', esc_html__('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
731 731
 
732 732
 	}
733 733
 
@@ -748,15 +748,15 @@  discard block
 block discarded – undo
748 748
 
749 749
 		//get line table
750 750
 		EEH_Autoloader::register_line_item_display_autoloaders();
751
-		$Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' );
752
-		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() );
751
+		$Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy');
752
+		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item());
753 753
 		$this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code');
754 754
 
755 755
 		// process taxes
756
-		$taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax )));
757
-		$this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE;
756
+		$taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax)));
757
+		$this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE;
758 758
 
759
-		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE );
759
+		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE);
760 760
 		$this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total');
761 761
 		$this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID');
762 762
 
@@ -764,63 +764,63 @@  discard block
 block discarded – undo
764 764
 
765 765
 		// process payment details
766 766
 		$payments = $this->_transaction->get_many_related('Payment');
767
-		if( ! empty(  $payments ) ) {
768
-			$this->_template_args[ 'payments' ] = $payments;
769
-			$this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments );
767
+		if ( ! empty($payments)) {
768
+			$this->_template_args['payments'] = $payments;
769
+			$this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments);
770 770
 		} else {
771
-			$this->_template_args[ 'payments' ] = false;
772
-			$this->_template_args[ 'existing_reg_payments' ] = array();
771
+			$this->_template_args['payments'] = false;
772
+			$this->_template_args['existing_reg_payments'] = array();
773 773
 		}
774 774
 
775
-		$this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment'  ), TXN_ADMIN_URL );
776
-		$this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL );
775
+		$this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL);
776
+		$this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL);
777 777
 
778
-		if ( isset( $txn_details['invoice_number'] )) {
778
+		if (isset($txn_details['invoice_number'])) {
779 779
 			$this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code'];
780
-			$this->_template_args['txn_details']['invoice_number']['label'] = esc_html__( 'Invoice Number', 'event_espresso' );
780
+			$this->_template_args['txn_details']['invoice_number']['label'] = esc_html__('Invoice Number', 'event_espresso');
781 781
 		}
782 782
 
783 783
 		$this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session');
784
-		$this->_template_args['txn_details']['registration_session']['label'] = esc_html__( 'Registration Session', 'event_espresso' );
784
+		$this->_template_args['txn_details']['registration_session']['label'] = esc_html__('Registration Session', 'event_espresso');
785 785
 
786
-		$this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '';
787
-		$this->_template_args['txn_details']['ip_address']['label'] = esc_html__( 'Transaction placed from IP', 'event_espresso' );
786
+		$this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '';
787
+		$this->_template_args['txn_details']['ip_address']['label'] = esc_html__('Transaction placed from IP', 'event_espresso');
788 788
 
789
-		$this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '';
790
-		$this->_template_args['txn_details']['user_agent']['label'] = esc_html__( 'Registrant User Agent', 'event_espresso' );
789
+		$this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '';
790
+		$this->_template_args['txn_details']['user_agent']['label'] = esc_html__('Registrant User Agent', 'event_espresso');
791 791
 
792 792
 		$reg_steps = '<ul>';
793
-		foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) {
794
-			if ( $reg_step_status === true ) {
795
-				$reg_steps .= '<li style="color:#70cc50">' . sprintf( esc_html__( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
796
-			} else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) {
797
-					$reg_steps .= '<li style="color:#2EA2CC">' . sprintf(
798
-							esc_html__( '%1$s : Initiated %2$s', 'event_espresso' ),
799
-							ucwords( str_replace( '_', ' ', $reg_step ) ),
800
-							gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) )
801
-						) . '</li>';
793
+		foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) {
794
+			if ($reg_step_status === true) {
795
+				$reg_steps .= '<li style="color:#70cc50">'.sprintf(esc_html__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
796
+			} else if (is_numeric($reg_step_status) && $reg_step_status !== false) {
797
+					$reg_steps .= '<li style="color:#2EA2CC">'.sprintf(
798
+							esc_html__('%1$s : Initiated %2$s', 'event_espresso'),
799
+							ucwords(str_replace('_', ' ', $reg_step)),
800
+							gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS)))
801
+						).'</li>';
802 802
 				} else {
803
-				$reg_steps .= '<li style="color:#E76700">' . sprintf( esc_html__( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
803
+				$reg_steps .= '<li style="color:#E76700">'.sprintf(esc_html__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
804 804
 			}
805 805
 		}
806 806
 		$reg_steps .= '</ul>';
807 807
 		$this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps;
808
-		$this->_template_args['txn_details']['reg_steps']['label'] = esc_html__( 'Registration Step Progress', 'event_espresso' );
808
+		$this->_template_args['txn_details']['reg_steps']['label'] = esc_html__('Registration Step Progress', 'event_espresso');
809 809
 
810 810
 
811 811
 		$this->_get_registrations_to_apply_payment_to();
812
-		$this->_get_payment_methods( $payments );
812
+		$this->_get_payment_methods($payments);
813 813
 		$this->_get_payment_status_array();
814 814
 		$this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction.
815 815
 
816
-		$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction'  ), TXN_ADMIN_URL );
817
-		$this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL );
818
-		$this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL );
816
+		$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL);
817
+		$this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL);
818
+		$this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL);
819 819
 
820 820
 		// 'espresso_delete_payment_nonce'
821 821
 
822
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php';
823
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
822
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php';
823
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
824 824
 
825 825
 	}
826 826
 
@@ -835,27 +835,27 @@  discard block
 block discarded – undo
835 835
 	 * @param EE_Payment[] $payments
836 836
 	 * @return array
837 837
 	 */
838
-	protected function _get_registration_payment_IDs( $payments = array() ) {
838
+	protected function _get_registration_payment_IDs($payments = array()) {
839 839
 		$existing_reg_payments = array();
840 840
 		// get all reg payments for these payments
841
-		$reg_payments = EEM_Registration_Payment::instance()->get_all( array(
841
+		$reg_payments = EEM_Registration_Payment::instance()->get_all(array(
842 842
 			array(
843 843
 				'PAY_ID' => array(
844 844
 					'IN',
845
-					array_keys( $payments )
845
+					array_keys($payments)
846 846
 				)
847 847
 			)
848
-		) );
849
-		if ( ! empty( $reg_payments ) ) {
850
-			foreach ( $payments as $payment ) {
851
-				if ( ! $payment instanceof EE_Payment ) {
848
+		));
849
+		if ( ! empty($reg_payments)) {
850
+			foreach ($payments as $payment) {
851
+				if ( ! $payment instanceof EE_Payment) {
852 852
 					continue;
853
-				} else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) {
854
-					$existing_reg_payments[ $payment->ID() ] = array();
853
+				} else if ( ! isset($existing_reg_payments[$payment->ID()])) {
854
+					$existing_reg_payments[$payment->ID()] = array();
855 855
 				}
856
-				foreach ( $reg_payments as $reg_payment ) {
857
-					if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) {
858
-						$existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID();
856
+				foreach ($reg_payments as $reg_payment) {
857
+					if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) {
858
+						$existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID();
859 859
 					}
860 860
 				}
861 861
 			}
@@ -888,54 +888,54 @@  discard block
 block discarded – undo
888 888
 				)
889 889
 			)
890 890
 		);
891
-		$registrations_to_apply_payment_to = EEH_HTML::br() . EEH_HTML::div(
891
+		$registrations_to_apply_payment_to = EEH_HTML::br().EEH_HTML::div(
892 892
 			'', 'txn-admin-apply-payment-to-registrations-dv', '', 'clear: both; margin: 1.5em 0 0; display: none;'
893 893
 		);
894
-		$registrations_to_apply_payment_to .= EEH_HTML::br() . EEH_HTML::div( '', '', 'admin-primary-mbox-tbl-wrap' );
895
-		$registrations_to_apply_payment_to .= EEH_HTML::table( '', '', 'admin-primary-mbox-tbl' );
894
+		$registrations_to_apply_payment_to .= EEH_HTML::br().EEH_HTML::div('', '', 'admin-primary-mbox-tbl-wrap');
895
+		$registrations_to_apply_payment_to .= EEH_HTML::table('', '', 'admin-primary-mbox-tbl');
896 896
 		$registrations_to_apply_payment_to .= EEH_HTML::thead(
897 897
 			EEH_HTML::tr(
898
-				EEH_HTML::th( esc_html__( 'ID', 'event_espresso' ) ) .
899
-				EEH_HTML::th( esc_html__( 'Registrant', 'event_espresso' ) ) .
900
-				EEH_HTML::th( esc_html__( 'Ticket', 'event_espresso' ) ) .
901
-				EEH_HTML::th( esc_html__( 'Event', 'event_espresso' ) ) .
902
-				EEH_HTML::th( esc_html__( 'Paid', 'event_espresso' ), '', 'txn-admin-payment-paid-td jst-cntr' ) .
903
-				EEH_HTML::th( esc_html__( 'Owing', 'event_espresso' ), '', 'txn-admin-payment-owing-td jst-cntr' ) .
904
-				EEH_HTML::th( esc_html__( 'Apply', 'event_espresso' ), '', 'jst-cntr' )
898
+				EEH_HTML::th(esc_html__('ID', 'event_espresso')).
899
+				EEH_HTML::th(esc_html__('Registrant', 'event_espresso')).
900
+				EEH_HTML::th(esc_html__('Ticket', 'event_espresso')).
901
+				EEH_HTML::th(esc_html__('Event', 'event_espresso')).
902
+				EEH_HTML::th(esc_html__('Paid', 'event_espresso'), '', 'txn-admin-payment-paid-td jst-cntr').
903
+				EEH_HTML::th(esc_html__('Owing', 'event_espresso'), '', 'txn-admin-payment-owing-td jst-cntr').
904
+				EEH_HTML::th(esc_html__('Apply', 'event_espresso'), '', 'jst-cntr')
905 905
 			)
906 906
 		);
907 907
 		$registrations_to_apply_payment_to .= EEH_HTML::tbody();
908 908
 		// get registrations for TXN
909
-		$registrations = $this->_transaction->registrations( $query_params );
910
-		foreach ( $registrations as $registration ) {
911
-			if ( $registration instanceof EE_Registration ) {
909
+		$registrations = $this->_transaction->registrations($query_params);
910
+		foreach ($registrations as $registration) {
911
+			if ($registration instanceof EE_Registration) {
912 912
 				$attendee_name = $registration->attendee() instanceof EE_Attendee
913 913
 					? $registration->attendee()->full_name()
914
-					: esc_html__( 'Unknown Attendee', 'event_espresso' );
914
+					: esc_html__('Unknown Attendee', 'event_espresso');
915 915
 				$owing = $registration->final_price() - $registration->paid();
916 916
 				$taxable = $registration->ticket()->taxable()
917
-					? ' <span class="smaller-text lt-grey-text"> ' . esc_html__( '+ tax', 'event_espresso' ) . '</span>'
917
+					? ' <span class="smaller-text lt-grey-text"> '.esc_html__('+ tax', 'event_espresso').'</span>'
918 918
 					: '';
919
-				$checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments )
919
+				$checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments)
920 920
 					? ' checked="checked"'
921 921
 					: '';
922 922
 				$disabled = $registration->final_price() > 0 ? '' : ' disabled';
923 923
 				$registrations_to_apply_payment_to .= EEH_HTML::tr(
924
-					EEH_HTML::td( $registration->ID() ) .
925
-					EEH_HTML::td( $attendee_name ) .
924
+					EEH_HTML::td($registration->ID()).
925
+					EEH_HTML::td($attendee_name).
926 926
 					EEH_HTML::td(
927
-						$registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable
928
-					) .
929
-					EEH_HTML::td( $registration->event_name() ) .
930
-					EEH_HTML::td( $registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr' ) .
931
-					EEH_HTML::td( EEH_Template::format_currency( $owing ), '', 'txn-admin-payment-owing-td jst-cntr' ) .
927
+						$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable
928
+					).
929
+					EEH_HTML::td($registration->event_name()).
930
+					EEH_HTML::td($registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr').
931
+					EEH_HTML::td(EEH_Template::format_currency($owing), '', 'txn-admin-payment-owing-td jst-cntr').
932 932
 					EEH_HTML::td(
933
-						'<input type="checkbox" value="' . $registration->ID()
933
+						'<input type="checkbox" value="'.$registration->ID()
934 934
 						. '" name="txn_admin_payment[registrations]"'
935
-						. $checked . $disabled . '>',
935
+						. $checked.$disabled.'>',
936 936
 						'', 'jst-cntr'
937 937
 					),
938
-					'apply-payment-registration-row-' . $registration->ID()
938
+					'apply-payment-registration-row-'.$registration->ID()
939 939
 				);
940 940
 			}
941 941
 		}
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 			'', 'clear description'
951 951
 		);
952 952
 		$registrations_to_apply_payment_to .= EEH_HTML::divx();
953
-		$this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to;
953
+		$this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to;
954 954
 	}
955 955
 
956 956
 
@@ -967,9 +967,9 @@  discard block
 block discarded – undo
967 967
 		$statuses = EEM_Registration::reg_status_array(array(), TRUE);
968 968
 		//let's add a "don't change" option.
969 969
 		$status_array['NAN'] = esc_html__('Leave the Same', 'event_espresso');
970
-		$status_array = array_merge( $status_array, $statuses );
971
-		$this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' );
972
-		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' );
970
+		$status_array = array_merge($status_array, $statuses);
971
+		$this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status');
972
+		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status');
973 973
 
974 974
 	}
975 975
 
@@ -984,21 +984,21 @@  discard block
 block discarded – undo
984 984
 	 * @param EE_Payment[] to show on this page
985 985
 	 *	@return void
986 986
 	 */
987
-	private function _get_payment_methods( $payments = array() ) {
987
+	private function _get_payment_methods($payments = array()) {
988 988
 		$payment_methods_of_payments = array();
989
-		foreach( $payments as $payment ){
990
-			if( $payment instanceof EE_Payment ){
991
-				$payment_methods_of_payments[] = $payment->get( 'PMD_ID' );
989
+		foreach ($payments as $payment) {
990
+			if ($payment instanceof EE_Payment) {
991
+				$payment_methods_of_payments[] = $payment->get('PMD_ID');
992 992
 			}
993 993
 		}
994
-		if( $payment_methods_of_payments ){
995
-			$query_args = array( array( 'OR*payment_method_for_payment' => array(
996
-					'PMD_ID' => array( 'IN', $payment_methods_of_payments ),
997
-					'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) );
998
-		}else{
999
-			$query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) );
994
+		if ($payment_methods_of_payments) {
995
+			$query_args = array(array('OR*payment_method_for_payment' => array(
996
+					'PMD_ID' => array('IN', $payment_methods_of_payments),
997
+					'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') )));
998
+		} else {
999
+			$query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%')));
1000 1000
 		}
1001
-		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args );
1001
+		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args);
1002 1002
 	}
1003 1003
 
1004 1004
 
@@ -1012,17 +1012,17 @@  discard block
 block discarded – undo
1012 1012
 	 * @param array $metabox
1013 1013
 	 * @return void
1014 1014
 	 */
1015
-	public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) {
1015
+	public function txn_attendees_meta_box($post, $metabox = array('args' => array())) {
1016 1016
 
1017
-		extract( $metabox['args'] );
1017
+		extract($metabox['args']);
1018 1018
 		$this->_template_args['post'] = $post;
1019 1019
 		$this->_template_args['event_attendees'] = array();
1020 1020
 		// process items in cart
1021
-		$line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) );
1022
-		if ( ! empty( $line_items )) {
1023
-			foreach ( $line_items as $item ) {
1024
-				if ( $item instanceof EE_Line_Item ) {
1025
-					switch( $item->OBJ_type() ) {
1021
+		$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
1022
+		if ( ! empty($line_items)) {
1023
+			foreach ($line_items as $item) {
1024
+				if ($item instanceof EE_Line_Item) {
1025
+					switch ($item->OBJ_type()) {
1026 1026
 
1027 1027
 						case 'Event' :
1028 1028
 							break;
@@ -1030,39 +1030,39 @@  discard block
 block discarded – undo
1030 1030
 						case 'Ticket' :
1031 1031
 							$ticket = $item->ticket();
1032 1032
 							//right now we're only handling tickets here.  Cause its expected that only tickets will have attendees right?
1033
-							if ( ! $ticket instanceof EE_Ticket ) {
1033
+							if ( ! $ticket instanceof EE_Ticket) {
1034 1034
 								continue;
1035 1035
 							}
1036 1036
 							try {
1037 1037
 								$event_name = $ticket->get_event_name();
1038
-							} catch ( Exception $e ) {
1039
-								EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
1040
-								$event_name = esc_html__( 'Unknown Event', 'event_espresso' );
1038
+							} catch (Exception $e) {
1039
+								EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
1040
+								$event_name = esc_html__('Unknown Event', 'event_espresso');
1041 1041
 							}
1042
-							$event_name .= ' - ' . $item->get( 'LIN_name' );
1043
-							$ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' ) );
1042
+							$event_name .= ' - '.$item->get('LIN_name');
1043
+							$ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price'));
1044 1044
 							// now get all of the registrations for this transaction that use this ticket
1045
-							$registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() )));
1046
-							foreach( $registrations as $registration ) {
1047
-								if ( ! $registration instanceof EE_Registration ) {
1045
+							$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
1046
+							foreach ($registrations as $registration) {
1047
+								if ( ! $registration instanceof EE_Registration) {
1048 1048
 									continue;
1049 1049
 								}
1050
-								$this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] 			= $registration->status_ID();
1051
-								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] 			= $registration->count();
1052
-								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] 	= $event_name;
1053
-								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] 		= $ticket_price;
1050
+								$this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] = $registration->status_ID();
1051
+								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->count();
1052
+								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name;
1053
+								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price;
1054 1054
 								// attendee info
1055 1055
 								$attendee = $registration->get_first_related('Attendee');
1056
-								if ( $attendee instanceof EE_Attendee ) {
1057
-									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 	= $attendee->ID();
1058
-									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= $attendee->full_name();
1059
-									$this->_template_args['event_attendees'][$registration->ID()]['email']		= '<a href="mailto:' . $attendee->email() . '?subject=' . $event_name . esc_html__(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>';
1060
-									$this->_template_args['event_attendees'][$registration->ID()]['address'] 	= EEH_Address::format( $attendee, 'inline', false, false );
1056
+								if ($attendee instanceof EE_Attendee) {
1057
+									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID();
1058
+									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name();
1059
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event_name.esc_html__(' Event', 'event_espresso').'">'.$attendee->email().'</a>';
1060
+									$this->_template_args['event_attendees'][$registration->ID()]['address'] = EEH_Address::format($attendee, 'inline', false, false);
1061 1061
 								} else {
1062 1062
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 	= '';
1063
-									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= '';
1063
+									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] = '';
1064 1064
 									$this->_template_args['event_attendees'][$registration->ID()]['email'] 		= '';
1065
-									$this->_template_args['event_attendees'][$registration->ID()]['address'] 	= '';
1065
+									$this->_template_args['event_attendees'][$registration->ID()]['address'] = '';
1066 1066
 								}
1067 1067
 							}
1068 1068
 							break;
@@ -1071,12 +1071,12 @@  discard block
 block discarded – undo
1071 1071
 				}
1072 1072
 			}
1073 1073
 
1074
-			$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees'  ), TXN_ADMIN_URL );
1075
-			echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE );
1074
+			$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
1075
+			echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE);
1076 1076
 
1077 1077
 		} else {
1078 1078
 			echo sprintf(
1079
-				esc_html__( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ),
1079
+				esc_html__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'),
1080 1080
 				'<p class="important-notice">',
1081 1081
 				'</p>'
1082 1082
 			);
@@ -1095,19 +1095,19 @@  discard block
 block discarded – undo
1095 1095
 	 */
1096 1096
 	public function txn_registrant_side_meta_box() {
1097 1097
 		$primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null;
1098
-		if ( ! $primary_att instanceof EE_Attendee ) {
1098
+		if ( ! $primary_att instanceof EE_Attendee) {
1099 1099
 			$this->_template_args['no_attendee_message'] = esc_html__('There is no attached contact for this transaction.  The transaction either failed due to an error or was abandoned.', 'event_espresso');
1100 1100
 			$primary_att = EEM_Attendee::instance()->create_default_object();
1101 1101
 		}
1102
-		$this->_template_args['ATT_ID'] 						= $primary_att->ID();
1102
+		$this->_template_args['ATT_ID'] = $primary_att->ID();
1103 1103
 		$this->_template_args['prime_reg_fname']		= $primary_att->fname();
1104 1104
 		$this->_template_args['prime_reg_lname']		= $primary_att->lname();
1105
-		$this->_template_args['prime_reg_email'] 		= $primary_att->email();
1105
+		$this->_template_args['prime_reg_email'] = $primary_att->email();
1106 1106
 		$this->_template_args['prime_reg_phone'] 	= $primary_att->phone();
1107
-		$this->_template_args['edit_attendee_url'] 	= EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID()  ), REG_ADMIN_URL );
1107
+		$this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL);
1108 1108
 		// get formatted address for registrant
1109
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att );
1110
-		echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE );
1109
+		$this->_template_args['formatted_address'] = EEH_Address::format($primary_att);
1110
+		echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE);
1111 1111
 	}
1112 1112
 
1113 1113
 
@@ -1123,12 +1123,12 @@  discard block
 block discarded – undo
1123 1123
 
1124 1124
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
1125 1125
 		$this->_template_args['billing_form_url'] = add_query_arg(
1126
-			array( 'action' => 'edit_transaction', 'process' => 'billing'  ),
1126
+			array('action' => 'edit_transaction', 'process' => 'billing'),
1127 1127
 			TXN_ADMIN_URL
1128 1128
 		);
1129 1129
 
1130
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php';
1131
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/
1130
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php';
1131
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/
1132 1132
 	}
1133 1133
 
1134 1134
 
@@ -1141,42 +1141,42 @@  discard block
 block discarded – undo
1141 1141
 	*	@return void
1142 1142
 	*/
1143 1143
 	public function apply_payments_or_refunds() {
1144
-		$json_response_data = array( 'return_data' => FALSE );
1144
+		$json_response_data = array('return_data' => FALSE);
1145 1145
 		$valid_data = $this->_validate_payment_request_data();
1146
-		if ( ! empty( $valid_data ) ) {
1147
-			$PAY_ID = $valid_data[ 'PAY_ID' ];
1146
+		if ( ! empty($valid_data)) {
1147
+			$PAY_ID = $valid_data['PAY_ID'];
1148 1148
 			//save  the new payment
1149
-			$payment = $this->_create_payment_from_request_data( $valid_data );
1149
+			$payment = $this->_create_payment_from_request_data($valid_data);
1150 1150
 			// get the TXN for this payment
1151 1151
 			$transaction = $payment->transaction();
1152 1152
 			// verify transaction
1153
-			if ( $transaction instanceof EE_Transaction ) {
1153
+			if ($transaction instanceof EE_Transaction) {
1154 1154
 				// calculate_total_payments_and_update_status
1155
-				$this->_process_transaction_payments( $transaction );
1156
-				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment );
1157
-				$this->_remove_existing_registration_payments( $payment, $PAY_ID );
1155
+				$this->_process_transaction_payments($transaction);
1156
+				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment);
1157
+				$this->_remove_existing_registration_payments($payment, $PAY_ID);
1158 1158
 				// apply payment to registrations (if applicable)
1159
-				if ( ! empty( $REG_IDs ) ) {
1160
-					$this->_update_registration_payments( $transaction, $payment, $REG_IDs );
1159
+				if ( ! empty($REG_IDs)) {
1160
+					$this->_update_registration_payments($transaction, $payment, $REG_IDs);
1161 1161
 					$this->_maybe_send_notifications();
1162 1162
 					// now process status changes for the same registrations
1163
-					$this->_process_registration_status_change( $transaction, $REG_IDs );
1163
+					$this->_process_registration_status_change($transaction, $REG_IDs);
1164 1164
 				}
1165
-				$this->_maybe_send_notifications( $payment );
1165
+				$this->_maybe_send_notifications($payment);
1166 1166
 				//prepare to render page
1167
-				$json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs );
1168
-				do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment );
1167
+				$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs);
1168
+				do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment);
1169 1169
 			} else {
1170 1170
 				EE_Error::add_error(
1171
-					esc_html__( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ),
1171
+					esc_html__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'),
1172 1172
 					__FILE__, __FUNCTION__, __LINE__
1173 1173
 				);
1174 1174
 			}
1175 1175
 		} else {
1176
-			EE_Error::add_error( esc_html__( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1176
+			EE_Error::add_error(esc_html__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1177 1177
 		}
1178 1178
 
1179
-		$notices = EE_Error::get_notices( false, false, false );
1179
+		$notices = EE_Error::get_notices(false, false, false);
1180 1180
 		$this->_template_args = array(
1181 1181
 			'data' => $json_response_data,
1182 1182
 			'error' => $notices['errors'],
@@ -1193,30 +1193,30 @@  discard block
 block discarded – undo
1193 1193
 	 * @return array
1194 1194
 	 */
1195 1195
 	protected function _validate_payment_request_data() {
1196
-		if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) {
1196
+		if ( ! isset($this->_req_data['txn_admin_payment'])) {
1197 1197
 			return false;
1198 1198
 		}
1199 1199
 		$payment_form = $this->_generate_payment_form_section();
1200 1200
 		try {
1201
-			if ( $payment_form->was_submitted() ) {
1201
+			if ($payment_form->was_submitted()) {
1202 1202
 				$payment_form->receive_form_submission();
1203
-				if ( ! $payment_form->is_valid() ) {
1203
+				if ( ! $payment_form->is_valid()) {
1204 1204
 					$submission_error_messages = array();
1205
-					foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) {
1206
-						if ( $validation_error instanceof EE_Validation_Error ) {
1205
+					foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) {
1206
+						if ($validation_error instanceof EE_Validation_Error) {
1207 1207
 							$submission_error_messages[] = sprintf(
1208
-								_x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ),
1208
+								_x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'),
1209 1209
 								$validation_error->get_form_section()->html_label_text(),
1210 1210
 								$validation_error->getMessage()
1211 1211
 							);
1212 1212
 						}
1213 1213
 					}
1214
-					EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1214
+					EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1215 1215
 					return array();
1216 1216
 				}
1217 1217
 			}
1218
-		} catch ( EE_Error $e ) {
1219
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
1218
+		} catch (EE_Error $e) {
1219
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
1220 1220
 			return array();
1221 1221
 		}
1222 1222
 		return $payment_form->valid_data();
@@ -1238,63 +1238,63 @@  discard block
 block discarded – undo
1238 1238
 						array(
1239 1239
 							'default' => 0,
1240 1240
 							'required' => false,
1241
-							'html_label_text' => esc_html__( 'Payment ID', 'event_espresso' ),
1242
-							'validation_strategies' => array( new EE_Int_Normalization() )
1241
+							'html_label_text' => esc_html__('Payment ID', 'event_espresso'),
1242
+							'validation_strategies' => array(new EE_Int_Normalization())
1243 1243
 						)
1244 1244
 					),
1245 1245
 					'TXN_ID' => new EE_Text_Input(
1246 1246
 						array(
1247 1247
 							'default' => 0,
1248 1248
 							'required' => true,
1249
-							'html_label_text' => esc_html__( 'Transaction ID', 'event_espresso' ),
1250
-							'validation_strategies' => array( new EE_Int_Normalization() )
1249
+							'html_label_text' => esc_html__('Transaction ID', 'event_espresso'),
1250
+							'validation_strategies' => array(new EE_Int_Normalization())
1251 1251
 						)
1252 1252
 					),
1253 1253
 					'type' => new EE_Text_Input(
1254 1254
 						array(
1255 1255
 							'default' => 1,
1256 1256
 							'required' => true,
1257
-							'html_label_text' => esc_html__( 'Payment or Refund', 'event_espresso' ),
1258
-							'validation_strategies' => array( new EE_Int_Normalization() )
1257
+							'html_label_text' => esc_html__('Payment or Refund', 'event_espresso'),
1258
+							'validation_strategies' => array(new EE_Int_Normalization())
1259 1259
 						)
1260 1260
 					),
1261 1261
 					'amount' => new EE_Text_Input(
1262 1262
 						array(
1263 1263
 							'default' => 0,
1264 1264
 							'required' => true,
1265
-							'html_label_text' => esc_html__( 'Payment amount', 'event_espresso' ),
1266
-							'validation_strategies' => array( new EE_Float_Normalization() )
1265
+							'html_label_text' => esc_html__('Payment amount', 'event_espresso'),
1266
+							'validation_strategies' => array(new EE_Float_Normalization())
1267 1267
 						)
1268 1268
 					),
1269 1269
 					'status' => new EE_Text_Input(
1270 1270
 						array(
1271 1271
 							'default' => EEM_Payment::status_id_approved,
1272 1272
 							'required' => true,
1273
-							'html_label_text' => esc_html__( 'Payment status', 'event_espresso' ),
1273
+							'html_label_text' => esc_html__('Payment status', 'event_espresso'),
1274 1274
 						)
1275 1275
 					),
1276 1276
 					'PMD_ID' => new EE_Text_Input(
1277 1277
 						array(
1278 1278
 							'default' => 2,
1279 1279
 							'required' => true,
1280
-							'html_label_text' => esc_html__( 'Payment Method', 'event_espresso' ),
1281
-							'validation_strategies' => array( new EE_Int_Normalization() )
1280
+							'html_label_text' => esc_html__('Payment Method', 'event_espresso'),
1281
+							'validation_strategies' => array(new EE_Int_Normalization())
1282 1282
 						)
1283 1283
 					),
1284 1284
 					'date' => new EE_Text_Input(
1285 1285
 						array(
1286 1286
 							'default' => time(),
1287 1287
 							'required' => true,
1288
-							'html_label_text' => esc_html__( 'Payment date', 'event_espresso' ),
1288
+							'html_label_text' => esc_html__('Payment date', 'event_espresso'),
1289 1289
 						)
1290 1290
 					),
1291 1291
 					'txn_id_chq_nmbr' => new EE_Text_Input(
1292 1292
 						array(
1293 1293
 							'default' => '',
1294 1294
 							'required' => false,
1295
-							'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ),
1295
+							'html_label_text' => esc_html__('Transaction or Cheque Number', 'event_espresso'),
1296 1296
                                                         'validation_strategies' => array(
1297
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1297
+                                                            new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100),
1298 1298
                                                         )
1299 1299
 						)
1300 1300
 					),
@@ -1302,9 +1302,9 @@  discard block
 block discarded – undo
1302 1302
 						array(
1303 1303
 							'default' => '',
1304 1304
 							'required' => false,
1305
-							'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ),
1305
+							'html_label_text' => esc_html__('Purchase Order Number', 'event_espresso'),
1306 1306
                                                         'validation_strategies' => array(
1307
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1307
+                                                            new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100),
1308 1308
                                                         )
1309 1309
 						)
1310 1310
 					),
@@ -1312,9 +1312,9 @@  discard block
 block discarded – undo
1312 1312
 						array(
1313 1313
 							'default' => '',
1314 1314
 							'required' => false,
1315
-							'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ),
1315
+							'html_label_text' => esc_html__('Extra Field for Accounting', 'event_espresso'),
1316 1316
                                                         'validation_strategies' => array(
1317
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1317
+                                                            new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100),
1318 1318
                                                         )
1319 1319
 						)
1320 1320
 					),
@@ -1331,37 +1331,37 @@  discard block
 block discarded – undo
1331 1331
 	 * @param array $valid_data
1332 1332
 	 * @return EE_Payment
1333 1333
 	 */
1334
-	protected function _create_payment_from_request_data( $valid_data ) {
1335
-		$PAY_ID = $valid_data[ 'PAY_ID' ];
1334
+	protected function _create_payment_from_request_data($valid_data) {
1335
+		$PAY_ID = $valid_data['PAY_ID'];
1336 1336
 		// get payment amount
1337
-		$amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0;
1337
+		$amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0;
1338 1338
 		// payments have a type value of 1 and refunds have a type value of -1
1339 1339
 		// so multiplying amount by type will give a positive value for payments, and negative values for refunds
1340
-		$amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount;
1340
+		$amount = $valid_data['type'] < 0 ? $amount * -1 : $amount;
1341 1341
 		// for some reason the date string coming in has extra spaces between the date and time.  This fixes that.
1342
-		$date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) );
1342
+		$date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp'));
1343 1343
 		$payment = EE_Payment::new_instance(
1344 1344
 			array(
1345
-				'TXN_ID' 								=> $valid_data[ 'TXN_ID' ],
1346
-				'STS_ID' 								=> $valid_data[ 'status' ],
1345
+				'TXN_ID' 								=> $valid_data['TXN_ID'],
1346
+				'STS_ID' 								=> $valid_data['status'],
1347 1347
 				'PAY_timestamp' 				=> $date,
1348 1348
 				'PAY_source'           			=> EEM_Payment_Method::scope_admin,
1349
-				'PMD_ID'               				=> $valid_data[ 'PMD_ID' ],
1349
+				'PMD_ID'               				=> $valid_data['PMD_ID'],
1350 1350
 				'PAY_amount'           			=> $amount,
1351
-				'PAY_txn_id_chq_nmbr'  	=> $valid_data[ 'txn_id_chq_nmbr' ],
1352
-				'PAY_po_number'        		=> $valid_data[ 'po_number' ],
1353
-				'PAY_extra_accntng'    		=> $valid_data[ 'accounting' ],
1351
+				'PAY_txn_id_chq_nmbr'  	=> $valid_data['txn_id_chq_nmbr'],
1352
+				'PAY_po_number'        		=> $valid_data['po_number'],
1353
+				'PAY_extra_accntng'    		=> $valid_data['accounting'],
1354 1354
 				'PAY_details'          				=> $valid_data,
1355 1355
 				'PAY_ID'               				=> $PAY_ID
1356 1356
 			),
1357 1357
 			'',
1358
-			array( 'Y-m-d', 'g:i a' )
1358
+			array('Y-m-d', 'g:i a')
1359 1359
 		);
1360 1360
 
1361
-		if ( ! $payment->save() ) {
1361
+		if ( ! $payment->save()) {
1362 1362
 			EE_Error::add_error(
1363 1363
 				sprintf(
1364
-					esc_html__( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ),
1364
+					esc_html__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'),
1365 1365
 					$payment->ID()
1366 1366
 				),
1367 1367
 				__FILE__, __FUNCTION__, __LINE__
@@ -1378,15 +1378,15 @@  discard block
 block discarded – undo
1378 1378
 	 * @param \EE_Transaction $transaction
1379 1379
 	 * @return array
1380 1380
 	 */
1381
-	protected function _process_transaction_payments( EE_Transaction $transaction ) {
1381
+	protected function _process_transaction_payments(EE_Transaction $transaction) {
1382 1382
 		/** @type EE_Transaction_Payments $transaction_payments */
1383
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1383
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1384 1384
 		//update the transaction with this payment
1385
-		if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) {
1386
-			EE_Error::add_success( esc_html__( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1385
+		if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) {
1386
+			EE_Error::add_success(esc_html__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1387 1387
 		} else {
1388 1388
 			EE_Error::add_error(
1389
-				esc_html__( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' )
1389
+				esc_html__('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso')
1390 1390
 				, __FILE__, __FUNCTION__, __LINE__
1391 1391
 			);
1392 1392
 		}
@@ -1402,19 +1402,19 @@  discard block
 block discarded – undo
1402 1402
 	 * @param \EE_Payment $payment
1403 1403
 	 * @return array
1404 1404
 	 */
1405
-	protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) {
1405
+	protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) {
1406 1406
 		$REG_IDs = array();
1407 1407
 		// grab array of IDs for specific registrations to apply changes to
1408
-		if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) {
1409
-			$REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ];
1408
+		if (isset($this->_req_data['txn_admin_payment']['registrations'])) {
1409
+			$REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations'];
1410 1410
 		}
1411 1411
 		//nothing specified ? then get all reg IDs
1412
-		if ( empty( $REG_IDs ) ) {
1412
+		if (empty($REG_IDs)) {
1413 1413
 			$registrations = $payment->transaction()->registrations();
1414
-			$REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment );
1414
+			$REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment);
1415 1415
 		}
1416 1416
 		// ensure that REG_IDs are integers and NOT strings
1417
-		return array_map( 'intval', $REG_IDs );
1417
+		return array_map('intval', $REG_IDs);
1418 1418
 	}
1419 1419
 
1420 1420
 
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 	/**
1432 1432
 	 * @param array $existing_reg_payment_REG_IDs
1433 1433
 	 */
1434
-	public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) {
1434
+	public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) {
1435 1435
 		$this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs;
1436 1436
 	}
1437 1437
 
@@ -1446,13 +1446,13 @@  discard block
 block discarded – undo
1446 1446
 	 * @param \EE_Payment $payment
1447 1447
 	 * @return array
1448 1448
 	 */
1449
-	protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) {
1450
-		if ( $this->existing_reg_payment_REG_IDs() === null ) {
1449
+	protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) {
1450
+		if ($this->existing_reg_payment_REG_IDs() === null) {
1451 1451
 			// let's get any existing reg payment records for this payment
1452
-			$existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' );
1452
+			$existing_reg_payment_REG_IDs = $payment->get_many_related('Registration');
1453 1453
 			// but we only want the REG IDs, so grab the array keys
1454
-			$existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array();
1455
-			$this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs );
1454
+			$existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array();
1455
+			$this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs);
1456 1456
 		}
1457 1457
 		return $this->existing_reg_payment_REG_IDs();
1458 1458
 	}
@@ -1471,23 +1471,23 @@  discard block
 block discarded – undo
1471 1471
 	 * @param int         $PAY_ID
1472 1472
 	 * @return bool;
1473 1473
 	 */
1474
-	protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) {
1474
+	protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) {
1475 1475
 		// newly created payments will have nothing recorded for $PAY_ID
1476
-		if ( $PAY_ID == 0 ) {
1476
+		if ($PAY_ID == 0) {
1477 1477
 			return false;
1478 1478
 		}
1479
-		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1480
-		if ( empty( $existing_reg_payment_REG_IDs )) {
1479
+		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1480
+		if (empty($existing_reg_payment_REG_IDs)) {
1481 1481
 			return false;
1482 1482
 		}
1483 1483
 		/** @type EE_Transaction_Payments $transaction_payments */
1484
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1484
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1485 1485
 		return $transaction_payments->delete_registration_payments_and_update_registrations(
1486 1486
 			$payment,
1487 1487
 			array(
1488 1488
 				array(
1489 1489
 					'PAY_ID' => $payment->ID(),
1490
-					'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ),
1490
+					'REG_ID' => array('IN', $existing_reg_payment_REG_IDs),
1491 1491
 				)
1492 1492
 			)
1493 1493
 		);
@@ -1506,25 +1506,25 @@  discard block
 block discarded – undo
1506 1506
 	 * @param array $REG_IDs
1507 1507
 	 * @return bool
1508 1508
 	 */
1509
-	protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) {
1509
+	protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) {
1510 1510
 		// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
1511 1511
 		// so let's do that using our set of REG_IDs from the form
1512 1512
 		$registration_query_where_params = array(
1513
-			'REG_ID' => array( 'IN', $REG_IDs )
1513
+			'REG_ID' => array('IN', $REG_IDs)
1514 1514
 		);
1515 1515
 		// but add in some conditions regarding payment,
1516 1516
 		// so that we don't apply payments to registrations that are free or have already been paid for
1517 1517
 		// but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative )
1518
-		if ( ! $payment->is_a_refund() ) {
1519
-			$registration_query_where_params[ 'REG_final_price' ]  = array( '!=', 0 );
1520
-			$registration_query_where_params[ 'REG_final_price*' ]  = array( '!=', 'REG_paid', true );
1518
+		if ( ! $payment->is_a_refund()) {
1519
+			$registration_query_where_params['REG_final_price'] = array('!=', 0);
1520
+			$registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true);
1521 1521
 		}
1522 1522
 		//EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ );
1523
-		$registrations = $transaction->registrations( array( $registration_query_where_params ) );
1524
-		if ( ! empty( $registrations ) ) {
1523
+		$registrations = $transaction->registrations(array($registration_query_where_params));
1524
+		if ( ! empty($registrations)) {
1525 1525
 			/** @type EE_Payment_Processor $payment_processor */
1526
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1527
-			$payment_processor->process_registration_payments( $transaction, $payment, $registrations );
1526
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1527
+			$payment_processor->process_registration_payments($transaction, $payment, $registrations);
1528 1528
 		}
1529 1529
 	}
1530 1530
 
@@ -1540,22 +1540,22 @@  discard block
 block discarded – undo
1540 1540
 	 * @param array $REG_IDs
1541 1541
 	 * @return bool
1542 1542
 	 */
1543
-	protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) {
1543
+	protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) {
1544 1544
 		// first if there is no change in status then we get out.
1545 1545
 		if (
1546
-			! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] )
1546
+			! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status'])
1547 1547
 			|| $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN'
1548 1548
 		) {
1549 1549
 			//no error message, no change requested, just nothing to do man.
1550 1550
 			return FALSE;
1551 1551
 		}
1552 1552
 		/** @type EE_Transaction_Processor $transaction_processor */
1553
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1553
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1554 1554
 		// made it here dude?  Oh WOW.  K, let's take care of changing the statuses
1555 1555
 		return $transaction_processor->manually_update_registration_statuses(
1556 1556
 			$transaction,
1557
-			sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ),
1558
-			array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) )
1557
+			sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']),
1558
+			array(array('REG_ID' => array('IN', $REG_IDs)))
1559 1559
 		);
1560 1560
 	}
1561 1561
 
@@ -1570,16 +1570,16 @@  discard block
 block discarded – undo
1570 1570
 	 * @param bool | null        $delete_txn_reg_status_change
1571 1571
 	 * @return array
1572 1572
 	 */
1573
-	protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) {
1573
+	protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) {
1574 1574
 		// was the payment deleted ?
1575
-		if ( is_bool( $delete_txn_reg_status_change )) {
1575
+		if (is_bool($delete_txn_reg_status_change)) {
1576 1576
 			return array(
1577 1577
 				'PAY_ID' 				=> $payment->ID(),
1578 1578
 				'amount' 			=> $payment->amount(),
1579 1579
 				'total_paid' 			=> $payment->transaction()->paid(),
1580 1580
 				'txn_status' 			=> $payment->transaction()->status_ID(),
1581 1581
 				'pay_status' 		=> $payment->STS_ID(),
1582
-				'registrations' 	=> $this->_registration_payment_data_array( $REG_IDs ),
1582
+				'registrations' 	=> $this->_registration_payment_data_array($REG_IDs),
1583 1583
 				'delete_txn_reg_status_change' => $delete_txn_reg_status_change,
1584 1584
 			);
1585 1585
 		} else {
@@ -1591,16 +1591,16 @@  discard block
 block discarded – undo
1591 1591
 				'pay_status' 	=> $payment->STS_ID(),
1592 1592
 				'PAY_ID'           => $payment->ID(),
1593 1593
 				'STS_ID' 			=> $payment->STS_ID(),
1594
-				'status' 			=> self::$_pay_status[ $payment->STS_ID() ],
1595
-				'date' 				=> $payment->timestamp( 'Y-m-d', 'h:i a' ),
1596
-				'method' 		=> strtoupper( $payment->source() ),
1594
+				'status' 			=> self::$_pay_status[$payment->STS_ID()],
1595
+				'date' 				=> $payment->timestamp('Y-m-d', 'h:i a'),
1596
+				'method' 		=> strtoupper($payment->source()),
1597 1597
 				'PM_ID' 			=> $payment->payment_method() ? $payment->payment_method()->ID() : 1,
1598
-				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__( "Unknown", 'event_espresso' ),
1598
+				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__("Unknown", 'event_espresso'),
1599 1599
 				'gateway_response' 	=> $payment->gateway_response(),
1600 1600
 				'txn_id_chq_nmbr'  	=> $payment->txn_id_chq_nmbr(),
1601 1601
 				'po_number'        		=> $payment->po_number(),
1602 1602
 				'extra_accntng'    		=> $payment->extra_accntng(),
1603
-				'registrations'    			=> $this->_registration_payment_data_array( $REG_IDs ),
1603
+				'registrations'    			=> $this->_registration_payment_data_array($REG_IDs),
1604 1604
 			);
1605 1605
 		}
1606 1606
 	}
@@ -1615,39 +1615,39 @@  discard block
 block discarded – undo
1615 1615
 	*	@return void
1616 1616
 	*/
1617 1617
 	public function delete_payment() {
1618
-		$json_response_data = array( 'return_data' => FALSE );
1619
-		$PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0;
1620
-		if ( $PAY_ID ) {
1621
-			$delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false;
1622
-			$payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID );
1623
-			if ( $payment instanceof EE_Payment ) {
1624
-				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1618
+		$json_response_data = array('return_data' => FALSE);
1619
+		$PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0;
1620
+		if ($PAY_ID) {
1621
+			$delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false;
1622
+			$payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
1623
+			if ($payment instanceof EE_Payment) {
1624
+				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1625 1625
 				/** @type EE_Transaction_Payments $transaction_payments */
1626
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1627
-				if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) {
1628
-					$json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change );
1629
-					if ( $delete_txn_reg_status_change ) {
1626
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1627
+				if ($transaction_payments->delete_payment_and_update_transaction($payment)) {
1628
+					$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change);
1629
+					if ($delete_txn_reg_status_change) {
1630 1630
 						$this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change;
1631 1631
 						//MAKE sure we also add the delete_txn_req_status_change to the
1632 1632
 						//$_REQUEST global because that's how messages will be looking for it.
1633 1633
 						$_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change;
1634 1634
 						$this->_maybe_send_notifications();
1635
-						$this->_process_registration_status_change( $payment->transaction(), $REG_IDs );
1635
+						$this->_process_registration_status_change($payment->transaction(), $REG_IDs);
1636 1636
 					}
1637 1637
 				}
1638 1638
 			} else {
1639 1639
 				EE_Error::add_error(
1640
-					esc_html__( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ),
1640
+					esc_html__('Valid Payment data could not be retrieved from the database.', 'event_espresso'),
1641 1641
 					__FILE__, __FUNCTION__, __LINE__
1642 1642
 				);
1643 1643
 			}
1644 1644
 		} else {
1645 1645
 			EE_Error::add_error(
1646
-				esc_html__( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ),
1646
+				esc_html__('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'),
1647 1647
 				__FILE__, __FUNCTION__, __LINE__
1648 1648
 			);
1649 1649
 		}
1650
-		$notices = EE_Error::get_notices( false, false, false);
1650
+		$notices = EE_Error::get_notices(false, false, false);
1651 1651
 		$this->_template_args = array(
1652 1652
 			'data' => $json_response_data,
1653 1653
 			'success' => $notices['success'],
@@ -1667,16 +1667,16 @@  discard block
 block discarded – undo
1667 1667
 	 * @param array $REG_IDs
1668 1668
 	 * @return array
1669 1669
 	 */
1670
-	protected function _registration_payment_data_array( $REG_IDs ) {
1670
+	protected function _registration_payment_data_array($REG_IDs) {
1671 1671
 		$registration_payment_data = array();
1672 1672
 		//if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows.
1673
-		if ( ! empty( $REG_IDs ) ) {
1674
-			$registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) );
1675
-			foreach ( $registrations as $registration ) {
1676
-				if ( $registration instanceof EE_Registration ) {
1677
-					$registration_payment_data[ $registration->ID() ] = array(
1673
+		if ( ! empty($REG_IDs)) {
1674
+			$registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs))));
1675
+			foreach ($registrations as $registration) {
1676
+				if ($registration instanceof EE_Registration) {
1677
+					$registration_payment_data[$registration->ID()] = array(
1678 1678
 						'paid' => $registration->pretty_paid(),
1679
-						'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ),
1679
+						'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()),
1680 1680
 					);
1681 1681
 				}
1682 1682
 			}
@@ -1696,30 +1696,30 @@  discard block
 block discarded – undo
1696 1696
 	 * @access protected
1697 1697
 	 * @param \EE_Payment | null $payment
1698 1698
 	 */
1699
-	protected function _maybe_send_notifications( $payment = null ) {
1700
-		switch ( $payment instanceof EE_Payment ) {
1699
+	protected function _maybe_send_notifications($payment = null) {
1700
+		switch ($payment instanceof EE_Payment) {
1701 1701
 			// payment notifications
1702 1702
 			case true :
1703 1703
 				if (
1704 1704
 					isset(
1705
-						$this->_req_data[ 'txn_payments' ],
1706
-						$this->_req_data[ 'txn_payments' ][ 'send_notifications' ]
1705
+						$this->_req_data['txn_payments'],
1706
+						$this->_req_data['txn_payments']['send_notifications']
1707 1707
 					) &&
1708
-					filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1708
+					filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1709 1709
 				) {
1710
-					$this->_process_payment_notification( $payment );
1710
+					$this->_process_payment_notification($payment);
1711 1711
 				}
1712 1712
 				break;
1713 1713
 			// registration notifications
1714 1714
 			case false :
1715 1715
 				if (
1716 1716
 					isset(
1717
-						$this->_req_data[ 'txn_reg_status_change' ],
1718
-						$this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ]
1717
+						$this->_req_data['txn_reg_status_change'],
1718
+						$this->_req_data['txn_reg_status_change']['send_notifications']
1719 1719
 					) &&
1720
-					filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1720
+					filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1721 1721
 				) {
1722
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
1722
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
1723 1723
 				}
1724 1724
 				break;
1725 1725
 		}
@@ -1735,11 +1735,11 @@  discard block
 block discarded – undo
1735 1735
 	*	@return void
1736 1736
 	*/
1737 1737
 	protected function _send_payment_reminder() {
1738
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1739
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1740
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1741
-		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
1742
-		$this->_redirect_after_action( FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE );
1738
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
1739
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1740
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array();
1741
+		do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction);
1742
+		$this->_redirect_after_action(FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE);
1743 1743
 	}
1744 1744
 
1745 1745
 
@@ -1753,36 +1753,36 @@  discard block
 block discarded – undo
1753 1753
 	 * @param string   $view
1754 1754
 	 * @return mixed int = count || array of transaction objects
1755 1755
 	 */
1756
-	public function get_transactions( $perpage, $count = FALSE, $view = '' ) {
1756
+	public function get_transactions($perpage, $count = FALSE, $view = '') {
1757 1757
 
1758 1758
 		$TXN = EEM_Transaction::instance();
1759 1759
 
1760
-	    $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1761
-	    $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1760
+	    $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year'));
1761
+	    $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y');
1762 1762
 
1763 1763
 	    //make sure our timestamps start and end right at the boundaries for each day
1764
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1765
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1764
+	    $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
1765
+	    $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
1766 1766
 
1767 1767
 
1768 1768
 	    //convert to timestamps
1769
-	    $start_date = strtotime( $start_date );
1770
-	    $end_date = strtotime( $end_date );
1769
+	    $start_date = strtotime($start_date);
1770
+	    $end_date = strtotime($end_date);
1771 1771
 
1772 1772
 	    //makes sure start date is the lowest value and vice versa
1773
-	    $start_date = min( $start_date, $end_date );
1774
-	    $end_date = max( $start_date, $end_date );
1773
+	    $start_date = min($start_date, $end_date);
1774
+	    $end_date = max($start_date, $end_date);
1775 1775
 
1776 1776
 	    //convert to correct format for query
1777
-	$start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
1778
-	$end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
1777
+	$start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s');
1778
+	$end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s');
1779 1779
 
1780 1780
 
1781 1781
 
1782 1782
 	    //set orderby
1783 1783
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1784 1784
 
1785
-		switch ( $this->_req_data['orderby'] ) {
1785
+		switch ($this->_req_data['orderby']) {
1786 1786
 			case 'TXN_ID':
1787 1787
 				$orderby = 'TXN_ID';
1788 1788
 				break;
@@ -1796,66 +1796,66 @@  discard block
 block discarded – undo
1796 1796
 				$orderby = 'TXN_timestamp';
1797 1797
 		}
1798 1798
 
1799
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
1800
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1801
-		$per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10;
1802
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1799
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
1800
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1801
+		$per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10;
1802
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1803 1803
 
1804
-		$offset = ($current_page-1)*$per_page;
1805
-		$limit = array( $offset, $per_page );
1804
+		$offset = ($current_page - 1) * $per_page;
1805
+		$limit = array($offset, $per_page);
1806 1806
 
1807 1807
 		$_where = array(
1808
-			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ),
1808
+			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)),
1809 1809
 			'Registration.REG_count' => 1
1810 1810
 		);
1811 1811
 
1812
-		if ( isset( $this->_req_data['EVT_ID'] ) ) {
1812
+		if (isset($this->_req_data['EVT_ID'])) {
1813 1813
 			$_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID'];
1814 1814
 		}
1815 1815
 
1816
-		if ( isset( $this->_req_data['s'] ) ) {
1817
-			$search_string = '%' . $this->_req_data['s'] . '%';
1816
+		if (isset($this->_req_data['s'])) {
1817
+			$search_string = '%'.$this->_req_data['s'].'%';
1818 1818
 			$_where['OR'] = array(
1819
-				'Registration.Event.EVT_name' => array( 'LIKE', $search_string ),
1820
-				'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ),
1821
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ),
1822
-				'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ),
1823
-				'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ),
1824
-				'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ),
1825
-				'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ),
1826
-				'Registration.Attendee.ATT_email' => array('LIKE', $search_string ),
1827
-				'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ),
1828
-				'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ),
1829
-				'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ),
1830
-				'Registration.REG_final_price' => array( 'LIKE', $search_string ),
1831
-				'Registration.REG_code' => array( 'LIKE', $search_string ),
1832
-				'Registration.REG_count' => array( 'LIKE' , $search_string ),
1833
-				'Registration.REG_group_size' => array( 'LIKE' , $search_string ),
1834
-				'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ),
1835
-				'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ),
1836
-				'Payment.PAY_source' => array('LIKE', $search_string ),
1837
-				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ),
1838
-				'TXN_session_data' => array( 'LIKE', $search_string ),
1839
-				'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string )
1819
+				'Registration.Event.EVT_name' => array('LIKE', $search_string),
1820
+				'Registration.Event.EVT_desc' => array('LIKE', $search_string),
1821
+				'Registration.Event.EVT_short_desc' => array('LIKE', $search_string),
1822
+				'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string),
1823
+				'Registration.Attendee.ATT_fname' => array('LIKE', $search_string),
1824
+				'Registration.Attendee.ATT_lname' => array('LIKE', $search_string),
1825
+				'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string),
1826
+				'Registration.Attendee.ATT_email' => array('LIKE', $search_string),
1827
+				'Registration.Attendee.ATT_address' => array('LIKE', $search_string),
1828
+				'Registration.Attendee.ATT_address2' => array('LIKE', $search_string),
1829
+				'Registration.Attendee.ATT_city' => array('LIKE', $search_string),
1830
+				'Registration.REG_final_price' => array('LIKE', $search_string),
1831
+				'Registration.REG_code' => array('LIKE', $search_string),
1832
+				'Registration.REG_count' => array('LIKE', $search_string),
1833
+				'Registration.REG_group_size' => array('LIKE', $search_string),
1834
+				'Registration.Ticket.TKT_name' => array('LIKE', $search_string),
1835
+				'Registration.Ticket.TKT_description' => array('LIKE', $search_string),
1836
+				'Payment.PAY_source' => array('LIKE', $search_string),
1837
+				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string),
1838
+				'TXN_session_data' => array('LIKE', $search_string),
1839
+				'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string)
1840 1840
 				);
1841 1841
 		}
1842 1842
 
1843 1843
 		//failed transactions
1844
-		$failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE;
1845
-		$abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE;
1844
+		$failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE: FALSE;
1845
+		$abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE: FALSE;
1846 1846
 
1847
-		if ( $failed ) {
1848
-			$_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code;
1849
-		} else if ( $abandoned ) {
1847
+		if ($failed) {
1848
+			$_where['STS_ID'] = EEM_Transaction::failed_status_code;
1849
+		} else if ($abandoned) {
1850 1850
 				$_where['STS_ID'] = EEM_Transaction::abandoned_status_code;
1851 1851
 		} else {
1852
-				$_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code );
1853
-				$_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code );
1852
+				$_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code);
1853
+				$_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code);
1854 1854
 		}
1855 1855
 
1856
-		$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit );
1856
+		$query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit);
1857 1857
 
1858
-		$transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params);
1858
+		$transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params);
1859 1859
 
1860 1860
 
1861 1861
 		return $transactions;
Please login to merge, or discard this patch.
core/EE_Registry.core.php 1 patch
Spacing   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 	 * @param  \EE_Dependency_Map $dependency_map
185 185
 	 * @return \EE_Registry instance
186 186
 	 */
187
-	public static function instance( \EE_Dependency_Map $dependency_map = null ) {
187
+	public static function instance(\EE_Dependency_Map $dependency_map = null) {
188 188
 		// check if class object is instantiated
189
-		if ( ! self::$_instance instanceof EE_Registry ) {
190
-			self::$_instance = new EE_Registry( $dependency_map );
189
+		if ( ! self::$_instance instanceof EE_Registry) {
190
+			self::$_instance = new EE_Registry($dependency_map);
191 191
 		}
192 192
 		return self::$_instance;
193 193
 	}
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
 	 * @param  \EE_Dependency_Map $dependency_map
203 203
 	 * @return \EE_Registry
204 204
 	 */
205
-	protected function __construct( \EE_Dependency_Map $dependency_map ) {
205
+	protected function __construct(\EE_Dependency_Map $dependency_map) {
206 206
 		$this->_dependency_map = $dependency_map;
207
-		add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) );
207
+		add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize'));
208 208
 	}
209 209
 
210 210
 
@@ -232,19 +232,19 @@  discard block
 block discarded – undo
232 232
 		$this->modules = new stdClass();
233 233
 		$this->shortcodes = new stdClass();
234 234
 		$this->widgets = new stdClass();
235
-		$this->load_core( 'Base', array(), true );
235
+		$this->load_core('Base', array(), true);
236 236
 		// add our request and response objects to the cache
237
-		$request_loader = $this->_dependency_map->class_loader( 'EE_Request' );
237
+		$request_loader = $this->_dependency_map->class_loader('EE_Request');
238 238
 		$this->_set_cached_class(
239 239
 			$request_loader(),
240 240
 			'EE_Request'
241 241
 		);
242
-		$response_loader = $this->_dependency_map->class_loader( 'EE_Response' );
242
+		$response_loader = $this->_dependency_map->class_loader('EE_Response');
243 243
 		$this->_set_cached_class(
244 244
 			$response_loader(),
245 245
 			'EE_Response'
246 246
 		);
247
-		add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' ) );
247
+		add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init'));
248 248
 	}
249 249
 
250 250
 
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	public function init() {
259 259
 		// Get current page protocol
260
-		$protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://';
260
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
261 261
 		// Output admin-ajax.php URL with same protocol as current page
262
-		self::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php', $protocol );
263
-		self::$i18n_js_strings[ 'wp_debug' ] = defined( 'WP_DEBUG' ) ? WP_DEBUG : false;
262
+		self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol);
263
+		self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : false;
264 264
 	}
265 265
 
266 266
 
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
 	 * @return string
272 272
 	 */
273 273
 	public static function localize_i18n_js_strings() {
274
-		$i18n_js_strings = (array)EE_Registry::$i18n_js_strings;
275
-		foreach ( $i18n_js_strings as $key => $value ) {
276
-			if ( is_scalar( $value ) ) {
277
-				$i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' );
274
+		$i18n_js_strings = (array) EE_Registry::$i18n_js_strings;
275
+		foreach ($i18n_js_strings as $key => $value) {
276
+			if (is_scalar($value)) {
277
+				$i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
278 278
 			}
279 279
 		}
280 280
 
281
-		return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */';
281
+		return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */';
282 282
 	}
283 283
 
284 284
 
@@ -286,15 +286,15 @@  discard block
 block discarded – undo
286 286
 	/**
287 287
 	 * @param mixed string | EED_Module $module
288 288
 	 */
289
-	public function add_module( $module ) {
290
-		if ( $module instanceof EED_Module ) {
291
-			$module_class = get_class( $module );
289
+	public function add_module($module) {
290
+		if ($module instanceof EED_Module) {
291
+			$module_class = get_class($module);
292 292
 			$this->modules->{$module_class} = $module;
293 293
 		} else {
294
-			if ( ! class_exists( 'EE_Module_Request_Router' ) ) {
295
-				$this->load_core( 'Module_Request_Router' );
294
+			if ( ! class_exists('EE_Module_Request_Router')) {
295
+				$this->load_core('Module_Request_Router');
296 296
 			}
297
-			$this->modules->{$module} = EE_Module_Request_Router::module_factory( $module );
297
+			$this->modules->{$module} = EE_Module_Request_Router::module_factory($module);
298 298
 		}
299 299
 	}
300 300
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	 * @param string $module_name
305 305
 	 * @return mixed EED_Module | NULL
306 306
 	 */
307
-	public function get_module( $module_name = '' ) {
308
-		return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : null;
307
+	public function get_module($module_name = '') {
308
+		return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : null;
309 309
 	}
310 310
 
311 311
 
@@ -319,20 +319,20 @@  discard block
 block discarded – undo
319 319
 	 * @param bool $load_only
320 320
 	 * @return mixed
321 321
 	 */
322
-	public function load_core( $class_name, $arguments = array(), $load_only = false ) {
322
+	public function load_core($class_name, $arguments = array(), $load_only = false) {
323 323
 		$core_paths = apply_filters(
324 324
 			'FHEE__EE_Registry__load_core__core_paths',
325 325
 			array(
326 326
 				EE_CORE,
327 327
 				EE_ADMIN,
328 328
 				EE_CPTS,
329
-				EE_CORE . 'data_migration_scripts' . DS,
330
-				EE_CORE . 'request_stack' . DS,
331
-				EE_CORE . 'middleware' . DS,
329
+				EE_CORE.'data_migration_scripts'.DS,
330
+				EE_CORE.'request_stack'.DS,
331
+				EE_CORE.'middleware'.DS,
332 332
 			)
333 333
 		);
334 334
 		// retrieve instantiated class
335
-		return $this->_load( $core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only );
335
+		return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only);
336 336
 	}
337 337
 
338 338
 
@@ -346,15 +346,15 @@  discard block
 block discarded – undo
346 346
 	 * @param bool $load_only
347 347
 	 * @return mixed
348 348
 	 */
349
-	public function load_service( $class_name, $arguments = array(), $load_only = false ) {
349
+	public function load_service($class_name, $arguments = array(), $load_only = false) {
350 350
 		$service_paths = apply_filters(
351 351
 			'FHEE__EE_Registry__load_service__service_paths',
352 352
 			array(
353
-				EE_CORE . 'services' . DS,
353
+				EE_CORE.'services'.DS,
354 354
 			)
355 355
 		);
356 356
 		// retrieve instantiated class
357
-		return $this->_load( $service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only );
357
+		return $this->_load($service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only);
358 358
 	}
359 359
 
360 360
 
@@ -367,9 +367,9 @@  discard block
 block discarded – undo
367 367
 	 * @param mixed $arguments
368 368
 	 * @return EE_Data_Migration_Script_Base|mixed
369 369
 	 */
370
-	public function load_dms( $class_name, $arguments = array() ) {
370
+	public function load_dms($class_name, $arguments = array()) {
371 371
 		// retrieve instantiated class
372
-		return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false );
372
+		return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false);
373 373
 	}
374 374
 
375 375
 
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
 	 * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default)
385 385
 	 * @return EE_Base_Class | bool
386 386
 	 */
387
-	public function load_class( $class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false ) {
388
-		$paths = apply_filters( 'FHEE__EE_Registry__load_class__paths', array(
387
+	public function load_class($class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false) {
388
+		$paths = apply_filters('FHEE__EE_Registry__load_class__paths', array(
389 389
 			EE_CORE,
390 390
 			EE_CLASSES,
391 391
 			EE_BUSINESS
392
-		) );
392
+		));
393 393
 		// retrieve instantiated class
394
-		return $this->_load( $paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only );
394
+		return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only);
395 395
 	}
396 396
 
397 397
 
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 	 * @param bool $load_only
405 405
 	 * @return EEH_Base | bool
406 406
 	 */
407
-	public function load_helper( $class_name, $arguments = array(), $load_only = true ) {
407
+	public function load_helper($class_name, $arguments = array(), $load_only = true) {
408 408
 		// todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed
409
-		$helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array( EE_HELPERS ) );
409
+		$helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS));
410 410
 		// retrieve instantiated class
411
-		return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only );
411
+		return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only);
412 412
 	}
413 413
 
414 414
 
@@ -423,16 +423,16 @@  discard block
 block discarded – undo
423 423
 	 * @param bool $cache  whether to cache the object or not.
424 424
 	 * @return mixed
425 425
 	 */
426
-	public function load_lib( $class_name, $arguments = array(), $load_only = false, $cache = true ) {
426
+	public function load_lib($class_name, $arguments = array(), $load_only = false, $cache = true) {
427 427
 		$paths = array(
428 428
 			EE_LIBRARIES,
429
-			EE_LIBRARIES . 'messages' . DS,
430
-			EE_LIBRARIES . 'shortcodes' . DS,
431
-			EE_LIBRARIES . 'qtips' . DS,
432
-			EE_LIBRARIES . 'payment_methods' . DS,
429
+			EE_LIBRARIES.'messages'.DS,
430
+			EE_LIBRARIES.'shortcodes'.DS,
431
+			EE_LIBRARIES.'qtips'.DS,
432
+			EE_LIBRARIES.'payment_methods'.DS,
433 433
 		);
434 434
 		// retrieve instantiated class
435
-		return $this->_load( $paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only );
435
+		return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only);
436 436
 	}
437 437
 
438 438
 
@@ -445,13 +445,13 @@  discard block
 block discarded – undo
445 445
 	 * @param bool $load_only
446 446
 	 * @return EEM_Base | bool
447 447
 	 */
448
-	public function load_model( $class_name, $arguments = array(), $load_only = false ) {
449
-		$paths = apply_filters( 'FHEE__EE_Registry__load_model__paths', array(
448
+	public function load_model($class_name, $arguments = array(), $load_only = false) {
449
+		$paths = apply_filters('FHEE__EE_Registry__load_model__paths', array(
450 450
 			EE_MODELS,
451 451
 			EE_CORE
452
-		) );
452
+		));
453 453
 		// retrieve instantiated class
454
-		return $this->_load( $paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only );
454
+		return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only);
455 455
 	}
456 456
 
457 457
 
@@ -464,15 +464,15 @@  discard block
 block discarded – undo
464 464
 	 * @param bool $load_only
465 465
 	 * @return mixed | bool
466 466
 	 */
467
-	public function load_model_class( $class_name, $arguments = array(), $load_only = true ) {
467
+	public function load_model_class($class_name, $arguments = array(), $load_only = true) {
468 468
 		$paths = array(
469
-			EE_MODELS . 'fields' . DS,
470
-			EE_MODELS . 'helpers' . DS,
471
-			EE_MODELS . 'relations' . DS,
472
-			EE_MODELS . 'strategies' . DS
469
+			EE_MODELS.'fields'.DS,
470
+			EE_MODELS.'helpers'.DS,
471
+			EE_MODELS.'relations'.DS,
472
+			EE_MODELS.'strategies'.DS
473 473
 		);
474 474
 		// retrieve instantiated class
475
-		return $this->_load( $paths, 'EE_', $class_name, '', $arguments, false, true, $load_only );
475
+		return $this->_load($paths, 'EE_', $class_name, '', $arguments, false, true, $load_only);
476 476
 	}
477 477
 
478 478
 
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 	 * @param string $model_name like Event, Attendee, Question_Group_Question, etc.
483 483
 	 * @return boolean
484 484
 	 */
485
-	public function is_model_name( $model_name ) {
486
-		return isset( $this->models[ $model_name ] ) ? true : false;
485
+	public function is_model_name($model_name) {
486
+		return isset($this->models[$model_name]) ? true : false;
487 487
 	}
488 488
 
489 489
 
@@ -498,9 +498,9 @@  discard block
 block discarded – undo
498 498
 	 * @param bool $load_only
499 499
 	 * @return mixed
500 500
 	 */
501
-	public function load_file( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true ) {
501
+	public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true) {
502 502
 		// retrieve instantiated class
503
-		return $this->_load( $path_to_file, '', $file_name, $type, $arguments, false, true, $load_only );
503
+		return $this->_load($path_to_file, '', $file_name, $type, $arguments, false, true, $load_only);
504 504
 	}
505 505
 
506 506
 
@@ -515,9 +515,9 @@  discard block
 block discarded – undo
515 515
 	 * @param bool $load_only
516 516
 	 * @return EE_Addon
517 517
 	 */
518
-	public function load_addon( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false ) {
518
+	public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false) {
519 519
 		// retrieve instantiated class
520
-		return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only );
520
+		return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only);
521 521
 	}
522 522
 
523 523
 
@@ -548,35 +548,35 @@  discard block
 block discarded – undo
548 548
 		$load_only = false,
549 549
 		$addon = false
550 550
 	) {
551
-		$class_name = $this->_dependency_map->get_alias( $class_name );
552
-		if ( ! class_exists( $class_name ) ) {
551
+		$class_name = $this->_dependency_map->get_alias($class_name);
552
+		if ( ! class_exists($class_name)) {
553 553
 			// maybe the class is registered with a preceding \
554
-			$class_name = strpos( $class_name, '\\' ) !== 0 ? '\\' . $class_name : $class_name;
554
+			$class_name = strpos($class_name, '\\') !== 0 ? '\\'.$class_name : $class_name;
555 555
 			// still doesn't exist ?
556
-			if ( ! class_exists( $class_name ) ) {
556
+			if ( ! class_exists($class_name)) {
557 557
 				return null;
558 558
 			}
559 559
 		}
560 560
 		// if we're only loading the class and it already exists, then let's just return true immediately
561
-		if ( $load_only ) {
561
+		if ($load_only) {
562 562
 			return true;
563 563
 		}
564 564
 		$addon = $addon ? 'addon' : '';
565 565
 		// $this->_cache_on is toggled during the recursive loading that can occur with dependency injection
566 566
 		// $cache is controlled by individual calls to separate Registry loader methods like load_class()
567 567
 		// $load_only is also controlled by individual calls to separate Registry loader methods like load_file()
568
-		if ( $this->_cache_on && $cache && ! $load_only ) {
568
+		if ($this->_cache_on && $cache && ! $load_only) {
569 569
 			// return object if it's already cached
570
-			$cached_class = $this->_get_cached_class( $class_name, $addon );
571
-			if ( $cached_class !== null ) {
570
+			$cached_class = $this->_get_cached_class($class_name, $addon);
571
+			if ($cached_class !== null) {
572 572
 				return $cached_class;
573 573
 			}
574 574
 		}
575 575
 		// instantiate the requested object
576
-		$class_obj = $this->_create_object( $class_name, $arguments, $addon, $from_db );
577
-		if ( $this->_cache_on && $cache ) {
576
+		$class_obj = $this->_create_object($class_name, $arguments, $addon, $from_db);
577
+		if ($this->_cache_on && $cache) {
578 578
 			// save it for later... kinda like gum  { : $
579
-			$this->_set_cached_class( $class_obj, $class_name, $addon, $from_db );
579
+			$this->_set_cached_class($class_obj, $class_name, $addon, $from_db);
580 580
 		}
581 581
 		$this->_cache_on = true;
582 582
 		return $class_obj;
@@ -611,47 +611,47 @@  discard block
 block discarded – undo
611 611
 		$load_only = false
612 612
 	) {
613 613
 		// strip php file extension
614
-		$class_name = str_replace( '.php', '', trim( $class_name ) );
614
+		$class_name = str_replace('.php', '', trim($class_name));
615 615
 		// does the class have a prefix ?
616
-		if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) {
616
+		if ( ! empty($class_prefix) && $class_prefix != 'addon') {
617 617
 			// make sure $class_prefix is uppercase
618
-			$class_prefix = strtoupper( trim( $class_prefix ) );
618
+			$class_prefix = strtoupper(trim($class_prefix));
619 619
 			// add class prefix ONCE!!!
620
-			$class_name = $class_prefix . str_replace( $class_prefix, '', $class_name );
620
+			$class_name = $class_prefix.str_replace($class_prefix, '', $class_name);
621 621
 		}
622
-		$class_name = $this->_dependency_map->get_alias( $class_name );
623
-		$class_exists = class_exists( $class_name );
622
+		$class_name = $this->_dependency_map->get_alias($class_name);
623
+		$class_exists = class_exists($class_name);
624 624
 		// if we're only loading the class and it already exists, then let's just return true immediately
625
-		if ( $load_only && $class_exists ) {
625
+		if ($load_only && $class_exists) {
626 626
 			return true;
627 627
 		}
628 628
 		// $this->_cache_on is toggled during the recursive loading that can occur with dependency injection
629 629
 		// $cache is controlled by individual calls to separate Registry loader methods like load_class()
630 630
 		// $load_only is also controlled by individual calls to separate Registry loader methods like load_file()
631
-		if ( $this->_cache_on && $cache && ! $load_only ) {
631
+		if ($this->_cache_on && $cache && ! $load_only) {
632 632
 			// return object if it's already cached
633
-			$cached_class = $this->_get_cached_class( $class_name, $class_prefix );
634
-			if ( $cached_class !== null ) {
633
+			$cached_class = $this->_get_cached_class($class_name, $class_prefix);
634
+			if ($cached_class !== null) {
635 635
 				return $cached_class;
636 636
 			}
637 637
 		}
638 638
 		// if the class doesn't already exist.. then we need to try and find the file and load it
639
-		if ( ! $class_exists ) {
639
+		if ( ! $class_exists) {
640 640
 			// get full path to file
641
-			$path = $this->_resolve_path( $class_name, $type, $file_paths );
641
+			$path = $this->_resolve_path($class_name, $type, $file_paths);
642 642
 			// load the file
643
-			$loaded = $this->_require_file( $path, $class_name, $type, $file_paths );
643
+			$loaded = $this->_require_file($path, $class_name, $type, $file_paths);
644 644
 			// if loading failed, or we are only loading a file but NOT instantiating an object
645
-			if ( ! $loaded || $load_only ) {
645
+			if ( ! $loaded || $load_only) {
646 646
 				// return boolean if only loading, or null if an object was expected
647 647
 				return $load_only ? $loaded : null;
648 648
 			}
649 649
 		}
650 650
 		// instantiate the requested object
651
-		$class_obj = $this->_create_object( $class_name, $arguments, $type, $from_db );
652
-		if ( $this->_cache_on && $cache ) {
651
+		$class_obj = $this->_create_object($class_name, $arguments, $type, $from_db);
652
+		if ($this->_cache_on && $cache) {
653 653
 			// save it for later... kinda like gum  { : $
654
-			$this->_set_cached_class( $class_obj, $class_name, $class_prefix, $from_db );
654
+			$this->_set_cached_class($class_obj, $class_name, $class_prefix, $from_db);
655 655
 		}
656 656
 		$this->_cache_on = true;
657 657
 		return $class_obj;
@@ -674,21 +674,21 @@  discard block
 block discarded – undo
674 674
 	 * @param string $class_prefix
675 675
 	 * @return mixed
676 676
 	 */
677
-	protected function _get_cached_class( $class_name, $class_prefix = '' ) {
678
-		if ( isset( $this->_class_abbreviations[ $class_name ] ) ) {
679
-			$class_abbreviation = $this->_class_abbreviations[ $class_name ];
677
+	protected function _get_cached_class($class_name, $class_prefix = '') {
678
+		if (isset($this->_class_abbreviations[$class_name])) {
679
+			$class_abbreviation = $this->_class_abbreviations[$class_name];
680 680
 		} else {
681 681
 			// have to specify something, but not anything that will conflict
682 682
 			$class_abbreviation = 'FANCY_BATMAN_PANTS';
683 683
 		}
684 684
 		// check if class has already been loaded, and return it if it has been
685
-		if ( isset( $this->{$class_abbreviation} ) && ! is_null( $this->{$class_abbreviation} ) ) {
685
+		if (isset($this->{$class_abbreviation} ) && ! is_null($this->{$class_abbreviation} )) {
686 686
 			return $this->{$class_abbreviation};
687
-		} else if ( isset ( $this->{$class_name} ) ) {
687
+		} else if (isset ($this->{$class_name} )) {
688 688
 			return $this->{$class_name};
689
-		} else if ( isset ( $this->LIB->{$class_name} ) ) {
689
+		} else if (isset ($this->LIB->{$class_name} )) {
690 690
 			return $this->LIB->{$class_name};
691
-		} else if ( $class_prefix == 'addon' && isset ( $this->addons->{$class_name} ) ) {
691
+		} else if ($class_prefix == 'addon' && isset ($this->addons->{$class_name} )) {
692 692
 			return $this->addons->{$class_name};
693 693
 		}
694 694
 		return null;
@@ -709,20 +709,20 @@  discard block
 block discarded – undo
709 709
 	 * @param array $file_paths
710 710
 	 * @return string | bool
711 711
 	 */
712
-	protected function _resolve_path( $class_name, $type = '', $file_paths = array() ) {
712
+	protected function _resolve_path($class_name, $type = '', $file_paths = array()) {
713 713
 		// make sure $file_paths is an array
714
-		$file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths );
714
+		$file_paths = is_array($file_paths) ? $file_paths : array($file_paths);
715 715
 		// cycle thru paths
716
-		foreach ( $file_paths as $key => $file_path ) {
716
+		foreach ($file_paths as $key => $file_path) {
717 717
 			// convert all separators to proper DS, if no filepath, then use EE_CLASSES
718
-			$file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES;
718
+			$file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES;
719 719
 			// prep file type
720
-			$type = ! empty( $type ) ? trim( $type, '.' ) . '.' : '';
720
+			$type = ! empty($type) ? trim($type, '.').'.' : '';
721 721
 			// build full file path
722
-			$file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php';
722
+			$file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php';
723 723
 			//does the file exist and can be read ?
724
-			if ( is_readable( $file_paths[ $key ] ) ) {
725
-				return $file_paths[ $key ];
724
+			if (is_readable($file_paths[$key])) {
725
+				return $file_paths[$key];
726 726
 			}
727 727
 		}
728 728
 		return false;
@@ -744,29 +744,29 @@  discard block
 block discarded – undo
744 744
 	 * @return boolean
745 745
 	 * @throws \EE_Error
746 746
 	 */
747
-	protected function _require_file( $path, $class_name, $type = '', $file_paths = array() ) {
747
+	protected function _require_file($path, $class_name, $type = '', $file_paths = array()) {
748 748
 		// don't give up! you gotta...
749 749
 		try {
750 750
 			//does the file exist and can it be read ?
751
-			if ( ! $path ) {
751
+			if ( ! $path) {
752 752
 				// so sorry, can't find the file
753
-				throw new EE_Error (
753
+				throw new EE_Error(
754 754
 					sprintf(
755
-						__( 'The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso' ),
756
-						trim( $type, '.' ),
755
+						__('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'),
756
+						trim($type, '.'),
757 757
 						$class_name,
758
-						'<br />' . implode( ',<br />', $file_paths )
758
+						'<br />'.implode(',<br />', $file_paths)
759 759
 					)
760 760
 				);
761 761
 			}
762 762
 			// get the file
763
-			require_once( $path );
763
+			require_once($path);
764 764
 			// if the class isn't already declared somewhere
765
-			if ( class_exists( $class_name, false ) === false ) {
765
+			if (class_exists($class_name, false) === false) {
766 766
 				// so sorry, not a class
767 767
 				throw new EE_Error(
768 768
 					sprintf(
769
-						__( 'The %s file %s does not appear to contain the %s Class.', 'event_espresso' ),
769
+						__('The %s file %s does not appear to contain the %s Class.', 'event_espresso'),
770 770
 						$type,
771 771
 						$path,
772 772
 						$class_name
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 				);
775 775
 			}
776 776
 
777
-		} catch ( EE_Error $e ) {
777
+		} catch (EE_Error $e) {
778 778
 			$e->get_error();
779 779
 			return false;
780 780
 		}
@@ -806,61 +806,61 @@  discard block
 block discarded – undo
806 806
 	 * @return null | object
807 807
 	 * @throws \EE_Error
808 808
 	 */
809
-	protected function _create_object( $class_name, $arguments = array(), $type = '', $from_db = false ) {
809
+	protected function _create_object($class_name, $arguments = array(), $type = '', $from_db = false) {
810 810
 		$class_obj = null;
811 811
 		$instantiation_mode = '0) none';
812 812
 		// don't give up! you gotta...
813 813
 		try {
814 814
 			// create reflection
815
-			$reflector = $this->get_ReflectionClass( $class_name );
815
+			$reflector = $this->get_ReflectionClass($class_name);
816 816
 			// make sure arguments are an array
817
-			$arguments = is_array( $arguments ) ? $arguments : array( $arguments );
817
+			$arguments = is_array($arguments) ? $arguments : array($arguments);
818 818
 			// and if arguments array is numerically and sequentially indexed, then we want it to remain as is,
819 819
 			// else wrap it in an additional array so that it doesn't get split into multiple parameters
820
-			$arguments = $this->_array_is_numerically_and_sequentially_indexed( $arguments )
820
+			$arguments = $this->_array_is_numerically_and_sequentially_indexed($arguments)
821 821
 				? $arguments
822
-				: array( $arguments );
822
+				: array($arguments);
823 823
 			// attempt to inject dependencies ?
824
-			if ( $this->_dependency_map->has( $class_name ) ) {
825
-				$arguments = $this->_resolve_dependencies( $reflector, $class_name, $arguments );
824
+			if ($this->_dependency_map->has($class_name)) {
825
+				$arguments = $this->_resolve_dependencies($reflector, $class_name, $arguments);
826 826
 			}
827 827
 			// instantiate the class if possible
828
-			if ( $reflector->isAbstract() ) {
828
+			if ($reflector->isAbstract()) {
829 829
 				// nothing to instantiate, loading file was enough
830 830
 				// does not throw an exception so $instantiation_mode is unused
831 831
 				// $instantiation_mode = "1) no constructor abstract class";
832 832
 				$class_obj = true;
833
-			} else if ( $reflector->getConstructor() === null && $reflector->isInstantiable() && empty( $arguments ) ) {
833
+			} else if ($reflector->getConstructor() === null && $reflector->isInstantiable() && empty($arguments)) {
834 834
 				// no constructor = static methods only... nothing to instantiate, loading file was enough
835 835
 				$instantiation_mode = "2) no constructor but instantiable";
836 836
 				$class_obj = $reflector->newInstance();
837
-			} else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) {
837
+			} else if ($from_db && method_exists($class_name, 'new_instance_from_db')) {
838 838
 				$instantiation_mode = "3) new_instance_from_db()";
839
-				$class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments );
840
-			} else if ( method_exists( $class_name, 'new_instance' ) ) {
839
+				$class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments);
840
+			} else if (method_exists($class_name, 'new_instance')) {
841 841
 				$instantiation_mode = "4) new_instance()";
842
-				$class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments );
843
-			} else if ( method_exists( $class_name, 'instance' ) ) {
842
+				$class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments);
843
+			} else if (method_exists($class_name, 'instance')) {
844 844
 				$instantiation_mode = "5) instance()";
845
-				$class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments );
846
-			} else if ( $reflector->isInstantiable() ) {
845
+				$class_obj = call_user_func_array(array($class_name, 'instance'), $arguments);
846
+			} else if ($reflector->isInstantiable()) {
847 847
 				$instantiation_mode = "6) constructor";
848
-				$class_obj = $reflector->newInstanceArgs( $arguments );
848
+				$class_obj = $reflector->newInstanceArgs($arguments);
849 849
 			} else {
850 850
 				// heh ? something's not right !
851 851
 				throw new EE_Error(
852 852
 					sprintf(
853
-						__( 'The %s file %s could not be instantiated.', 'event_espresso' ),
853
+						__('The %s file %s could not be instantiated.', 'event_espresso'),
854 854
 						$type,
855 855
 						$class_name
856 856
 					)
857 857
 				);
858 858
 			}
859
-		} catch ( Exception $e ) {
860
-			if ( ! $e instanceof EE_Error ) {
859
+		} catch (Exception $e) {
860
+			if ( ! $e instanceof EE_Error) {
861 861
 				$e = new EE_Error(
862 862
 					sprintf(
863
-						__( 'The following error occurred while attempting to instantiate "%1$s": %2$s %3$s %2$s instantiation mode : %4$s', 'event_espresso' ),
863
+						__('The following error occurred while attempting to instantiate "%1$s": %2$s %3$s %2$s instantiation mode : %4$s', 'event_espresso'),
864 864
 						$class_name,
865 865
 						'<br />',
866 866
 						$e->getMessage(),
@@ -880,8 +880,8 @@  discard block
 block discarded – undo
880 880
 	 * @param array $array
881 881
 	 * @return bool
882 882
 	 */
883
-	protected function _array_is_numerically_and_sequentially_indexed( array $array ) {
884
-		return ! empty( $array ) ? array_keys( $array ) === range( 0, count( $array ) - 1 ) : true;
883
+	protected function _array_is_numerically_and_sequentially_indexed(array $array) {
884
+		return ! empty($array) ? array_keys($array) === range(0, count($array) - 1) : true;
885 885
 	}
886 886
 
887 887
 
@@ -896,14 +896,14 @@  discard block
 block discarded – undo
896 896
 	 * @param string $class_name
897 897
 	 * @return ReflectionClass
898 898
 	 */
899
-	public function get_ReflectionClass( $class_name ) {
899
+	public function get_ReflectionClass($class_name) {
900 900
 		if (
901
-			! isset( $this->_reflectors[ $class_name ] )
902
-			|| ! $this->_reflectors[ $class_name ] instanceof ReflectionClass
901
+			! isset($this->_reflectors[$class_name])
902
+			|| ! $this->_reflectors[$class_name] instanceof ReflectionClass
903 903
 		) {
904
-			$this->_reflectors[ $class_name ] = new ReflectionClass( $class_name );
904
+			$this->_reflectors[$class_name] = new ReflectionClass($class_name);
905 905
 		}
906
-		return $this->_reflectors[ $class_name ];
906
+		return $this->_reflectors[$class_name];
907 907
 	}
908 908
 
909 909
 
@@ -928,50 +928,50 @@  discard block
 block discarded – undo
928 928
 	 * @return array
929 929
 	 * @throws \ReflectionException
930 930
 	 */
931
-	protected function _resolve_dependencies( ReflectionClass $reflector, $class_name, $arguments = array() ) {
931
+	protected function _resolve_dependencies(ReflectionClass $reflector, $class_name, $arguments = array()) {
932 932
 		// let's examine the constructor
933 933
 		$constructor = $reflector->getConstructor();
934 934
 		// whu? huh? nothing?
935
-		if ( ! $constructor ) {
935
+		if ( ! $constructor) {
936 936
 			return $arguments;
937 937
 		}
938 938
 		// get constructor parameters
939 939
 		$params = $constructor->getParameters();
940 940
 		// and the keys for the incoming arguments array so that we can compare existing arguments with what is expected
941
-		$argument_keys = array_keys( $arguments );
941
+		$argument_keys = array_keys($arguments);
942 942
 		// now loop thru all of the constructors expected parameters
943
-		foreach ( $params as $index => $param ) {
943
+		foreach ($params as $index => $param) {
944 944
 			// is this a dependency for a specific class ?
945 945
 			$param_class = $param->getClass() ? $param->getClass()->name : null;
946 946
 			if (
947 947
 				// param is not even a class
948
-				empty( $param_class )
948
+				empty($param_class)
949 949
 				// and something already exists in the incoming arguments for this param
950
-				&& isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] )
950
+				&& isset($argument_keys[$index], $arguments[$argument_keys[$index]])
951 951
 			) {
952 952
 				// so let's skip this argument and move on to the next
953 953
 				continue;
954 954
 			} else if (
955 955
 				// parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class
956
-				! empty( $param_class )
957
-				&& isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] )
958
-				&& $arguments[ $argument_keys[ $index ] ] instanceof $param_class
956
+				! empty($param_class)
957
+				&& isset($argument_keys[$index], $arguments[$argument_keys[$index]])
958
+				&& $arguments[$argument_keys[$index]] instanceof $param_class
959 959
 			) {
960 960
 				// skip this argument and move on to the next
961 961
 				continue;
962 962
 			} else if (
963 963
 				// parameter is type hinted as a class, and should be injected
964
-				! empty( $param_class )
965
-				&& $this->_dependency_map->has_dependency_for_class( $class_name, $param_class )
964
+				! empty($param_class)
965
+				&& $this->_dependency_map->has_dependency_for_class($class_name, $param_class)
966 966
 			) {
967
-				$arguments = $this->_resolve_dependency( $class_name, $param_class, $arguments, $index );
967
+				$arguments = $this->_resolve_dependency($class_name, $param_class, $arguments, $index);
968 968
 			} else {
969 969
 				try {
970
-					$arguments[ $index ] = $param->getDefaultValue();
971
-				} catch ( ReflectionException $e ) {
970
+					$arguments[$index] = $param->getDefaultValue();
971
+				} catch (ReflectionException $e) {
972 972
 					throw new ReflectionException(
973 973
 						sprintf(
974
-							__( '%1$s for parameter "$%2$s"', 'event_espresso' ),
974
+							__('%1$s for parameter "$%2$s"', 'event_espresso'),
975 975
 							$e->getMessage(),
976 976
 							$param->getName()
977 977
 						)
@@ -993,30 +993,30 @@  discard block
 block discarded – undo
993 993
 	 * @param mixed $index
994 994
 	 * @return array
995 995
 	 */
996
-	protected function _resolve_dependency( $class_name, $param_class , $arguments, $index ) {
996
+	protected function _resolve_dependency($class_name, $param_class, $arguments, $index) {
997 997
 		$dependency = null;
998 998
 		// should dependency be loaded from cache ?
999
-		$cache_on = $this->_dependency_map->loading_strategy_for_class_dependency( $class_name, $param_class )
999
+		$cache_on = $this->_dependency_map->loading_strategy_for_class_dependency($class_name, $param_class)
1000 1000
 		            !== EE_Dependency_Map::load_new_object
1001 1001
 			? true
1002 1002
 			: false;
1003 1003
 		// we might have a dependency...
1004 1004
 		// let's MAYBE try and find it in our cache if that's what's been requested
1005
-		$cached_class = $cache_on ? $this->_get_cached_class( $param_class ) : null;
1005
+		$cached_class = $cache_on ? $this->_get_cached_class($param_class) : null;
1006 1006
 		// and grab it if it exists
1007
-		if ( $cached_class instanceof $param_class ) {
1007
+		if ($cached_class instanceof $param_class) {
1008 1008
 			$dependency = $cached_class;
1009
-		} else if ( $param_class != $class_name ) {
1009
+		} else if ($param_class != $class_name) {
1010 1010
 			// obtain the loader method from the dependency map
1011
-			$loader = $this->_dependency_map->class_loader( $param_class );
1011
+			$loader = $this->_dependency_map->class_loader($param_class);
1012 1012
 			// is loader a custom closure ?
1013
-			if ( $loader instanceof Closure ) {
1013
+			if ($loader instanceof Closure) {
1014 1014
 				$dependency = $loader();
1015 1015
 			} else {
1016 1016
 				// set the cache on property for the recursive loading call
1017 1017
 				$this->_cache_on = $cache_on;
1018 1018
 				// if not, then let's try and load it via the registry
1019
-				if ( method_exists( $this, $loader ) ) {
1019
+				if (method_exists($this, $loader)) {
1020 1020
 					$dependency = $this->{$loader}($param_class);
1021 1021
 				} else {
1022 1022
 					$dependency = $this->create($param_class, array(), $cache_on);
@@ -1024,12 +1024,12 @@  discard block
 block discarded – undo
1024 1024
 			}
1025 1025
 		}
1026 1026
 		// did we successfully find the correct dependency ?
1027
-		if ( $dependency instanceof $param_class ) {
1027
+		if ($dependency instanceof $param_class) {
1028 1028
 			// then let's inject it into the incoming array of arguments at the correct location
1029
-			if ( isset( $argument_keys[ $index ] ) ) {
1030
-				$arguments[ $argument_keys[ $index ] ] = $dependency;
1029
+			if (isset($argument_keys[$index])) {
1030
+				$arguments[$argument_keys[$index]] = $dependency;
1031 1031
 			} else {
1032
-				$arguments[ $index ] = $dependency;
1032
+				$arguments[$index] = $dependency;
1033 1033
 			}
1034 1034
 		}
1035 1035
 		return $arguments;
@@ -1054,19 +1054,19 @@  discard block
 block discarded – undo
1054 1054
 	 * @param bool $from_db
1055 1055
 	 * @return void
1056 1056
 	 */
1057
-	protected function _set_cached_class( $class_obj, $class_name, $class_prefix = '', $from_db = false ) {
1058
-		if ( empty( $class_obj ) ) {
1057
+	protected function _set_cached_class($class_obj, $class_name, $class_prefix = '', $from_db = false) {
1058
+		if (empty($class_obj)) {
1059 1059
 			return;
1060 1060
 		}
1061 1061
 		// return newly instantiated class
1062
-		if ( isset( $this->_class_abbreviations[ $class_name ] ) ) {
1063
-			$class_abbreviation = $this->_class_abbreviations[ $class_name ];
1062
+		if (isset($this->_class_abbreviations[$class_name])) {
1063
+			$class_abbreviation = $this->_class_abbreviations[$class_name];
1064 1064
 			$this->{$class_abbreviation} = $class_obj;
1065
-		} else if ( property_exists( $this, $class_name ) ) {
1065
+		} else if (property_exists($this, $class_name)) {
1066 1066
 			$this->{$class_name} = $class_obj;
1067
-		} else if ( $class_prefix == 'addon' ) {
1067
+		} else if ($class_prefix == 'addon') {
1068 1068
 			$this->addons->{$class_name} = $class_obj;
1069
-		} else if ( ! $from_db ) {
1069
+		} else if ( ! $from_db) {
1070 1070
 			$this->LIB->{$class_name} = $class_obj;
1071 1071
 		}
1072 1072
 	}
@@ -1083,12 +1083,12 @@  discard block
 block discarded – undo
1083 1083
 	 * @param array  $arguments
1084 1084
 	 * @return object
1085 1085
 	 */
1086
-	public static function factory( $classname, $arguments = array() ) {
1087
-		$loader = self::instance()->_dependency_map->class_loader( $classname );
1088
-		if ( $loader instanceof Closure ) {
1089
-			return $loader( $arguments );
1090
-		} else if ( method_exists( EE_Registry::instance(), $loader ) ) {
1091
-			return EE_Registry::instance()->{$loader}( $classname, $arguments );
1086
+	public static function factory($classname, $arguments = array()) {
1087
+		$loader = self::instance()->_dependency_map->class_loader($classname);
1088
+		if ($loader instanceof Closure) {
1089
+			return $loader($arguments);
1090
+		} else if (method_exists(EE_Registry::instance(), $loader)) {
1091
+			return EE_Registry::instance()->{$loader}($classname, $arguments);
1092 1092
 		}
1093 1093
 		return null;
1094 1094
 	}
@@ -1101,9 +1101,9 @@  discard block
 block discarded – undo
1101 1101
 	 * @param string $name
1102 1102
 	 * @return EE_Addon
1103 1103
 	 */
1104
-	public function get_addon_by_name( $name ) {
1105
-		foreach ( $this->addons as $addon ) {
1106
-			if ( $addon->name() == $name ) {
1104
+	public function get_addon_by_name($name) {
1105
+		foreach ($this->addons as $addon) {
1106
+			if ($addon->name() == $name) {
1107 1107
 				return $addon;
1108 1108
 			}
1109 1109
 		}
@@ -1119,8 +1119,8 @@  discard block
 block discarded – undo
1119 1119
 	 */
1120 1120
 	public function get_addons_by_name() {
1121 1121
 		$addons = array();
1122
-		foreach ( $this->addons as $addon ) {
1123
-			$addons[ $addon->name() ] = $addon;
1122
+		foreach ($this->addons as $addon) {
1123
+			$addons[$addon->name()] = $addon;
1124 1124
 		}
1125 1125
 		return $addons;
1126 1126
 	}
@@ -1135,16 +1135,16 @@  discard block
 block discarded – undo
1135 1135
 	 * @return \EEM_Base
1136 1136
 	 * @throws \EE_Error
1137 1137
 	 */
1138
-	public function reset_model( $model_name ) {
1139
-		$model_class_name = strpos( $model_name, 'EEM_' ) !== 0 ? "EEM_{$model_name}" : $model_name;
1140
-		if( ! isset( $this->LIB->{$model_class_name} ) || ! $this->LIB->{$model_class_name} instanceof EEM_Base ) {
1138
+	public function reset_model($model_name) {
1139
+		$model_class_name = strpos($model_name, 'EEM_') !== 0 ? "EEM_{$model_name}" : $model_name;
1140
+		if ( ! isset($this->LIB->{$model_class_name} ) || ! $this->LIB->{$model_class_name} instanceof EEM_Base) {
1141 1141
 			return null;
1142 1142
 		}
1143 1143
 		//get that model reset it and make sure we nuke the old reference to it
1144
-		if ( $this->LIB->{$model_class_name} instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) {
1144
+		if ($this->LIB->{$model_class_name} instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) {
1145 1145
 			$this->LIB->{$model_class_name} = $this->LIB->{$model_class_name}->reset();
1146 1146
 		} else {
1147
-			throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) );
1147
+			throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name));
1148 1148
 		}
1149 1149
 		return $this->LIB->{$model_class_name};
1150 1150
 	}
@@ -1181,22 +1181,22 @@  discard block
 block discarded – undo
1181 1181
 	 *
1182 1182
 	 * @return EE_Registry
1183 1183
 	 */
1184
-	public static function reset( $hard = false, $reinstantiate = true, $reset_models = true ) {
1184
+	public static function reset($hard = false, $reinstantiate = true, $reset_models = true) {
1185 1185
 		$instance = self::instance();
1186 1186
 		EEH_Activation::reset();
1187 1187
 
1188 1188
 		//properties that get reset
1189 1189
 		$instance->_cache_on = true;
1190
-		$instance->CFG = EE_Config::reset( $hard, $reinstantiate );
1190
+		$instance->CFG = EE_Config::reset($hard, $reinstantiate);
1191 1191
 		$instance->CART = null;
1192 1192
 		$instance->MRM = null;
1193 1193
 
1194 1194
 		//messages reset
1195 1195
 		EED_Messages::reset();
1196 1196
 
1197
-		if ( $reset_models ) {
1198
-			foreach ( array_keys( $instance->non_abstract_db_models ) as $model_name ) {
1199
-				$instance->reset_model( $model_name );
1197
+		if ($reset_models) {
1198
+			foreach (array_keys($instance->non_abstract_db_models) as $model_name) {
1199
+				$instance->reset_model($model_name);
1200 1200
 			}
1201 1201
 		}
1202 1202
 
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
 	 * @param $a
1221 1221
 	 * @param $b
1222 1222
 	 */
1223
-	final function __call( $a, $b ) {
1223
+	final function __call($a, $b) {
1224 1224
 	}
1225 1225
 
1226 1226
 
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 	/**
1229 1229
 	 * @param $a
1230 1230
 	 */
1231
-	final function __get( $a ) {
1231
+	final function __get($a) {
1232 1232
 	}
1233 1233
 
1234 1234
 
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
 	 * @param $a
1238 1238
 	 * @param $b
1239 1239
 	 */
1240
-	final function __set( $a, $b ) {
1240
+	final function __set($a, $b) {
1241 1241
 	}
1242 1242
 
1243 1243
 
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 	/**
1246 1246
 	 * @param $a
1247 1247
 	 */
1248
-	final function __isset( $a ) {
1248
+	final function __isset($a) {
1249 1249
 	}
1250 1250
 
1251 1251
 
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
 	/**
1254 1254
 	 * @param $a
1255 1255
 	 */
1256
-	final function __unset( $a ) {
1256
+	final function __unset($a) {
1257 1257
 	}
1258 1258
 
1259 1259
 
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
 	 * @param $a
1301 1301
 	 * @param $b
1302 1302
 	 */
1303
-	final static function __callStatic( $a, $b ) {
1303
+	final static function __callStatic($a, $b) {
1304 1304
 	}
1305 1305
 
1306 1306
 	/**
@@ -1309,9 +1309,9 @@  discard block
 block discarded – undo
1309 1309
 	 */
1310 1310
 	public function cpt_models() {
1311 1311
 		$cpt_models = array();
1312
-		foreach( $this->non_abstract_db_models as $short_name => $classname ) {
1313
-			if( is_subclass_of(  $classname, 'EEM_CPT_Base' ) ) {
1314
-				$cpt_models[ $short_name ] = $classname;
1312
+		foreach ($this->non_abstract_db_models as $short_name => $classname) {
1313
+			if (is_subclass_of($classname, 'EEM_CPT_Base')) {
1314
+				$cpt_models[$short_name] = $classname;
1315 1315
 			}
1316 1316
 		}
1317 1317
 		return $cpt_models;
Please login to merge, or discard this patch.