Completed
Branch BUG-9962-improper-sprintf-usag... (604098)
by
unknown
51:51 queued 34:21
created
templates/thank-you-page-registration-details.template.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,81 +5,81 @@  discard block
 block discarded – undo
5 5
 /** @type string $SPCO_attendee_information_url */
6 6
 ?>
7 7
 <h3 class="ee-registration-details-h3"><?php _e('Registration Details', 'event_espresso'); ?></h3>
8
-<?php  do_action( 'AHEE__thank_you_page_registration_details_template__after_heading' ); ?>
8
+<?php  do_action('AHEE__thank_you_page_registration_details_template__after_heading'); ?>
9 9
 
10 10
 <div class="ee-registration-details-dv">
11 11
 <?php
12 12
 $registrations = $transaction->registrations();
13
-$registrations = is_array( $registrations ) ? $registrations : array();
14
-$reg_count = count( $registrations );
13
+$registrations = is_array($registrations) ? $registrations : array();
14
+$reg_count = count($registrations);
15 15
 $reg_cntr = 0;
16 16
 $event_name = '';
17 17
 $wait_list = false;
18
-foreach ( $registrations as $registration ) {
19
-	if ( $registration instanceof EE_Registration ) {
20
-		if ( $event_name != $registration->event_name() && ! empty( $event_name )) { ?>
18
+foreach ($registrations as $registration) {
19
+	if ($registration instanceof EE_Registration) {
20
+		if ($event_name != $registration->event_name() && ! empty($event_name)) { ?>
21 21
 		</tbody>
22 22
 	</table>
23 23
 		<?php
24 24
 		}
25 25
 		$reg_cntr++;
26
-		if ( $event_name != $registration->event_name() ) {
26
+		if ($event_name != $registration->event_name()) {
27 27
 	?>
28 28
 	<h5>
29
-		<span class="smaller-text grey-text"><?php _e('for','event_espresso');?>: </span> <?php echo htmlentities( $registration->event_name(), ENT_QUOTES, 'UTF-8' );?>
29
+		<span class="smaller-text grey-text"><?php _e('for', 'event_espresso'); ?>: </span> <?php echo htmlentities($registration->event_name(), ENT_QUOTES, 'UTF-8'); ?>
30 30
 	</h5>
31 31
 	<table class='ee-table ee-registrations-list'>
32 32
 		<thead>
33 33
 			<tr>
34 34
 				<th width="40%">
35
-					<?php _e("Registrant Name",'event_espresso')?>
35
+					<?php _e("Registrant Name", 'event_espresso')?>
36 36
 				</th>
37 37
 				<th width="25%" class="jst-left">
38
-					<?php _e("REG Code",'event_espresso');?>
38
+					<?php _e("REG Code", 'event_espresso'); ?>
39 39
 				</th>
40 40
 				<th width="35%" class="jst-left">
41
-					<?php _e("REG Status",'event_espresso');?>
41
+					<?php _e("REG Status", 'event_espresso'); ?>
42 42
 				</th>
43 43
 			</tr>
44 44
 		</thead>
45 45
 		<tbody>
46 46
 	<?php
47 47
 		}
48
-		if ( $is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link() )) { ?>
48
+		if ($is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
49 49
 			<tr>
50 50
 				<td width="40%">
51 51
 				<?php
52
-					if ( $registration->attendee() instanceof EE_Attendee ) {
53
-						echo $registration->attendee()->full_name( TRUE );
52
+					if ($registration->attendee() instanceof EE_Attendee) {
53
+						echo $registration->attendee()->full_name(TRUE);
54 54
 					}
55 55
 				?>
56 56
 					<p class="tiny-text" style="margin: .75em 0 0;">
57 57
 					<?php
58
-					if ( $registration->count_question_groups() ) {
58
+					if ($registration->count_question_groups()) {
59 59
 					?>
60
-						<a class="ee-icon-only-lnk" href="<?php echo $registration->edit_attendee_information_url();?>" title="<?php esc_attr_e('Click here to edit Attendee Information', 'event_espresso');?>"><span class="ee-icon ee-icon-user-edit"></span><?php _e('edit info', 'event_espresso');?></a>
60
+						<a class="ee-icon-only-lnk" href="<?php echo $registration->edit_attendee_information_url(); ?>" title="<?php esc_attr_e('Click here to edit Attendee Information', 'event_espresso'); ?>"><span class="ee-icon ee-icon-user-edit"></span><?php _e('edit info', 'event_espresso'); ?></a>
61 61
 					<?php } ?>
62
-						<a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" href="<?php echo add_query_arg( array( 'token'=>$registration->reg_url_link(), 'resend_reg_confirmation' => 'true' ), EE_Registry::instance()->CFG->core->thank_you_page_url() );?>" title="<?php esc_attr_e('Click here to resend the Registration Confirmation email', 'event_espresso');?>" rel="<?php echo $registration->reg_url_link();?>"><span class="dashicons dashicons-email-alt"></span><?php _e('resend email', 'event_espresso');?></a>
62
+						<a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" href="<?php echo add_query_arg(array('token'=>$registration->reg_url_link(), 'resend_reg_confirmation' => 'true'), EE_Registry::instance()->CFG->core->thank_you_page_url()); ?>" title="<?php esc_attr_e('Click here to resend the Registration Confirmation email', 'event_espresso'); ?>" rel="<?php echo $registration->reg_url_link(); ?>"><span class="dashicons dashicons-email-alt"></span><?php _e('resend email', 'event_espresso'); ?></a>
63 63
 					</p>
64 64
 				</td>
65 65
 				<td width="25%" class="jst-left">
66 66
 					<?php $registration->e('REG_code') ?>
67 67
 				</td>
68 68
 				<td width="35%" class="jst-left">
69
-					<?php $registration->e_pretty_status( TRUE )?>
69
+					<?php $registration->e_pretty_status(TRUE)?>
70 70
 					<?php
71
-						if ( $registration->status_ID() === EEM_Registration::status_id_wait_list ) {
71
+						if ($registration->status_ID() === EEM_Registration::status_id_wait_list) {
72 72
 							$wait_list = true;
73 73
 						}
74 74
 					?>
75 75
 				</td>
76 76
 			</tr>
77
-            <?php  do_action( 'AHEE__thank_you_page_registration_details_template__after_registration_table_row', $registration ); ?>
77
+            <?php  do_action('AHEE__thank_you_page_registration_details_template__after_registration_table_row', $registration); ?>
78 78
         <?php
79 79
 			$event_name = $registration->event_name();
80 80
 
81 81
 		}
82
-		if ( $reg_cntr >= $reg_count ) {
82
+		if ($reg_cntr >= $reg_count) {
83 83
 			?>
84 84
 			</tbody>
85 85
 			</table>
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 	}
89 89
 }
90 90
 ?>
91
-<?php if ( $is_primary && $SPCO_attendee_information_url ) { ?>
91
+<?php if ($is_primary && $SPCO_attendee_information_url) { ?>
92 92
 	<p class="small-text jst-rght">
93 93
 		<a href='<?php echo $SPCO_attendee_information_url?>'><?php _e("Click here to edit All Attendee Information", 'event_espresso'); ?></a>
94 94
 	</p>
95 95
 <?php } ?>
96
-	<?php if ( $wait_list ) { ?>
96
+	<?php if ($wait_list) { ?>
97 97
 
98 98
 			<?php
99 99
 			echo apply_filters(
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	<?php } ?>
114 114
 
115 115
 
116
-	<?php  do_action( 'AHEE__thank_you_page_registration_details_template__after_registration_details' ); ?>
116
+	<?php  do_action('AHEE__thank_you_page_registration_details_template__after_registration_details'); ?>
117 117
 
118 118
 </div>
119 119
 <!-- end of .registration-details -->
Please login to merge, or discard this patch.
admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 1 patch
Spacing   +236 added lines, -236 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -37,20 +37,20 @@  discard block
 block discarded – undo
37 37
 	protected $_reports_template_data = array();
38 38
 
39 39
 
40
-	public function __construct( $routing = TRUE ) {
41
-		parent::__construct( $routing );
42
-		define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
43
-		define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
44
-		define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
40
+	public function __construct($routing = TRUE) {
41
+		parent::__construct($routing);
42
+		define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/');
43
+		define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/');
44
+		define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/');
45 45
 	}
46 46
 
47 47
 
48 48
 	protected function _extend_page_config() {
49
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
49
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations';
50 50
 
51
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
52
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0;
53
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
51
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
52
+		$att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0;
53
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
54 54
 
55 55
 		$new_page_routes = array(
56 56
 			'reports' => array(
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 				)
90 90
 			);
91 91
 
92
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
92
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
93 93
 
94 94
 		$new_page_config = array(
95 95
 			'reports' => array(
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 						'filename' => 'registrations_event_checkin_other'
135 135
 					)
136 136
 				),
137
-				'help_tour' => array( 'Event_Checkin_Help_Tour' ),
138
-				'qtips' => array('Registration_List_Table_Tips' ),
137
+				'help_tour' => array('Event_Checkin_Help_Tour'),
138
+				'qtips' => array('Registration_List_Table_Tips'),
139 139
 				'list_table' => 'EE_Event_Registrations_List_Table',
140 140
 				'metaboxes' => array(),
141 141
 				'require_nonce' => FALSE
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 				),
154 154
 			);
155 155
 
156
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
156
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
157 157
 		$this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
158 158
 		$this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
159 159
 	}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
 	protected function _ajax_hooks() {
164 164
 		parent::_ajax_hooks();
165
-		add_action( 'wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content' ) );
165
+		add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
166 166
 	}
167 167
 
168 168
 
@@ -171,20 +171,20 @@  discard block
 block discarded – undo
171 171
 		parent::load_scripts_styles();
172 172
 
173 173
 		//if newsletter message type is active then let's add filter and load js for it.
174
-		if ( EEH_MSG_Template::is_mt_active('newsletter') ) {
174
+		if (EEH_MSG_Template::is_mt_active('newsletter')) {
175 175
 			//enqueue newsletter js
176
-			wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, TRUE );
177
-			wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION );
176
+			wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE);
177
+			wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION);
178 178
 			//hook in buttons for newsletter message type trigger.
179
-			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 );
179
+			add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10);
180 180
 		}
181 181
 	}
182 182
 
183 183
 
184 184
 
185 185
 	public function load_scripts_styles_reports() {
186
-		wp_register_script( 'ee-reg-reports-js', REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js', array( 'google-charts' ), EVENT_ESPRESSO_VERSION, true );
187
-		wp_enqueue_script( 'ee-reg-reports-js' );
186
+		wp_register_script('ee-reg-reports-js', REG_CAF_ASSETS_URL.'ee-registration-admin-reports.js', array('google-charts'), EVENT_ESPRESSO_VERSION, true);
187
+		wp_enqueue_script('ee-reg-reports-js');
188 188
 		$this->_registration_reports_js_setup();
189 189
 	}
190 190
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 				'slug' => 'all',
217 217
 				'label' => __('All', 'event_espresso'),
218 218
 				'count' => 0,
219
-				'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array(
219
+				'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array(
220 220
 					'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'),
221 221
 					//'trash_registrations' => __('Trash Registrations', 'event_espresso')
222 222
 					)
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 				'slug' => 'all',
235 235
 				'label' => __('All', 'event_espresso'),
236 236
 				'count' => 0,
237
-				'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') )
237
+				'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso'))
238 238
 				),
239 239
 			);
240 240
 	}
@@ -250,20 +250,20 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function get_newsletter_form_content() {
252 252
 		//do a nonce check cause we're not coming in from an normal route here.
253
-		$nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : '';
253
+		$nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : '';
254 254
 		$nonce_ref = 'get_newsletter_form_content_nonce';
255 255
 
256
-		$this->_verify_nonce( $nonce, $nonce_ref );
256
+		$this->_verify_nonce($nonce, $nonce_ref);
257 257
 		//let's get the mtp for the incoming MTP_ ID
258
-		if ( !isset( $this->_req_data['GRP_ID'] ) ) {
259
-			EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
258
+		if ( ! isset($this->_req_data['GRP_ID'])) {
259
+			EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
260 260
 			$this->_template_args['success'] = FALSE;
261 261
 			$this->_template_args['error'] = TRUE;
262 262
 			$this->_return_json();
263 263
 		}
264
-		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] );
265
-		if ( ! $MTPG instanceof EE_Message_Template_Group ) {
266
-			EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__  );
264
+		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
265
+		if ( ! $MTPG instanceof EE_Message_Template_Group) {
266
+			EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__);
267 267
 			$this->_template_args['success'] = FALSE;
268 268
 			$this->_template_args['error'] = TRUE;
269 269
 			$this->_return_json();
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 		$MTPs = $MTPG->context_templates();
273 273
 		$MTPs = $MTPs['attendee'];
274 274
 		$template_fields = array();
275
-		foreach ( $MTPs as $MTP ) {
275
+		foreach ($MTPs as $MTP) {
276 276
 			$field = $MTP->get('MTP_template_field');
277
-			if ( $field == 'content'  ) {
277
+			if ($field == 'content') {
278 278
 				$content = $MTP->get('MTP_content');
279
-				if ( !empty( $content['newsletter_content'] ) ) {
279
+				if ( ! empty($content['newsletter_content'])) {
280 280
 					$template_fields['newsletter_content'] = $content['newsletter_content'];
281 281
 					}
282 282
 				continue;
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		$this->_template_args['data'] = array(
290 290
 			'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '',
291 291
 			'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '',
292
-			'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : ''
292
+			'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : ''
293 293
 			);
294 294
 		$this->_return_json();
295 295
 	}
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 	 * @param EE_Admin_List_Table $list_table
306 306
 	 * @return string html string for extra buttons
307 307
 	 */
308
-	public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) {
309
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) {
308
+	public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) {
309
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) {
310 310
 			return '';
311 311
 		}
312 312
 
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
 			'event_registrations',
316 316
 			'default'
317 317
 			);
318
-		if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to )  ) {
319
-			if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) {
318
+		if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
319
+			if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) {
320 320
 				echo '';
321 321
 			} else {
322
-				$button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' );
323
-				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>';
324
-				add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') );
322
+				$button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>');
323
+				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>';
324
+				add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
325 325
 			}
326 326
 		}
327 327
 	}
@@ -333,37 +333,37 @@  discard block
 block discarded – undo
333 333
 		$list_table = $this->_list_table_object;
334 334
 		$codes = array();
335 335
 		//need to templates for the newsletter message type for the template selector.
336
-		$values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 );
337
-		$mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) );
338
-		foreach ( $mtps as $mtp ) {
336
+		$values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0);
337
+		$mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email')));
338
+		foreach ($mtps as $mtp) {
339 339
 			$name = $mtp->name();
340 340
 			$values[] = array(
341
-				'text' => empty( $name ) ? __('Global', 'event_espresso') : $name,
341
+				'text' => empty($name) ? __('Global', 'event_espresso') : $name,
342 342
 				'id' => $mtp->ID()
343 343
 				);
344 344
 		}
345 345
 
346 346
 		//need to get a list of shortcodes that are available for the newsletter message type.
347
-		$shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE );
348
-		foreach ( $shortcodes as $field => $shortcode_array ) {
349
-			$codes[$field] = implode(', ', array_keys($shortcode_array ) );
347
+		$shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE);
348
+		foreach ($shortcodes as $field => $shortcode_array) {
349
+			$codes[$field] = implode(', ', array_keys($shortcode_array));
350 350
 		}
351 351
 
352 352
 		$shortcodes = $codes;
353 353
 
354
-		$form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
354
+		$form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php';
355 355
 		$form_template_args = array(
356 356
 			'form_action' => admin_url('admin.php?page=espresso_registrations'),
357 357
 			'form_route' => 'newsletter_selected_send',
358 358
 			'form_nonce_name' => 'newsletter_selected_send_nonce',
359
-			'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ),
359
+			'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'),
360 360
 			'redirect_back_to' => $this->_req_action,
361
-			'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'),
362
-			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ),
361
+			'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'),
362
+			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
363 363
 			'shortcodes' => $shortcodes,
364 364
 			'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration'
365 365
 			);
366
-		EEH_Template::display_template( $form_template, $form_template_args );
366
+		EEH_Template::display_template($form_template, $form_template_args);
367 367
 	}
368 368
 
369 369
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 	protected function _newsletter_selected_send() {
379 379
 		$success = TRUE;
380 380
 		//first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
381
-		if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) {
381
+		if (empty($this->_req_data['newsletter_mtp_selected'])) {
382 382
 			EE_Error::add_error(
383 383
 				__(
384 384
 					'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.',
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 			$success = FALSE;
390 390
 		}
391 391
 
392
-		if ( $success ) {
392
+		if ($success) {
393 393
 			//update Message template in case there are any changes
394 394
 			$Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID(
395 395
 				$this->_req_data['newsletter_mtp_selected']
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 			$Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group
398 398
 				? $Message_Template_Group->context_templates()
399 399
 				: array();
400
-			if ( empty( $Message_Templates ) ) {
400
+			if (empty($Message_Templates)) {
401 401
 				EE_Error::add_error(
402 402
 					__(
403 403
 						'Unable to retrieve message template fields from the db. Messages not sent.',
@@ -408,25 +408,25 @@  discard block
 block discarded – undo
408 408
 			}
409 409
 
410 410
 			//let's just update the specific fields
411
-			foreach ( $Message_Templates['attendee'] as $Message_Template ) {
412
-				if ( $Message_Template instanceof EE_Message_Template ) {
413
-					$field = $Message_Template->get( 'MTP_template_field' );
414
-					$content = $Message_Template->get( 'MTP_content' );
411
+			foreach ($Message_Templates['attendee'] as $Message_Template) {
412
+				if ($Message_Template instanceof EE_Message_Template) {
413
+					$field = $Message_Template->get('MTP_template_field');
414
+					$content = $Message_Template->get('MTP_content');
415 415
 					$new_content = $content;
416
-					switch ( $field ) {
416
+					switch ($field) {
417 417
 						case 'from' :
418
-							$new_content = ! empty( $this->_req_data['batch_message']['from'] )
418
+							$new_content = ! empty($this->_req_data['batch_message']['from'])
419 419
 								? $this->_req_data['batch_message']['from']
420 420
 								: $content;
421 421
 							break;
422 422
 						case 'subject' :
423
-							$new_content = ! empty( $this->_req_data['batch_message']['subject'] )
423
+							$new_content = ! empty($this->_req_data['batch_message']['subject'])
424 424
 								? $this->_req_data['batch_message']['subject']
425 425
 								: $content;
426 426
 							break;
427 427
 						case 'content' :
428 428
 							$new_content = $content;
429
-							$new_content['newsletter_content'] = ! empty( $this->_req_data['batch_message']['content'] )
429
+							$new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content'])
430 430
 								? $this->_req_data['batch_message']['content']
431 431
 								: $content['newsletter_content'];
432 432
 							break;
@@ -434,35 +434,35 @@  discard block
 block discarded – undo
434 434
 							continue;
435 435
 							break;
436 436
 					}
437
-					$Message_Template->set( 'MTP_content', $new_content );
437
+					$Message_Template->set('MTP_content', $new_content);
438 438
 					$Message_Template->save();
439 439
 				}
440 440
 			}
441 441
 
442 442
 			//great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
443
-			$id_type = ! empty( $this->_req_data['batch_message']['id_type'] )
443
+			$id_type = ! empty($this->_req_data['batch_message']['id_type'])
444 444
 				? $this->_req_data['batch_message']['id_type']
445 445
 				: 'registration';
446 446
 
447 447
 			//id_type will affect how we assemble the ids.
448
-			$ids = ! empty( $this->_req_data['batch_message']['ids'] )
449
-				? json_decode( stripslashes($this->_req_data['batch_message']['ids']) )
448
+			$ids = ! empty($this->_req_data['batch_message']['ids'])
449
+				? json_decode(stripslashes($this->_req_data['batch_message']['ids']))
450 450
 				: array();
451 451
 
452 452
 			$registrations_used_for_contact_data = array();
453 453
 			//using switch because eventually we'll have other contexts that will be used for generating messages.
454
-			switch ( $id_type ) {
454
+			switch ($id_type) {
455 455
 				case 'registration' :
456 456
 					$registrations_used_for_contact_data = EEM_Registration::instance()->get_all(
457 457
 						array(
458 458
 							array(
459
-								'REG_ID' => array( 'IN', $ids )
459
+								'REG_ID' => array('IN', $ids)
460 460
 							)
461 461
 						)
462 462
 					);
463 463
 					break;
464 464
 				case 'contact' :
465
-					$registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts( $ids );
465
+					$registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts($ids);
466 466
 					break;
467 467
 			}
468 468
 			do_action(
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
 			//kept for backward compat, internally we no longer use this action.
474 474
 			//@deprecated 4.8.36.rc.002
475 475
 			$contacts = $id_type == 'registration'
476
-				? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids )
477
-				: EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) );
476
+				? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids)
477
+				: EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
478 478
 			do_action(
479 479
 				'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send',
480 480
 				$contacts,
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
 			);
483 483
 		}
484 484
 		$query_args = array(
485
-			'action' => !empty( $this->_req_data['redirect_back_to'] )
485
+			'action' => ! empty($this->_req_data['redirect_back_to'])
486 486
 				? $this->_req_data['redirect_back_to']
487 487
 				: 'default'
488 488
 			);
489
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
489
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
490 490
 	}
491 491
 
492 492
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	*		@return void
509 509
 	*/
510 510
 	protected function _registration_reports() {
511
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
512
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, true );
511
+		$template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
512
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_reports_template_data, true);
513 513
 		// the final template wrapper
514 514
 		$this->display_admin_page_with_no_sidebar();
515 515
 
@@ -522,28 +522,28 @@  discard block
 block discarded – undo
522 522
 	 *
523 523
 	 * @return string
524 524
 	 */
525
-	private function _registrations_per_day_report( $period = '-1 month' ) {
525
+	private function _registrations_per_day_report($period = '-1 month') {
526 526
 		$report_ID = 'reg-admin-registrations-per-day-report-dv';
527 527
 
528
-		$results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report( $period );
528
+		$results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period);
529 529
 
530 530
 		$results = (array) $results;
531 531
 		$regs = array();
532 532
 		$subtitle = '';
533 533
 
534
-		if( $results ) {
534
+		if ($results) {
535 535
 			$column_titles = array();
536 536
 			$tracker = 0;
537
-			foreach ( $results as $result ) {
537
+			foreach ($results as $result) {
538 538
 				$report_column_values = array();
539
-				foreach( $result as $property_name => $property_value ) {
539
+				foreach ($result as $property_name => $property_value) {
540 540
 					$property_value = $property_name == 'Registration_REG_date' ? $property_value : (int) $property_value;
541 541
 					$report_column_values[] = $property_value;
542
-					if ( $tracker === 0 ) {
543
-						if ( $property_name == 'Registration_REG_date' ) {
544
-							$column_titles[] = __( 'Date (only days with registrations are shown)', 'event_espresso' );
542
+					if ($tracker === 0) {
543
+						if ($property_name == 'Registration_REG_date') {
544
+							$column_titles[] = __('Date (only days with registrations are shown)', 'event_espresso');
545 545
 						} else {
546
-							$column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' );
546
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
547 547
 						}
548 548
 					}
549 549
 				}
@@ -552,36 +552,36 @@  discard block
 block discarded – undo
552 552
 			}
553 553
 
554 554
 			//make sure the column_titles is pushed to the beginning of the array
555
-			array_unshift( $regs, $column_titles );
555
+			array_unshift($regs, $column_titles);
556 556
 			//setup the date range.
557
-			$DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() );
558
-			$beginning_date = new DateTime( "now " . $period, $DateTimeZone );
559
-			$ending_date = new DateTime( "now", $DateTimeZone );
557
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
558
+			$beginning_date = new DateTime("now ".$period, $DateTimeZone);
559
+			$ending_date = new DateTime("now", $DateTimeZone);
560 560
 			$subtitle = sprintf(
561
-				_x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ),
562
-				$beginning_date->format( 'Y-m-d' ),
563
-				$ending_date->format( 'Y-m-d' )
561
+				_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
562
+				$beginning_date->format('Y-m-d'),
563
+				$ending_date->format('Y-m-d')
564 564
 			);
565 565
 		}
566 566
 
567
-		$report_title = __( 'Total Registrations per Day', 'event_espresso' );
567
+		$report_title = __('Total Registrations per Day', 'event_espresso');
568 568
 
569 569
 		$report_params = array(
570 570
 			'title' 	=> $report_title,
571 571
 			'subtitle' => $subtitle,
572 572
 			'id' 		=> $report_ID,
573 573
 			'regs' 	=> $regs,
574
-			'noResults' => empty( $regs ),
574
+			'noResults' => empty($regs),
575 575
 			'noRegsMsg' => sprintf(
576 576
 				__(
577 577
 					'%sThere are currently no registration records in the last month for this report.%s',
578 578
 					'event_espresso'
579 579
 				),
580
-				'<h2>' . $report_title . '</h2><p>',
580
+				'<h2>'.$report_title.'</h2><p>',
581 581
 				'</p>'
582 582
 			),
583 583
 		);
584
-		wp_localize_script( 'ee-reg-reports-js', 'regPerDay', $report_params );
584
+		wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params);
585 585
 
586 586
 		return $report_ID;
587 587
 	}
@@ -593,29 +593,29 @@  discard block
 block discarded – undo
593 593
 	 *
594 594
 	 * @return string
595 595
 	 */
596
-	private function _registrations_per_event_report( $period = '-1 month' ) {
596
+	private function _registrations_per_event_report($period = '-1 month') {
597 597
 
598 598
 		$report_ID = 'reg-admin-registrations-per-event-report-dv';
599 599
 
600
-		$results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report( $period );
600
+		$results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period);
601 601
 
602 602
 		$results = (array) $results;
603 603
 		$regs = array();
604 604
 		$subtitle = '';
605 605
 
606
-		if ( $results ) {
606
+		if ($results) {
607 607
 			$column_titles = array();
608 608
 			$tracker = 0;
609
-			foreach ( $results as $result ) {
609
+			foreach ($results as $result) {
610 610
 				$report_column_values = array();
611
-				foreach( $result as $property_name => $property_value ) {
612
-					$property_value = $property_name == 'Registration_Event' ? wp_trim_words( $property_value, 4, '...' ) : (int) $property_value;
611
+				foreach ($result as $property_name => $property_value) {
612
+					$property_value = $property_name == 'Registration_Event' ? wp_trim_words($property_value, 4, '...') : (int) $property_value;
613 613
 					$report_column_values[] = $property_value;
614
-					if ( $tracker === 0 ) {
615
-						if ( $property_name == 'Registration_Event' ) {
616
-							$column_titles[] = __( 'Event', 'event_espresso' );
614
+					if ($tracker === 0) {
615
+						if ($property_name == 'Registration_Event') {
616
+							$column_titles[] = __('Event', 'event_espresso');
617 617
 						} else {
618
-							$column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' );
618
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
619 619
 						}
620 620
 					}
621 621
 				}
@@ -624,37 +624,37 @@  discard block
 block discarded – undo
624 624
 			}
625 625
 
626 626
 			//make sure the column_titles is pushed to the beginning of the array
627
-			array_unshift( $regs, $column_titles );
627
+			array_unshift($regs, $column_titles);
628 628
 
629 629
 			//setup the date range.
630
-			$DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() );
631
-			$beginning_date = new DateTime( "now " . $period, $DateTimeZone );
632
-			$ending_date = new DateTime( "now", $DateTimeZone );
630
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
631
+			$beginning_date = new DateTime("now ".$period, $DateTimeZone);
632
+			$ending_date = new DateTime("now", $DateTimeZone);
633 633
 			$subtitle = sprintf(
634
-				_x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ),
635
-				$beginning_date->format( 'Y-m-d' ),
636
-				$ending_date->format( 'Y-m-d' )
634
+				_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
635
+				$beginning_date->format('Y-m-d'),
636
+				$ending_date->format('Y-m-d')
637 637
 			);
638 638
 		}
639 639
 
640
-		$report_title = __( 'Total Registrations per Event', 'event_espresso' );
640
+		$report_title = __('Total Registrations per Event', 'event_espresso');
641 641
 
642 642
 		$report_params = array(
643 643
 			'title' 	=> $report_title,
644 644
 			'subtitle' => $subtitle,
645 645
 			'id' 		=> $report_ID,
646 646
 			'regs' 	=> $regs,
647
-			'noResults' => empty( $regs ),
647
+			'noResults' => empty($regs),
648 648
 			'noRegsMsg' => sprintf(
649 649
 				__(
650 650
 					'%sThere are currently no registration records in the last month for this report.%s',
651 651
 					'event_espresso'
652 652
 				),
653
-				'<h2>' . $report_title . '</h2><p>',
653
+				'<h2>'.$report_title.'</h2><p>',
654 654
 				'</p>'
655 655
 			),
656 656
 		);
657
-		wp_localize_script( 'ee-reg-reports-js', 'regPerEvent', $report_params );
657
+		wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params);
658 658
 
659 659
 		return $report_ID;
660 660
 	}
@@ -668,8 +668,8 @@  discard block
 block discarded – undo
668 668
 	 * @return void
669 669
 	 */
670 670
 	protected function _registration_checkin_list_table() {
671
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
672
-		$reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null;
671
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
672
+		$reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null;
673 673
 		$reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
674 674
 		$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $reg->event_ID()), 'add-new-h2');
675 675
 
@@ -683,15 +683,15 @@  discard block
 block discarded – undo
683 683
 				'desc' => __('This indicates the attendee has been checked out', 'event_espresso')
684 684
 				)
685 685
 			);
686
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
686
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
687 687
 
688 688
 
689
-		$dtt_id = isset(  $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
690
-		$go_back_url = !empty( $reg_id )  ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : '';
689
+		$dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
690
+		$go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : '';
691 691
 
692
-		$this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : '';
693
-		$this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : '';
694
-		$this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
692
+		$this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : '';
693
+		$this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : '';
694
+		$this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : '';
695 695
 
696 696
 		$this->display_admin_list_table_page_with_no_sidebar();
697 697
 	}
@@ -704,24 +704,24 @@  discard block
 block discarded – undo
704 704
 	 */
705 705
 	public function toggle_checkin_status() {
706 706
 		//first make sure we have the necessary data
707
-		if ( !isset( $this->_req_data['_regid'] ) ) {
708
-			EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
707
+		if ( ! isset($this->_req_data['_regid'])) {
708
+			EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
709 709
 			$this->_template_args['success'] = FALSE;
710 710
 			$this->_template_args['error'] = TRUE;
711 711
 			$this->_return_json();
712 712
 		};
713 713
 
714 714
 		//do a nonce check cause we're not coming in from an normal route here.
715
-		$nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : '';
715
+		$nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : '';
716 716
 		$nonce_ref = 'checkin_nonce';
717 717
 
718
-		$this->_verify_nonce( $nonce, $nonce_ref );
718
+		$this->_verify_nonce($nonce, $nonce_ref);
719 719
 
720 720
 		//beautiful! Made it this far so let's get the status.
721 721
 		$new_status = $this->_toggle_checkin_status();
722 722
 
723 723
 		//setup new class to return via ajax
724
-		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status;
724
+		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status;
725 725
 		$this->_template_args['success'] = TRUE;
726 726
 		$this->_return_json();
727 727
 	}
@@ -741,32 +741,32 @@  discard block
 block discarded – undo
741 741
 		//first let's get the query args out of the way for the redirect
742 742
 		$query_args = array(
743 743
 			'action' => 'event_registrations',
744
-			'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL,
745
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL
744
+			'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL,
745
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL
746 746
 			);
747 747
 		$new_status = FALSE;
748 748
 
749 749
 		// bulk action check in toggle
750
-		if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
750
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
751 751
 			// cycle thru checkboxes
752
-			while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) {
753
-				$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
752
+			while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
753
+				$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
754 754
 				$new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
755 755
 			}
756 756
 
757
-		} elseif ( isset( $this->_req_data['_regid'] ) ) {
757
+		} elseif (isset($this->_req_data['_regid'])) {
758 758
 			//coming from ajax request
759
-			$DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL;
759
+			$DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL;
760 760
 			$query_args['DTT_ID'] = $DTT_ID;
761 761
 			$new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
762 762
 		} else {
763
-			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
763
+			EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
764 764
 		}
765 765
 
766
-		if ( defined('DOING_AJAX' ) )
766
+		if (defined('DOING_AJAX'))
767 767
 			return $new_status;
768 768
 
769
-		$this->_redirect_after_action( FALSE,'', '', $query_args, TRUE );
769
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
770 770
 
771 771
 	}
772 772
 
@@ -782,11 +782,11 @@  discard block
 block discarded – undo
782 782
 	 */
783 783
 	private function _toggle_checkin($REG_ID, $DTT_ID) {
784 784
 		$REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
785
-		$new_status = $REG->toggle_checkin_status( $DTT_ID );
786
-		if ( $new_status !== FALSE ) {
787
-			EE_Error::add_success($REG->get_checkin_msg($DTT_ID) );
785
+		$new_status = $REG->toggle_checkin_status($DTT_ID);
786
+		if ($new_status !== FALSE) {
787
+			EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
788 788
 		} else {
789
-			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ );
789
+			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__);
790 790
 			$new_status = FALSE;
791 791
 		}
792 792
 		return $new_status;
@@ -802,28 +802,28 @@  discard block
 block discarded – undo
802 802
 	protected function _delete_checkin_rows() {
803 803
 		$query_args = array(
804 804
 			'action' => 'registration_checkins',
805
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
806
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
805
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
806
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
807 807
 			);
808
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
809
-			while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
808
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
809
+			while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
810 810
 				$errors = 0;
811
-				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) {
811
+				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
812 812
 					$errors++;
813 813
 				}
814 814
 			}
815 815
 		} else {
816
-			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
817
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
816
+			EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
817
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
818 818
 		}
819 819
 
820
-		if ( $errors > 0 ) {
821
-			EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ );
820
+		if ($errors > 0) {
821
+			EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__);
822 822
 		} else {
823
-			EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') );
823
+			EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
824 824
 		}
825 825
 
826
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
826
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
827 827
 	}
828 828
 
829 829
 
@@ -835,20 +835,20 @@  discard block
 block discarded – undo
835 835
 	protected function _delete_checkin_row() {
836 836
 		$query_args = array(
837 837
 			'action' => 'registration_checkins',
838
-			'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0,
839
-			'_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0
838
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
839
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0
840 840
 			);
841 841
 
842
-		if ( !empty( $this->_req_data['CHK_ID'] ) ) {
843
-			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) {
844
-				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
842
+		if ( ! empty($this->_req_data['CHK_ID'])) {
843
+			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
844
+				EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
845 845
 			} else {
846
-				EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') );
846
+				EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
847 847
 			}
848 848
 		} else {
849
-			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
849
+			EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850 850
 		}
851
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
851
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
852 852
 	}
853 853
 
854 854
 
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 	*		@return void
862 862
 	*/
863 863
 	protected function _event_registrations_list_table() {
864
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
865
-		$this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : '';
864
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
865
+		$this->_admin_page_title .= isset($this->_req_data['event_id']) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : '';
866 866
 
867 867
 		$legend_items = array(
868 868
 			'star-icon' => array(
@@ -886,35 +886,35 @@  discard block
 block discarded – undo
886 886
 				'desc' => __('View All Check-in Records for this Registrant', 'event_espresso')
887 887
 				),
888 888
 			'approved_status' => array(
889
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
890
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
889
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
890
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
891 891
 				),
892 892
             'cancelled_status' => array(
893
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
894
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
893
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
894
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
895 895
 				),
896 896
             'declined_status' => array(
897
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
898
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
897
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
898
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
899 899
 				),
900 900
 			'not_approved' => array(
901
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
902
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
901
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
902
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
903 903
 				),
904 904
 			'pending_status' => array(
905
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
906
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
905
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
906
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
907 907
 				),
908 908
 			'wait_list' => array(
909
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
910
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, FALSE, 'sentence' )
909
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list,
910
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, FALSE, 'sentence')
911 911
 				),
912 912
 			);
913
-		$this->_template_args['after_list_table'] = $this->_display_legend( $legend_items );
913
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
914 914
 
915
-		$event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null;
916
-		$this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : '';
917
-		$this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : '';
915
+		$event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
916
+		$this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : '';
917
+		$this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : '';
918 918
 
919 919
 		$this->display_admin_list_table_page_with_no_sidebar();
920 920
 	}
@@ -928,15 +928,15 @@  discard block
 block discarded – undo
928 928
 	*		@access public
929 929
 	*		@return array
930 930
 	*/
931
-	public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) {
931
+	public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') {
932 932
 
933
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
934
-		require_once(EE_MODELS . 'EEM_Attendee.model.php');
933
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
934
+		require_once(EE_MODELS.'EEM_Attendee.model.php');
935 935
 		//$ATT_MDL = EEM_Attendee::instance();
936 936
 
937
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
938
-		$CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE;
939
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
937
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
938
+		$CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE;
939
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
940 940
 
941 941
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
942 942
 
@@ -949,94 +949,94 @@  discard block
 block discarded – undo
949 949
 //				$orderby = 'reg.REG_final_price';
950 950
 		}
951 951
 
952
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
952
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
953 953
 
954
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
955
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
954
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
955
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
956 956
 
957 957
 
958
-		$offset = ($current_page-1)*$per_page;
959
-		$limit = $count ? NULL : array( $offset, $per_page );
960
-		$query_params = array(array('Event.status'=>array('IN',  array_keys(EEM_Event::instance()->get_status_array()))));
961
-		if ($EVT_ID){
962
-			$query_params[0]['EVT_ID']=$EVT_ID;
958
+		$offset = ($current_page - 1) * $per_page;
959
+		$limit = $count ? NULL : array($offset, $per_page);
960
+		$query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array()))));
961
+		if ($EVT_ID) {
962
+			$query_params[0]['EVT_ID'] = $EVT_ID;
963 963
 		}
964
-		if($CAT_ID){
964
+		if ($CAT_ID) {
965 965
 			throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?");
966 966
 		}
967 967
 
968 968
 		//if DTT is included we do multiple datetimes.
969
-		if ( $DTT_ID ) {
969
+		if ($DTT_ID) {
970 970
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
971 971
 		}
972 972
 
973 973
 		//make sure we only have default where on the current regs
974 974
 		$query_params['default_where_conditions'] = 'this_model_only';
975 975
 
976
-		$status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );
976
+		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved));
977 977
 
978
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
978
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
979 979
 
980
-		if($trash){
981
-			$query_params[0]['Attendee.status']=  EEM_CPT_Base::post_status_trashed;
980
+		if ($trash) {
981
+			$query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed;
982 982
 		}
983 983
 
984
-		if ( isset( $this->_req_data['s'] ) ) {
985
-			$sstr = '%' . $this->_req_data['s'] . '%';
984
+		if (isset($this->_req_data['s'])) {
985
+			$sstr = '%'.$this->_req_data['s'].'%';
986 986
 			$query_params[0]['OR'] = array(
987
-				'Event.EVT_name' => array( 'LIKE', $sstr),
988
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
989
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
990
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
991
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
992
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
993
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
994
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
995
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
996
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
997
-				'REG_final_price' => array( 'LIKE', $sstr ),
998
-				'REG_code' => array( 'LIKE', $sstr ),
999
-				'REG_count' => array( 'LIKE' , $sstr ),
1000
-				'REG_group_size' => array( 'LIKE' , $sstr ),
1001
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
1002
-				'Ticket.TKT_description' => array( 'LIKE', $sstr )
987
+				'Event.EVT_name' => array('LIKE', $sstr),
988
+				'Event.EVT_desc' => array('LIKE', $sstr),
989
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
990
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
991
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
992
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
993
+				'Attendee.ATT_email' => array('LIKE', $sstr),
994
+				'Attendee.ATT_address' => array('LIKE', $sstr),
995
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
996
+				'Attendee.ATT_city' => array('LIKE', $sstr),
997
+				'REG_final_price' => array('LIKE', $sstr),
998
+				'REG_code' => array('LIKE', $sstr),
999
+				'REG_count' => array('LIKE', $sstr),
1000
+				'REG_group_size' => array('LIKE', $sstr),
1001
+				'Ticket.TKT_name' => array('LIKE', $sstr),
1002
+				'Ticket.TKT_description' => array('LIKE', $sstr)
1003 1003
 				);
1004 1004
 		}
1005 1005
 
1006 1006
 		$query_params['order_by'][$orderby] = $sort;
1007 1007
 		$query_params['limit'] = $limit;
1008
-		$query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration
1009
-		if($count){
1010
-			$registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only' ));
1011
-		}else{
1008
+		$query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration
1009
+		if ($count) {
1010
+			$registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only'));
1011
+		} else {
1012 1012
 			$registrations = EEM_Registration::instance()->get_all($query_params);
1013 1013
 
1014 1014
 
1015 1015
 	//		$registrations = EEM_Registration::instance();
1016 1016
 	//		$all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output );
1017
-			if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) {
1017
+			if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) {
1018 1018
 				//EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0]  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1019 1019
 				// name
1020 1020
 				$first_registration = $registrations[0];
1021 1021
 				$event_obj = $first_registration->event_obj();
1022
-				if($event_obj){
1022
+				if ($event_obj) {
1023 1023
 					$event_name = $first_registration->event_obj()->name();
1024
-					$event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_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 ) : '';
1024
+					$event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_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 ) : '';
1025 1025
 					// edit event link
1026
-					if ( $event_name != '' ) {
1027
-						$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1028
-						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1029
-						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1026
+					if ($event_name != '') {
1027
+						$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1028
+						$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1029
+						$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1030 1030
 					}
1031 1031
 
1032
-					$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1033
-					$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>';
1032
+					$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1033
+					$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>';
1034 1034
 
1035 1035
 					$this->_template_args['before_admin_page_content'] = '
1036 1036
 				<div id="admin-page-header">
1037
-					<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1038
-					<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1039
-					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1037
+					<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1038
+					<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1039
+					<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1040 1040
 				</div>
1041 1041
 				';
1042 1042
 				}
Please login to merge, or discard this patch.
reg_steps/payment_options/EE_SPCO_Reg_Step_Payment_Options.class.php 3 patches
Doc Comments   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 
146 146
 	/**
147
-	 * @return null
147
+	 * @return EE_Line_Item_Display
148 148
 	 */
149 149
 	public function line_item_display() {
150 150
 		return $this->line_item_display;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 
155 155
 	/**
156
-	 * @param null $line_item_display
156
+	 * @param EE_Line_Item_Display $line_item_display
157 157
 	 */
158 158
 	public function set_line_item_display( $line_item_display ) {
159 159
 		$this->line_item_display = $line_item_display;
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 	 *    _apply_registration_payments_to_amount_owing
840 840
 	 *
841 841
 	 * @access protected
842
-	 * @param array $registrations
842
+	 * @param EE_Base_Class[] $registrations
843 843
 	 */
844 844
 	protected function _apply_registration_payments_to_amount_owing( array $registrations ) {
845 845
 		$payments = array();
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 	 * get_billing_form_html_for_payment_method
1113 1113
 	 *
1114 1114
 	 * @access public
1115
-	 * @return string
1115
+	 * @return boolean
1116 1116
 	 * @throws \EE_Error
1117 1117
 	 */
1118 1118
 	public function get_billing_form_html_for_payment_method() {
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 	 *
1177 1177
 	 * @access private
1178 1178
 	 * @param EE_Payment_Method $payment_method
1179
-	 * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML
1179
+	 * @return EE_Billing_Info_Form
1180 1180
 	 * @throws \EE_Error
1181 1181
 	 */
1182 1182
 	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 	 * switch_payment_method
1281 1281
 	 *
1282 1282
 	 * @access public
1283
-	 * @return string
1283
+	 * @return boolean
1284 1284
 	 * @throws \EE_Error
1285 1285
 	 */
1286 1286
 	public function switch_payment_method() {
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 	/**
1488 1488
 	 * process_reg_step
1489 1489
 	 *
1490
-	 * @return boolean
1490
+	 * @return null|boolean
1491 1491
 	 * @throws \EE_Error
1492 1492
 	 */
1493 1493
 	public function process_reg_step() {
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
 	 *    update_reg_step
1614 1614
 	 *    this is the final step after a user  revisits the site to retry a payment
1615 1615
 	 *
1616
-	 * @return boolean
1616
+	 * @return null|boolean
1617 1617
 	 * @throws \EE_Error
1618 1618
 	 */
1619 1619
 	public function update_reg_step() {
@@ -1981,7 +1981,7 @@  discard block
 block discarded – undo
1981 1981
 	 *
1982 1982
 	 * @access    private
1983 1983
 	 * @type    EE_Payment_Method $payment_method
1984
-	 * @return    mixed    EE_Payment | boolean
1984
+	 * @return    EE_Payment|null    EE_Payment | boolean
1985 1985
 	 * @throws \EE_Error
1986 1986
 	 */
1987 1987
 	private function _attempt_payment( EE_Payment_Method $payment_method ) {
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
 	 * _post_payment_processing
2113 2113
 	 *
2114 2114
 	 * @access private
2115
-	 * @param EE_Payment|bool $payment
2115
+	 * @param EE_Payment $payment
2116 2116
 	 * @return bool
2117 2117
 	 * @throws \EE_Error
2118 2118
 	 */
@@ -2301,7 +2301,7 @@  discard block
 block discarded – undo
2301 2301
 	 *        or present the payment options again
2302 2302
 	 *
2303 2303
 	 * @access private
2304
-	 * @return EE_Payment | FALSE
2304
+	 * @return boolean | FALSE
2305 2305
 	 * @throws \EE_Error
2306 2306
 	 */
2307 2307
 	public function process_gateway_response() {
@@ -2434,8 +2434,8 @@  discard block
 block discarded – undo
2434 2434
 	 * _redirect_wayward_request
2435 2435
 	 *
2436 2436
 	 * @access private
2437
-	 * @param \EE_Registration|null $primary_registrant
2438
-	 * @return bool
2437
+	 * @param EE_Registration $primary_registrant
2438
+	 * @return false|null
2439 2439
 	 * @throws \EE_Error
2440 2440
 	 */
2441 2441
 	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
Please login to merge, or discard this patch.
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -467,38 +467,38 @@  discard block
 block discarded – undo
467 467
 	 * @throws \EE_Error
468 468
 	 */
469 469
 	public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) {
470
-        // registrations per event
470
+		// registrations per event
471 471
 		$event_reg_count = array();
472 472
 		// spaces left per event
473 473
 		$event_spaces_remaining = array();
474
-        // tickets left sorted by ID
475
-        $tickets_remaining = array();
476
-        // registrations that have lost their space
474
+		// tickets left sorted by ID
475
+		$tickets_remaining = array();
476
+		// registrations that have lost their space
477 477
 		$ejected_registrations = array();
478 478
 		foreach ( $registrations as $REG_ID => $registration ) {
479 479
 			if ( $registration->status_ID() === EEM_Registration::status_id_approved ) {
480 480
 				continue;
481 481
 			}
482 482
 			$EVT_ID = $registration->event_ID();
483
-            $ticket = $registration->ticket();
484
-            if ( ! isset($tickets_remaining[$ticket->ID()])) {
485
-                $tickets_remaining[$ticket->ID()] = $ticket->remaining();
486
-            }
487
-            if ($tickets_remaining[$ticket->ID()] > 0) {
488
-                if ( ! isset($event_reg_count[$EVT_ID])) {
489
-                    $event_reg_count[$EVT_ID] = 0;
490
-                }
491
-                $event_reg_count[$EVT_ID]++;
492
-                if ( ! isset($event_spaces_remaining[$EVT_ID])) {
493
-                    $event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale();
494
-                }
495
-            }
483
+			$ticket = $registration->ticket();
484
+			if ( ! isset($tickets_remaining[$ticket->ID()])) {
485
+				$tickets_remaining[$ticket->ID()] = $ticket->remaining();
486
+			}
487
+			if ($tickets_remaining[$ticket->ID()] > 0) {
488
+				if ( ! isset($event_reg_count[$EVT_ID])) {
489
+					$event_reg_count[$EVT_ID] = 0;
490
+				}
491
+				$event_reg_count[$EVT_ID]++;
492
+				if ( ! isset($event_spaces_remaining[$EVT_ID])) {
493
+					$event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale();
494
+				}
495
+			}
496 496
 			if (
497 497
 				$revisit
498 498
 				&& (
499
-                    $tickets_remaining[$ticket->ID()] === 0
500
-				    || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
501
-                )
499
+					$tickets_remaining[$ticket->ID()] === 0
500
+					|| $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
501
+				)
502 502
 			) {
503 503
 				$ejected_registrations[ $REG_ID ] = $registration->event();
504 504
 				if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) {
@@ -573,9 +573,9 @@  discard block
 block discarded – undo
573 573
 				'layout_strategy' => new EE_Template_Layout(
574 574
 					array(
575 575
 						'layout_template_file' => SPCO_REG_STEPS_PATH
576
-						                          . $this->_slug
577
-						                          . DS
578
-						                          . 'sold_out_events.template.php',
576
+												  . $this->_slug
577
+												  . DS
578
+												  . 'sold_out_events.template.php',
579 579
 						'template_args'        => apply_filters(
580 580
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
581 581
 							array(
@@ -626,9 +626,9 @@  discard block
 block discarded – undo
626 626
 				'layout_strategy' => new EE_Template_Layout(
627 627
 					array(
628 628
 						'layout_template_file' => SPCO_REG_STEPS_PATH
629
-						                          . $this->_slug
630
-						                          . DS
631
-						                          . 'sold_out_events.template.php',
629
+												  . $this->_slug
630
+												  . DS
631
+												  . 'sold_out_events.template.php',
632 632
 						'template_args'        => apply_filters(
633 633
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___insufficient_spaces_available__template_args',
634 634
 							array(
@@ -680,9 +680,9 @@  discard block
 block discarded – undo
680 680
 				'layout_strategy' => new EE_Template_Layout(
681 681
 					array(
682 682
 						'layout_template_file' => SPCO_REG_STEPS_PATH
683
-						                          . $this->_slug
684
-						                          . DS
685
-						                          . 'events_requiring_pre_approval.template.php', // layout_template
683
+												  . $this->_slug
684
+												  . DS
685
+												  . 'events_requiring_pre_approval.template.php', // layout_template
686 686
 						'template_args'        => apply_filters(
687 687
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
688 688
 							array(
@@ -724,9 +724,9 @@  discard block
 block discarded – undo
724 724
 				'layout_strategy' => new EE_Template_Layout(
725 725
 					array(
726 726
 						'layout_template_file' => SPCO_REG_STEPS_PATH
727
-						                          . $this->_slug
728
-						                          . DS
729
-						                          . 'no_payment_required.template.php', // layout_template
727
+												  . $this->_slug
728
+												  . DS
729
+												  . 'no_payment_required.template.php', // layout_template
730 730
 						'template_args'        => apply_filters(
731 731
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args',
732 732
 							array(
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 					$available_payment_method_options[ $payment_method->slug() ] = $payment_method_button;
957 957
 				}
958 958
 				$payment_methods_billing_info[ $payment_method->slug()
959
-				                               . '-info' ] = $this->_payment_method_billing_info(
959
+											   . '-info' ] = $this->_payment_method_billing_info(
960 960
 					$payment_method
961 961
 				);
962 962
 			}
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 		// fill form with attendee info if applicable
1145 1145
 		if (
1146 1146
 			$payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form
1147
-		    && $this->checkout->transaction_has_primary_registrant()
1147
+			&& $this->checkout->transaction_has_primary_registrant()
1148 1148
 		) {
1149 1149
 			$payment_method_billing_form->populate_from_attendee(
1150 1150
 				$this->checkout->transaction->primary_registration()->attendee()
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 		// and debug content
1154 1154
 		if (
1155 1155
 			$payment_method_billing_form instanceof EE_Billing_Info_Form
1156
-		    && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1156
+			&& $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1157 1157
 		) {
1158 1158
 			$payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
1159 1159
 				$payment_method_billing_form
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 		}
1313 1313
 		// fill form with attendee info if applicable
1314 1314
 		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form
1315
-		     && $this->checkout->transaction_has_primary_registrant()
1315
+			 && $this->checkout->transaction_has_primary_registrant()
1316 1316
 		) {
1317 1317
 			$this->checkout->billing_form->populate_from_attendee(
1318 1318
 				$this->checkout->transaction->primary_registration()->attendee()
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
 		}
1321 1321
 		// and debug content
1322 1322
 		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form
1323
-		     && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1323
+			 && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1324 1324
 		) {
1325 1325
 			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
1326 1326
 				$this->checkout->billing_form
@@ -1454,8 +1454,8 @@  discard block
 block discarded – undo
1454 1454
 		}
1455 1455
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1456 1456
 		if ( ! empty( $attendee_data['ATT_fname'] )
1457
-		     && ! empty( $attendee_data['ATT_lname'] )
1458
-		     && ! empty( $attendee_data['ATT_email'] )
1457
+			 && ! empty( $attendee_data['ATT_lname'] )
1458
+			 && ! empty( $attendee_data['ATT_email'] )
1459 1459
 		) {
1460 1460
 			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(
1461 1461
 				array(
@@ -1697,7 +1697,7 @@  discard block
 block discarded – undo
1697 1697
 			$payment_status = $payment->status();
1698 1698
 			if (
1699 1699
 				$payment_status === EEM_Payment::status_id_approved
1700
-			    || $payment_status === EEM_Payment::status_id_pending
1700
+				|| $payment_status === EEM_Payment::status_id_pending
1701 1701
 			) {
1702 1702
 				return true;
1703 1703
 			} else {
@@ -1885,8 +1885,8 @@  discard block
 block discarded – undo
1885 1885
 			return false;
1886 1886
 		}
1887 1887
 		if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' )
1888
-		       instanceof
1889
-		       EE_Attendee
1888
+			   instanceof
1889
+			   EE_Attendee
1890 1890
 		) {
1891 1891
 			EE_Error::add_error(
1892 1892
 				sprintf(
Please login to merge, or discard this patch.
Spacing   +354 added lines, -354 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -38,32 +38,32 @@  discard block
 block discarded – undo
38 38
 	public static function set_hooks() {
39 39
 		add_filter(
40 40
 			'FHEE__SPCO__EE_Line_Item_Filter_Collection',
41
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' )
41
+			array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters')
42 42
 		);
43 43
 		add_action(
44 44
 			'wp_ajax_switch_spco_billing_form',
45
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )
45
+			array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')
46 46
 		);
47 47
 		add_action(
48 48
 			'wp_ajax_nopriv_switch_spco_billing_form',
49
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )
49
+			array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')
50 50
 		);
51
-		add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) );
51
+		add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details'));
52 52
 		add_action(
53 53
 			'wp_ajax_nopriv_save_payer_details',
54
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )
54
+			array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')
55 55
 		);
56 56
 		add_action(
57 57
 			'wp_ajax_get_transaction_details_for_gateways',
58
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
58
+			array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
59 59
 		);
60 60
 		add_action(
61 61
 			'wp_ajax_nopriv_get_transaction_details_for_gateways',
62
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' )
62
+			array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')
63 63
 		);
64 64
 		add_filter(
65 65
 			'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array',
66
-			array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ),
66
+			array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'),
67 67
 			10,
68 68
 			1
69 69
 		);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @throws \EE_Error
78 78
 	 */
79 79
 	public static function switch_spco_billing_form() {
80
-		EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' );
80
+		EED_Single_Page_Checkout::process_ajax_request('switch_payment_method');
81 81
 	}
82 82
 
83 83
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @throws \EE_Error
89 89
 	 */
90 90
 	public static function save_payer_details() {
91
-		EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' );
91
+		EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax');
92 92
 	}
93 93
 
94 94
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @throws \EE_Error
100 100
 	 */
101 101
 	public static function get_transaction_details() {
102
-		EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' );
102
+		EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways');
103 103
 	}
104 104
 
105 105
 
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 	 * @param    EE_Checkout $checkout
128 128
 	 * @return    \EE_SPCO_Reg_Step_Payment_Options
129 129
 	 */
130
-	public function __construct( EE_Checkout $checkout ) {
130
+	public function __construct(EE_Checkout $checkout) {
131 131
 		$this->_slug = 'payment_options';
132
-		$this->_name = __( 'Payment Options', 'event_espresso' );
133
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php';
132
+		$this->_name = __('Payment Options', 'event_espresso');
133
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php';
134 134
 		$this->checkout = $checkout;
135 135
 		$this->_reset_success_message();
136 136
 		$this->set_instructions(
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	/**
156 156
 	 * @param null $line_item_display
157 157
 	 */
158
-	public function set_line_item_display( $line_item_display ) {
158
+	public function set_line_item_display($line_item_display) {
159 159
 		$this->line_item_display = $line_item_display;
160 160
 	}
161 161
 
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	/**
174 174
 	 * @param boolean $handle_IPN_in_this_request
175 175
 	 */
176
-	public function set_handle_IPN_in_this_request( $handle_IPN_in_this_request ) {
177
-		$this->handle_IPN_in_this_request = filter_var( $handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN );
176
+	public function set_handle_IPN_in_this_request($handle_IPN_in_this_request) {
177
+		$this->handle_IPN_in_this_request = filter_var($handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN);
178 178
 	}
179 179
 
180 180
 
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
 	public function enqueue_styles_and_scripts() {
210 210
 		$transaction = $this->checkout->transaction;
211 211
 		//if the transaction isn't set or nothing is owed on it, don't enqueue any JS
212
-		if( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats( $transaction->remaining(), 0 ) ) {
212
+		if ( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats($transaction->remaining(), 0)) {
213 213
 			return;
214 214
 		}
215
-		foreach( EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ) as $payment_method ) {
215
+		foreach (EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart) as $payment_method) {
216 216
 			$type_obj = $payment_method->type_obj();
217
-			if( $type_obj instanceof EE_PMT_Base ) {
218
-				$billing_form = $type_obj->generate_new_billing_form( $transaction );
219
-				if( $billing_form instanceof EE_Form_Section_Proper ) {
217
+			if ($type_obj instanceof EE_PMT_Base) {
218
+				$billing_form = $type_obj->generate_new_billing_form($transaction);
219
+				if ($billing_form instanceof EE_Form_Section_Proper) {
220 220
 					$billing_form->enqueue_js();
221 221
 				}
222 222
 			}
@@ -241,20 +241,20 @@  discard block
 block discarded – undo
241 241
 			// 	$ 0.00 transactions (no payment required)
242 242
 			! $this->checkout->payment_required()
243 243
 			// but do NOT remove if current action being called belongs to this reg step
244
-			&& ! is_callable( array( $this, $this->checkout->action ) )
244
+			&& ! is_callable(array($this, $this->checkout->action))
245 245
 			&& ! $this->completed()
246 246
 		) {
247 247
 			// and if so, then we no longer need the Payment Options step
248
-			if ( $this->is_current_step() ) {
248
+			if ($this->is_current_step()) {
249 249
 				$this->checkout->generate_reg_form = false;
250 250
 			}
251
-			$this->checkout->remove_reg_step( $this->_slug );
251
+			$this->checkout->remove_reg_step($this->_slug);
252 252
 			// DEBUG LOG
253 253
 			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
254 254
 			return false;
255 255
 		}
256 256
 		// load EEM_Payment_Method
257
-		EE_Registry::instance()->load_model( 'Payment_Method' );
257
+		EE_Registry::instance()->load_model('Payment_Method');
258 258
 		// get all active payment methods
259 259
 		$this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
260 260
 			$this->checkout->transaction,
@@ -281,15 +281,15 @@  discard block
 block discarded – undo
281 281
 		$insufficient_spaces_available = array();
282 282
 		$reg_count = 0;
283 283
 		// loop thru registrations to gather info
284
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
284
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
285 285
 		$ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space(
286 286
 			$registrations,
287 287
 			$this->checkout->revisit
288 288
 		);
289
-		foreach ( $registrations as $REG_ID => $registration ) {
289
+		foreach ($registrations as $REG_ID => $registration) {
290 290
 			// has this registration lost it's space ?
291
-			if ( isset( $ejected_registrations[ $REG_ID ] ) ) {
292
-				$insufficient_spaces_available[ $registration->event()->ID() ] = $registration->event();
291
+			if (isset($ejected_registrations[$REG_ID])) {
292
+				$insufficient_spaces_available[$registration->event()->ID()] = $registration->event();
293 293
 				continue;
294 294
 			}
295 295
 			/** @var $registration EE_Registration */
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 				&& $registration->status_ID() === EEM_Registration::status_id_approved
302 302
 			)
303 303
 			) {
304
-				if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true ) ) {
304
+				if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) {
305 305
 					// add event to list of events that are sold out
306
-					$sold_out_events[ $registration->event()->ID() ] = $registration->event();
306
+					$sold_out_events[$registration->event()->ID()] = $registration->event();
307 307
 					do_action(
308 308
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event',
309 309
 						$registration->event(),
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
 					continue;
313 313
 				}
314 314
 				// event requires admin approval
315
-				if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) {
315
+				if ($registration->status_ID() === EEM_Registration::status_id_not_approved) {
316 316
 					// add event to list of events with pre-approval reg status
317
-					$registrations_requiring_pre_approval[ $REG_ID ] = $registration;
317
+					$registrations_requiring_pre_approval[$REG_ID] = $registration;
318 318
 					do_action(
319 319
 						'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval',
320 320
 						$registration->event(),
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
 				}
324 324
 			}
325 325
 			// are they allowed to pay now and is there monies owing?
326
-			if ( $registration->owes_monies_and_can_pay() ) {
327
-				$registrations_requiring_payment[ $REG_ID ] = $registration;
326
+			if ($registration->owes_monies_and_can_pay()) {
327
+				$registrations_requiring_payment[$REG_ID] = $registration;
328 328
 				do_action(
329 329
 					'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment',
330 330
 					$registration->event(),
@@ -335,29 +335,29 @@  discard block
 block discarded – undo
335 335
 				&& $registration->status_ID() !== EEM_Registration::status_id_not_approved
336 336
 				&& $registration->ticket()->is_free()
337 337
 			) {
338
-				$registrations_for_free_events[ $registration->event()->ID() ] = $registration;
338
+				$registrations_for_free_events[$registration->event()->ID()] = $registration;
339 339
 			}
340 340
 		}
341 341
 		$subsections = array();
342 342
 		// now decide which template to load
343
-		if ( ! empty( $sold_out_events ) ) {
344
-			$subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events );
343
+		if ( ! empty($sold_out_events)) {
344
+			$subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events);
345 345
 		}
346
-		if ( ! empty( $insufficient_spaces_available ) ) {
346
+		if ( ! empty($insufficient_spaces_available)) {
347 347
 			$subsections['insufficient_space'] = $this->_insufficient_spaces_available(
348 348
 				$insufficient_spaces_available
349 349
 			);
350 350
 		}
351
-		if ( ! empty( $registrations_requiring_pre_approval ) ) {
351
+		if ( ! empty($registrations_requiring_pre_approval)) {
352 352
 			$subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval(
353 353
 				$registrations_requiring_pre_approval
354 354
 			);
355 355
 		}
356
-		if ( ! empty( $registrations_for_free_events ) ) {
357
-			$subsections['no_payment_required'] = $this->_no_payment_required( $registrations_for_free_events );
356
+		if ( ! empty($registrations_for_free_events)) {
357
+			$subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events);
358 358
 		}
359
-		if ( ! empty( $registrations_requiring_payment ) ) {
360
-			if ( $this->checkout->amount_owing > 0 ) {
359
+		if ( ! empty($registrations_requiring_payment)) {
360
+			if ($this->checkout->amount_owing > 0) {
361 361
 				// autoload Line_Item_Display classes
362 362
 				EEH_Autoloader::register_line_item_filter_autoloaders();
363 363
 				$line_item_filter_processor = new EE_Line_Item_Filter_Processor(
@@ -370,15 +370,15 @@  discard block
 block discarded – undo
370 370
 				/** @var EE_Line_Item $filtered_line_item_tree */
371 371
 				$filtered_line_item_tree = $line_item_filter_processor->process();
372 372
 				EEH_Autoloader::register_line_item_display_autoloaders();
373
-				$this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) );
373
+				$this->set_line_item_display(new EE_Line_Item_Display('spco'));
374 374
 				$subsections['payment_options'] = $this->_display_payment_options(
375 375
 					$this->line_item_display->display_line_item(
376 376
 						$filtered_line_item_tree,
377
-						array( 'registrations' => $registrations )
377
+						array('registrations' => $registrations)
378 378
 					)
379 379
 				);
380 380
 				$this->checkout->amount_owing = $filtered_line_item_tree->total();
381
-				$this->_apply_registration_payments_to_amount_owing( $registrations );
381
+				$this->_apply_registration_payments_to_amount_owing($registrations);
382 382
 			}
383 383
 		} else {
384 384
 			$this->_hide_reg_step_submit_button_if_revisit();
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 * @return \EE_Line_Item_Filter_Collection
410 410
 	 * @throws \EE_Error
411 411
 	 */
412
-	public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) {
412
+	public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) {
413 413
 		$line_item_filter_collection->add(
414 414
 			new EE_Billable_Line_Item_Filter(
415 415
 				EE_SPCO_Reg_Step_Payment_Options::remove_ejected_registrations(
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 				)
420 420
 			)
421 421
 		);
422
-		$line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() );
422
+		$line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter());
423 423
 		return $line_item_filter_collection;
424 424
 	}
425 425
 
@@ -435,15 +435,15 @@  discard block
 block discarded – undo
435 435
 	 * @return \EE_Registration[]
436 436
 	 * @throws \EE_Error
437 437
 	 */
438
-	public static function remove_ejected_registrations( array $registrations ) {
438
+	public static function remove_ejected_registrations(array $registrations) {
439 439
 		$ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space(
440 440
 			$registrations,
441 441
 			EE_Registry::instance()->SSN->checkout()->revisit
442 442
 		);
443
-		foreach ( $registrations as $REG_ID => $registration ) {
443
+		foreach ($registrations as $REG_ID => $registration) {
444 444
 			// has this registration lost it's space ?
445
-			if ( isset( $ejected_registrations[ $REG_ID ] ) ) {
446
-				unset( $registrations[ $REG_ID ] );
445
+			if (isset($ejected_registrations[$REG_ID])) {
446
+				unset($registrations[$REG_ID]);
447 447
 				continue;
448 448
 			}
449 449
 		}
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 * @return array
467 467
 	 * @throws \EE_Error
468 468
 	 */
469
-	public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) {
469
+	public static function find_registrations_that_lost_their_space(array $registrations, $revisit = false) {
470 470
         // registrations per event
471 471
 		$event_reg_count = array();
472 472
 		// spaces left per event
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
         $tickets_remaining = array();
476 476
         // registrations that have lost their space
477 477
 		$ejected_registrations = array();
478
-		foreach ( $registrations as $REG_ID => $registration ) {
479
-			if ( $registration->status_ID() === EEM_Registration::status_id_approved ) {
478
+		foreach ($registrations as $REG_ID => $registration) {
479
+			if ($registration->status_ID() === EEM_Registration::status_id_approved) {
480 480
 				continue;
481 481
 			}
482 482
 			$EVT_ID = $registration->event_ID();
@@ -497,13 +497,13 @@  discard block
 block discarded – undo
497 497
 				$revisit
498 498
 				&& (
499 499
                     $tickets_remaining[$ticket->ID()] === 0
500
-				    || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ]
500
+				    || $event_reg_count[$EVT_ID] > $event_spaces_remaining[$EVT_ID]
501 501
                 )
502 502
 			) {
503
-				$ejected_registrations[ $REG_ID ] = $registration->event();
504
-				if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) {
503
+				$ejected_registrations[$REG_ID] = $registration->event();
504
+				if ($registration->status_ID() !== EEM_Registration::status_id_wait_list) {
505 505
 					/** @type EE_Registration_Processor $registration_processor */
506
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
506
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
507 507
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
508 508
 					$registration_processor->manually_update_registration_status(
509 509
 						$registration,
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
 	 * @return void
539 539
 	 */
540 540
 	protected function _hide_reg_step_submit_button_if_revisit() {
541
-		if ( $this->checkout->revisit ) {
542
-			add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' );
541
+		if ($this->checkout->revisit) {
542
+			add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string');
543 543
 		}
544 544
 	}
545 545
 
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
 	 * @return \EE_Form_Section_Proper
554 554
 	 * @throws \EE_Error
555 555
 	 */
556
-	private function _sold_out_events( $sold_out_events_array = array() ) {
556
+	private function _sold_out_events($sold_out_events_array = array()) {
557 557
 		// set some defaults
558 558
 		$this->checkout->selected_method_of_payment = 'events_sold_out';
559 559
 		$sold_out_events = '';
560
-		foreach ( $sold_out_events_array as $sold_out_event ) {
560
+		foreach ($sold_out_events_array as $sold_out_event) {
561 561
 			$sold_out_events .= EEH_HTML::li(
562
-				EEH_HTML::span( '  ' .$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )
562
+				EEH_HTML::span('  '.$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')
563 563
 			);
564 564
 		}
565 565
 		return new EE_Form_Section_Proper(
@@ -606,14 +606,14 @@  discard block
 block discarded – undo
606 606
 	 * @return \EE_Form_Section_Proper
607 607
 	 * @throws \EE_Error
608 608
 	 */
609
-	private function _insufficient_spaces_available( $insufficient_spaces_events_array = array() ) {
609
+	private function _insufficient_spaces_available($insufficient_spaces_events_array = array()) {
610 610
 		// set some defaults
611 611
 		$this->checkout->selected_method_of_payment = 'invoice';
612 612
 		$insufficient_space_events = '';
613
-		foreach ( $insufficient_spaces_events_array as $event ) {
614
-			if ( $event instanceof EE_Event ) {
613
+		foreach ($insufficient_spaces_events_array as $event) {
614
+			if ($event instanceof EE_Event) {
615 615
 				$insufficient_space_events .= EEH_HTML::li(
616
-					EEH_HTML::span( ' ' . $event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )
616
+					EEH_HTML::span(' '.$event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')
617 617
 				);
618 618
 			}
619 619
 		}
@@ -657,17 +657,17 @@  discard block
 block discarded – undo
657 657
 	 * @return \EE_Form_Section_Proper
658 658
 	 * @throws \EE_Error
659 659
 	 */
660
-	private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array() ) {
660
+	private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) {
661 661
 		$events_requiring_pre_approval = '';
662
-		foreach ( $registrations_requiring_pre_approval as $registration ) {
663
-			if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) {
664
-				$events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li(
662
+		foreach ($registrations_requiring_pre_approval as $registration) {
663
+			if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) {
664
+				$events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li(
665 665
 					EEH_HTML::span(
666 666
 						'',
667 667
 						'',
668 668
 						'dashicons dashicons-marker ee-icon-size-16 orange-text'
669 669
 					)
670
-					. EEH_HTML::span( $registration->event()->name(), '', 'orange-text' )
670
+					. EEH_HTML::span($registration->event()->name(), '', 'orange-text')
671 671
 				);
672 672
 			}
673 673
 		}
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 						'template_args'        => apply_filters(
687 687
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args',
688 688
 							array(
689
-								'events_requiring_pre_approval'     => implode( '', $events_requiring_pre_approval ),
689
+								'events_requiring_pre_approval'     => implode('', $events_requiring_pre_approval),
690 690
 								'events_requiring_pre_approval_msg' => apply_filters(
691 691
 									'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg',
692 692
 									__(
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	 * @return \EE_Form_Section_Proper
712 712
 	 * @throws \EE_Error
713 713
 	 */
714
-	private function _no_payment_required( $registrations_for_free_events = array() ) {
714
+	private function _no_payment_required($registrations_for_free_events = array()) {
715 715
 		// set some defaults
716 716
 		$this->checkout->selected_method_of_payment = 'no_payment_required';
717 717
 		// generate no_payment_required form
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 								'ticket_count'                  => array(),
736 736
 								'registrations_for_free_events' => $registrations_for_free_events,
737 737
 								'no_payment_required_msg'       => EEH_HTML::p(
738
-									__( 'This is a free event, so no billing will occur.', 'event_espresso' )
738
+									__('This is a free event, so no billing will occur.', 'event_espresso')
739 739
 								)
740 740
 							)
741 741
 						),
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 	 * @return \EE_Form_Section_Proper
755 755
 	 * @throws \EE_Error
756 756
 	 */
757
-	private function _display_payment_options( $transaction_details = '' ) {
757
+	private function _display_payment_options($transaction_details = '') {
758 758
 		// has method_of_payment been set by no-js user?
759 759
 		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment();
760 760
 		// build payment options form
@@ -766,18 +766,18 @@  discard block
 block discarded – undo
766 766
 						'before_payment_options' => apply_filters(
767 767
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options',
768 768
 							new EE_Form_Section_Proper(
769
-								array( 'layout_strategy' => new EE_Div_Per_Section_Layout() )
769
+								array('layout_strategy' => new EE_Div_Per_Section_Layout())
770 770
 							)
771 771
 						),
772 772
 						'payment_options'        => $this->_setup_payment_options(),
773 773
 						'after_payment_options'  => apply_filters(
774 774
 							'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options',
775 775
 							new EE_Form_Section_Proper(
776
-								array( 'layout_strategy' => new EE_Div_Per_Section_Layout() )
776
+								array('layout_strategy' => new EE_Div_Per_Section_Layout())
777 777
 							)
778 778
 						),
779 779
 						'default_hidden_inputs'  => $this->reg_step_hidden_inputs(),
780
-						'extra_hidden_inputs'    => $this->_extra_hidden_inputs( false )
780
+						'extra_hidden_inputs'    => $this->_extra_hidden_inputs(false)
781 781
 					),
782 782
 					'layout_strategy' => new EE_Template_Layout(
783 783
 						array(
@@ -806,10 +806,10 @@  discard block
 block discarded – undo
806 806
 	 * @return \EE_Form_Section_Proper
807 807
 	 * @throws \EE_Error
808 808
 	 */
809
-	private function _extra_hidden_inputs( $no_payment_required = true ) {
809
+	private function _extra_hidden_inputs($no_payment_required = true) {
810 810
 		return new EE_Form_Section_Proper(
811 811
 			array(
812
-				'html_id'         => 'ee-' . $this->slug() . '-extra-hidden-inputs',
812
+				'html_id'         => 'ee-'.$this->slug().'-extra-hidden-inputs',
813 813
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
814 814
 				'subsections'     => array(
815 815
 					'spco_no_payment_required' => new EE_Hidden_Input(
@@ -841,16 +841,16 @@  discard block
 block discarded – undo
841 841
 	 * @access protected
842 842
 	 * @param array $registrations
843 843
 	 */
844
-	protected function _apply_registration_payments_to_amount_owing( array $registrations ) {
844
+	protected function _apply_registration_payments_to_amount_owing(array $registrations) {
845 845
 		$payments = array();
846
-		foreach ( $registrations as $registration ) {
847
-			if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
846
+		foreach ($registrations as $registration) {
847
+			if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
848 848
 				$payments += $registration->registration_payments();
849 849
 			}
850 850
 		}
851
-		if ( ! empty( $payments ) ) {
852
-			foreach ( $payments as $payment ) {
853
-				if ( $payment instanceof EE_Registration_Payment ) {
851
+		if ( ! empty($payments)) {
852
+			foreach ($payments as $payment) {
853
+				if ($payment instanceof EE_Registration_Payment) {
854 854
 					$this->checkout->amount_owing -= $payment->amount();
855 855
 				}
856 856
 			}
@@ -866,11 +866,11 @@  discard block
 block discarded – undo
866 866
 	 * @param    bool $force_reset
867 867
 	 * @return    void
868 868
 	 */
869
-	private function _reset_selected_method_of_payment( $force_reset = false ) {
869
+	private function _reset_selected_method_of_payment($force_reset = false) {
870 870
 		$reset_payment_method = $force_reset
871 871
 			? true
872
-			: sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', false ) );
873
-		if ( $reset_payment_method ) {
872
+			: sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', false));
873
+		if ($reset_payment_method) {
874 874
 			$this->checkout->selected_method_of_payment = null;
875 875
 			$this->checkout->payment_method = null;
876 876
 			$this->checkout->billing_form = null;
@@ -889,12 +889,12 @@  discard block
 block discarded – undo
889 889
 	 * @param string $selected_method_of_payment
890 890
 	 * @return        EE_Billing_Info_Form
891 891
 	 */
892
-	private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) {
893
-		$selected_method_of_payment = ! empty( $selected_method_of_payment )
892
+	private function _save_selected_method_of_payment($selected_method_of_payment = '') {
893
+		$selected_method_of_payment = ! empty($selected_method_of_payment)
894 894
 			? $selected_method_of_payment
895 895
 			: $this->checkout->selected_method_of_payment;
896 896
 		EE_Registry::instance()->SSN->set_session_data(
897
-			array( 'selected_method_of_payment' => $selected_method_of_payment )
897
+			array('selected_method_of_payment' => $selected_method_of_payment)
898 898
 		);
899 899
 	}
900 900
 
@@ -910,19 +910,19 @@  discard block
 block discarded – undo
910 910
 		// load payment method classes
911 911
 		$this->checkout->available_payment_methods = $this->_get_available_payment_methods();
912 912
 		// switch up header depending on number of available payment methods
913
-		$payment_method_header = count( $this->checkout->available_payment_methods ) > 1
913
+		$payment_method_header = count($this->checkout->available_payment_methods) > 1
914 914
 			? apply_filters(
915 915
 				'FHEE__registration_page_payment_options__method_of_payment_hdr',
916
-				__( 'Please Select Your Method of Payment', 'event_espresso' )
916
+				__('Please Select Your Method of Payment', 'event_espresso')
917 917
 			)
918 918
 			: apply_filters(
919 919
 				'FHEE__registration_page_payment_options__method_of_payment_hdr',
920
-				__( 'Method of Payment', 'event_espresso' )
920
+				__('Method of Payment', 'event_espresso')
921 921
 			);
922 922
 		$available_payment_methods = array(
923 923
 			// display the "Payment Method" header
924 924
 			'payment_method_header' => new EE_Form_Section_HTML(
925
-				EEH_HTML::h4( $payment_method_header, 'method-of-payment-hdr' )
925
+				EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr')
926 926
 			)
927 927
 		);
928 928
 		// the list of actual payment methods ( invoice, paypal, etc ) in a  ( slug => HTML )  format
@@ -931,32 +931,32 @@  discard block
 block discarded – undo
931 931
 		// additional instructions to be displayed and hidden below payment methods (adding a clearing div to start)
932 932
 		$payment_methods_billing_info = array(
933 933
 			new EE_Form_Section_HTML(
934
-				EEH_HTML::div( '<br />', '', '', 'clear:both;' )
934
+				EEH_HTML::div('<br />', '', '', 'clear:both;')
935 935
 			)
936 936
 		);
937 937
 		// loop through payment methods
938
-		foreach ( $this->checkout->available_payment_methods as $payment_method ) {
939
-			if ( $payment_method instanceof EE_Payment_Method ) {
938
+		foreach ($this->checkout->available_payment_methods as $payment_method) {
939
+			if ($payment_method instanceof EE_Payment_Method) {
940 940
 				$payment_method_button = EEH_HTML::img(
941 941
 					$payment_method->button_url(),
942 942
 					$payment_method->name(),
943
-					'spco-payment-method-' . $payment_method->slug() . '-btn-img',
943
+					'spco-payment-method-'.$payment_method->slug().'-btn-img',
944 944
 					'spco-payment-method-btn-img'
945 945
 				);
946 946
 				// check if any payment methods are set as default
947 947
 				// if payment method is already selected OR nothing is selected and this payment method should be open_by_default
948 948
 				if (
949
-					( $this->checkout->selected_method_of_payment === $payment_method->slug() )
950
-					|| ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )
949
+					($this->checkout->selected_method_of_payment === $payment_method->slug())
950
+					|| ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())
951 951
 				) {
952 952
 					$this->checkout->selected_method_of_payment = $payment_method->slug();
953 953
 					$this->_save_selected_method_of_payment();
954
-					$default_payment_method_option[ $payment_method->slug() ] = $payment_method_button;
954
+					$default_payment_method_option[$payment_method->slug()] = $payment_method_button;
955 955
 				} else {
956
-					$available_payment_method_options[ $payment_method->slug() ] = $payment_method_button;
956
+					$available_payment_method_options[$payment_method->slug()] = $payment_method_button;
957 957
 				}
958
-				$payment_methods_billing_info[ $payment_method->slug()
959
-				                               . '-info' ] = $this->_payment_method_billing_info(
958
+				$payment_methods_billing_info[$payment_method->slug()
959
+				                               . '-info'] = $this->_payment_method_billing_info(
960 960
 					$payment_method
961 961
 				);
962 962
 			}
@@ -986,12 +986,12 @@  discard block
 block discarded – undo
986 986
 	 * @return EE_Payment_Method[]
987 987
 	 */
988 988
 	protected function _get_available_payment_methods() {
989
-		if ( ! empty( $this->checkout->available_payment_methods ) ) {
989
+		if ( ! empty($this->checkout->available_payment_methods)) {
990 990
 			return $this->checkout->available_payment_methods;
991 991
 		}
992 992
 		$available_payment_methods = array();
993 993
 		// load EEM_Payment_Method
994
-		EE_Registry::instance()->load_model( 'Payment_Method' );
994
+		EE_Registry::instance()->load_model('Payment_Method');
995 995
 		/** @type EEM_Payment_Method $EEM_Payment_Method */
996 996
 		$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
997 997
 		// get all active payment methods
@@ -999,9 +999,9 @@  discard block
 block discarded – undo
999 999
 			$this->checkout->transaction,
1000 1000
 			EEM_Payment_Method::scope_cart
1001 1001
 		);
1002
-		foreach ( $payment_methods as $payment_method ) {
1003
-			if ( $payment_method instanceof EE_Payment_Method ) {
1004
-				$available_payment_methods[ $payment_method->slug() ] = $payment_method;
1002
+		foreach ($payment_methods as $payment_method) {
1003
+			if ($payment_method instanceof EE_Payment_Method) {
1004
+				$available_payment_methods[$payment_method->slug()] = $payment_method;
1005 1005
 			}
1006 1006
 		}
1007 1007
 		return $available_payment_methods;
@@ -1016,14 +1016,14 @@  discard block
 block discarded – undo
1016 1016
 	 * @param    array $available_payment_method_options
1017 1017
 	 * @return    \EE_Form_Section_Proper
1018 1018
 	 */
1019
-	private function _available_payment_method_inputs( $available_payment_method_options = array() ) {
1019
+	private function _available_payment_method_inputs($available_payment_method_options = array()) {
1020 1020
 		// generate inputs
1021 1021
 		return new EE_Form_Section_Proper(
1022 1022
 			array(
1023 1023
 				'html_id'         => 'ee-available-payment-method-inputs',
1024 1024
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1025 1025
 				'subsections'     => array(
1026
-					'' => new EE_Radio_Button_Input (
1026
+					'' => new EE_Radio_Button_Input(
1027 1027
 						$available_payment_method_options,
1028 1028
 						array(
1029 1029
 							'html_name'          => 'selected_method_of_payment',
@@ -1048,28 +1048,28 @@  discard block
 block discarded – undo
1048 1048
 	 * @return    \EE_Form_Section_Proper
1049 1049
 	 * @throws \EE_Error
1050 1050
 	 */
1051
-	private function _payment_method_billing_info( EE_Payment_Method $payment_method ) {
1051
+	private function _payment_method_billing_info(EE_Payment_Method $payment_method) {
1052 1052
 		$currently_selected = $this->checkout->selected_method_of_payment === $payment_method->slug()
1053 1053
 			? true
1054 1054
 			: false;
1055 1055
 		// generate the billing form for payment method
1056 1056
 		$billing_form = $currently_selected
1057
-			? $this->_get_billing_form_for_payment_method( $payment_method )
1057
+			? $this->_get_billing_form_for_payment_method($payment_method)
1058 1058
 			: new EE_Form_Section_HTML();
1059 1059
 		$this->checkout->billing_form = $currently_selected
1060 1060
 			? $billing_form
1061 1061
 			: $this->checkout->billing_form;
1062 1062
 		// it's all in the details
1063 1063
 		$info_html = EEH_HTML::h3(
1064
-			__( 'Important information regarding your payment', 'event_espresso' ),
1064
+			__('Important information regarding your payment', 'event_espresso'),
1065 1065
 			'',
1066 1066
 			'spco-payment-method-hdr'
1067 1067
 		);
1068 1068
 		// add some info regarding the step, either from what's saved in the admin,
1069 1069
 		// or a default string depending on whether the PM has a billing form or not
1070
-		if ( $payment_method->description() ) {
1070
+		if ($payment_method->description()) {
1071 1071
 			$payment_method_info = $payment_method->description();
1072
-		} elseif ( $billing_form instanceof EE_Billing_Info_Form ) {
1072
+		} elseif ($billing_form instanceof EE_Billing_Info_Form) {
1073 1073
 			$payment_method_info = sprintf(
1074 1074
 				__(
1075 1075
 					'Please provide the following billing information, then click the "%1$s" button below in order to proceed.',
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 			);
1080 1080
 		} else {
1081 1081
 			$payment_method_info = sprintf(
1082
-				__( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ),
1082
+				__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'),
1083 1083
 				$this->submit_button_text()
1084 1084
 			);
1085 1085
 		}
@@ -1093,13 +1093,13 @@  discard block
 block discarded – undo
1093 1093
 		);
1094 1094
 		return new EE_Form_Section_Proper(
1095 1095
 			array(
1096
-				'html_id'         => 'spco-payment-method-info-' . $payment_method->slug(),
1096
+				'html_id'         => 'spco-payment-method-info-'.$payment_method->slug(),
1097 1097
 				'html_class'      => 'spco-payment-method-info-dv',
1098 1098
 				// only display the selected or default PM
1099 1099
 				'html_style'      => $currently_selected ? '' : 'display:none;',
1100 1100
 				'layout_strategy' => new EE_Div_Per_Section_Layout(),
1101 1101
 				'subsections'     => array(
1102
-					'info'         => new EE_Form_Section_HTML( $info_html ),
1102
+					'info'         => new EE_Form_Section_HTML($info_html),
1103 1103
 					'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML()
1104 1104
 				)
1105 1105
 			)
@@ -1117,15 +1117,15 @@  discard block
 block discarded – undo
1117 1117
 	 */
1118 1118
 	public function get_billing_form_html_for_payment_method() {
1119 1119
 		// how have they chosen to pay?
1120
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1120
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1121 1121
 		$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
1122
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
1122
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
1123 1123
 			return false;
1124 1124
 		}
1125
-		if ( apply_filters(
1125
+		if (apply_filters(
1126 1126
 			'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1127 1127
 			false
1128
-		) ) {
1128
+		)) {
1129 1129
 			EE_Error::add_success(
1130 1130
 				apply_filters(
1131 1131
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 			);
1141 1141
 		}
1142 1142
 		// now generate billing form for selected method of payment
1143
-		$payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method );
1143
+		$payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method);
1144 1144
 		// fill form with attendee info if applicable
1145 1145
 		if (
1146 1146
 			$payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form
@@ -1162,10 +1162,10 @@  discard block
 block discarded – undo
1162 1162
 		$billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper
1163 1163
 			? $payment_method_billing_form->get_html()
1164 1164
 			: '';
1165
-		$this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ) );
1165
+		$this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info));
1166 1166
 		// localize validation rules for main form
1167 1167
 		$this->checkout->current_step->reg_form->localize_validation_rules();
1168
-		$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
1168
+		$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
1169 1169
 		return true;
1170 1170
 	}
1171 1171
 
@@ -1179,18 +1179,18 @@  discard block
 block discarded – undo
1179 1179
 	 * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML
1180 1180
 	 * @throws \EE_Error
1181 1181
 	 */
1182
-	private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) {
1182
+	private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) {
1183 1183
 		$billing_form = $payment_method->type_obj()->billing_form(
1184 1184
 			$this->checkout->transaction,
1185
-			array( 'amount_owing' => $this->checkout->amount_owing )
1185
+			array('amount_owing' => $this->checkout->amount_owing)
1186 1186
 		);
1187
-		if ( $billing_form instanceof EE_Billing_Info_Form ) {
1187
+		if ($billing_form instanceof EE_Billing_Info_Form) {
1188 1188
 			if (
1189 1189
 				apply_filters(
1190 1190
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1191 1191
 					false
1192 1192
 				)
1193
-				&& EE_Registry::instance()->REQ->is_set( 'payment_method' )
1193
+				&& EE_Registry::instance()->REQ->is_set('payment_method')
1194 1194
 			) {
1195 1195
 				EE_Error::add_success(
1196 1196
 					apply_filters(
@@ -1232,15 +1232,15 @@  discard block
 block discarded – undo
1232 1232
 		$request_param = 'selected_method_of_payment'
1233 1233
 	) {
1234 1234
 		// is selected_method_of_payment set in the request ?
1235
-		$selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, false );
1236
-		if ( $selected_method_of_payment ) {
1235
+		$selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, false);
1236
+		if ($selected_method_of_payment) {
1237 1237
 			// sanitize it
1238
-			$selected_method_of_payment = is_array( $selected_method_of_payment )
1239
-				? array_shift( $selected_method_of_payment )
1238
+			$selected_method_of_payment = is_array($selected_method_of_payment)
1239
+				? array_shift($selected_method_of_payment)
1240 1240
 				: $selected_method_of_payment;
1241
-			$selected_method_of_payment = sanitize_text_field( $selected_method_of_payment );
1241
+			$selected_method_of_payment = sanitize_text_field($selected_method_of_payment);
1242 1242
 			// store it in the session so that it's available for all subsequent requests including AJAX
1243
-			$this->_save_selected_method_of_payment( $selected_method_of_payment );
1243
+			$this->_save_selected_method_of_payment($selected_method_of_payment);
1244 1244
 		} else {
1245 1245
 			// or is is set in the session ?
1246 1246
 			$selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data(
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 			);
1249 1249
 		}
1250 1250
 		// do ya really really gotta have it?
1251
-		if ( empty( $selected_method_of_payment ) && $required ) {
1251
+		if (empty($selected_method_of_payment) && $required) {
1252 1252
 			EE_Error::add_error(
1253 1253
 				sprintf(
1254 1254
 					__(
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
 					),
1258 1258
 					'<br/>',
1259 1259
 					'<br/>',
1260
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1260
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1261 1261
 				),
1262 1262
 				__FILE__,
1263 1263
 				__FUNCTION__,
@@ -1284,13 +1284,13 @@  discard block
 block discarded – undo
1284 1284
 	 * @throws \EE_Error
1285 1285
 	 */
1286 1286
 	public function switch_payment_method() {
1287
-		if ( ! $this->_verify_payment_method_is_set() ) {
1287
+		if ( ! $this->_verify_payment_method_is_set()) {
1288 1288
 			return false;
1289 1289
 		}
1290
-		if ( apply_filters(
1290
+		if (apply_filters(
1291 1291
 			'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success',
1292 1292
 			false
1293
-		) ) {
1293
+		)) {
1294 1294
 			EE_Error::add_success(
1295 1295
 				apply_filters(
1296 1296
 					'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method',
@@ -1305,13 +1305,13 @@  discard block
 block discarded – undo
1305 1305
 			);
1306 1306
 		}
1307 1307
 		// generate billing form for selected method of payment if it hasn't been done already
1308
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1308
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
1309 1309
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1310 1310
 				$this->checkout->payment_method
1311 1311
 			);
1312 1312
 		}
1313 1313
 		// fill form with attendee info if applicable
1314
-		if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form
1314
+		if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form
1315 1315
 		     && $this->checkout->transaction_has_primary_registrant()
1316 1316
 		) {
1317 1317
 			$this->checkout->billing_form->populate_from_attendee(
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 			);
1320 1320
 		}
1321 1321
 		// and debug content
1322
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form
1322
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form
1323 1323
 		     && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base
1324 1324
 		) {
1325 1325
 			$this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings(
@@ -1327,15 +1327,15 @@  discard block
 block discarded – undo
1327 1327
 			);
1328 1328
 		}
1329 1329
 		// get html and validation rules for form
1330
-		if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) {
1330
+		if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) {
1331 1331
 			$this->checkout->json_response->set_return_data(
1332
-				array( 'payment_method_info' => $this->checkout->billing_form->get_html() )
1332
+				array('payment_method_info' => $this->checkout->billing_form->get_html())
1333 1333
 			);
1334 1334
 			// localize validation rules for main form
1335
-			$this->checkout->billing_form->localize_validation_rules( true );
1336
-			$this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() );
1335
+			$this->checkout->billing_form->localize_validation_rules(true);
1336
+			$this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization());
1337 1337
 		} else {
1338
-			$this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ) );
1338
+			$this->checkout->json_response->set_return_data(array('payment_method_info' => ''));
1339 1339
 		}
1340 1340
 		//prevents advancement to next step
1341 1341
 		$this->checkout->continue_reg = false;
@@ -1352,12 +1352,12 @@  discard block
 block discarded – undo
1352 1352
 	 */
1353 1353
 	protected function _verify_payment_method_is_set() {
1354 1354
 		// generate billing form for selected method of payment if it hasn't been done already
1355
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1355
+		if (empty($this->checkout->selected_method_of_payment)) {
1356 1356
 			// how have they chosen to pay?
1357
-			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
1357
+			$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
1358 1358
 		}
1359 1359
 		// verify payment method
1360
-		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) {
1360
+		if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) {
1361 1361
 			// get payment method for selected method of payment
1362 1362
 			$this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment();
1363 1363
 		}
@@ -1376,25 +1376,25 @@  discard block
 block discarded – undo
1376 1376
 	 * @throws \EE_Error
1377 1377
 	 */
1378 1378
 	public function save_payer_details_via_ajax() {
1379
-		if ( ! $this->_verify_payment_method_is_set() ) {
1379
+		if ( ! $this->_verify_payment_method_is_set()) {
1380 1380
 			return;
1381 1381
 		}
1382 1382
 		// generate billing form for selected method of payment if it hasn't been done already
1383
-		if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1383
+		if ($this->checkout->payment_method->type_obj()->has_billing_form()) {
1384 1384
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1385 1385
 				$this->checkout->payment_method
1386 1386
 			);
1387 1387
 		}
1388 1388
 		// generate primary attendee from payer info if applicable
1389
-		if ( ! $this->checkout->transaction_has_primary_registrant() ) {
1389
+		if ( ! $this->checkout->transaction_has_primary_registrant()) {
1390 1390
 			$attendee = $this->_create_attendee_from_request_data();
1391
-			if ( $attendee instanceof EE_Attendee ) {
1392
-				foreach ( $this->checkout->transaction->registrations() as $registration ) {
1393
-					if ( $registration->is_primary_registrant() ) {
1391
+			if ($attendee instanceof EE_Attendee) {
1392
+				foreach ($this->checkout->transaction->registrations() as $registration) {
1393
+					if ($registration->is_primary_registrant()) {
1394 1394
 						$this->checkout->primary_attendee_obj = $attendee;
1395
-						$registration->_add_relation_to( $attendee, 'Attendee' );
1396
-						$registration->set_attendee_id( $attendee->ID() );
1397
-						$registration->update_cache_after_object_save( 'Attendee', $attendee );
1395
+						$registration->_add_relation_to($attendee, 'Attendee');
1396
+						$registration->set_attendee_id($attendee->ID());
1397
+						$registration->update_cache_after_object_save('Attendee', $attendee);
1398 1398
 					}
1399 1399
 				}
1400 1400
 			}
@@ -1412,50 +1412,50 @@  discard block
 block discarded – undo
1412 1412
 	 */
1413 1413
 	protected function _create_attendee_from_request_data() {
1414 1414
 		// get State ID
1415
-		$STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : '';
1416
-		if ( ! empty( $STA_ID ) ) {
1415
+		$STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : '';
1416
+		if ( ! empty($STA_ID)) {
1417 1417
 			// can we get state object from name ?
1418
-			EE_Registry::instance()->load_model( 'State' );
1419
-			$state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1 ), 'STA_ID' );
1420
-			$STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID;
1418
+			EE_Registry::instance()->load_model('State');
1419
+			$state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID');
1420
+			$STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID;
1421 1421
 		}
1422 1422
 		// get Country ISO
1423
-		$CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : '';
1424
-		if ( ! empty( $CNT_ISO ) ) {
1423
+		$CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : '';
1424
+		if ( ! empty($CNT_ISO)) {
1425 1425
 			// can we get country object from name ?
1426
-			EE_Registry::instance()->load_model( 'Country' );
1426
+			EE_Registry::instance()->load_model('Country');
1427 1427
 			$country = EEM_Country::instance()->get_col(
1428
-				array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1 ),
1428
+				array(array('CNT_name' => $CNT_ISO), 'limit' => 1),
1429 1429
 				'CNT_ISO'
1430 1430
 			);
1431
-			$CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO;
1431
+			$CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO;
1432 1432
 		}
1433 1433
 		// grab attendee data
1434 1434
 		$attendee_data = array(
1435
-			'ATT_fname'    => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '',
1436
-			'ATT_lname'    => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '',
1437
-			'ATT_email'    => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '',
1438
-			'ATT_address'  => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '',
1439
-			'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '',
1440
-			'ATT_city'     => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '',
1435
+			'ATT_fname'    => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '',
1436
+			'ATT_lname'    => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '',
1437
+			'ATT_email'    => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '',
1438
+			'ATT_address'  => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '',
1439
+			'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '',
1440
+			'ATT_city'     => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '',
1441 1441
 			'STA_ID'       => $STA_ID,
1442 1442
 			'CNT_ISO'      => $CNT_ISO,
1443
-			'ATT_zip'      => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '',
1444
-			'ATT_phone'    => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '',
1443
+			'ATT_zip'      => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '',
1444
+			'ATT_phone'    => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '',
1445 1445
 		);
1446 1446
 		// validate the email address since it is the most important piece of info
1447
-		if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] !== $_REQUEST['email'] ) {
1447
+		if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] !== $_REQUEST['email']) {
1448 1448
 			EE_Error::add_error(
1449
-				__( 'An invalid email address was submitted.', 'event_espresso' ),
1449
+				__('An invalid email address was submitted.', 'event_espresso'),
1450 1450
 				__FILE__,
1451 1451
 				__FUNCTION__,
1452 1452
 				__LINE__
1453 1453
 			);
1454 1454
 		}
1455 1455
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1456
-		if ( ! empty( $attendee_data['ATT_fname'] )
1457
-		     && ! empty( $attendee_data['ATT_lname'] )
1458
-		     && ! empty( $attendee_data['ATT_email'] )
1456
+		if ( ! empty($attendee_data['ATT_fname'])
1457
+		     && ! empty($attendee_data['ATT_lname'])
1458
+		     && ! empty($attendee_data['ATT_email'])
1459 1459
 		) {
1460 1460
 			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(
1461 1461
 				array(
@@ -1464,19 +1464,19 @@  discard block
 block discarded – undo
1464 1464
 					'ATT_email' => $attendee_data['ATT_email']
1465 1465
 				)
1466 1466
 			);
1467
-			if ( $existing_attendee instanceof EE_Attendee ) {
1467
+			if ($existing_attendee instanceof EE_Attendee) {
1468 1468
 				return $existing_attendee;
1469 1469
 			}
1470 1470
 		}
1471 1471
 		// no existing attendee? kk let's create a new one
1472 1472
 		// kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist
1473
-		$attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] )
1473
+		$attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname'])
1474 1474
 			? $attendee_data['ATT_fname']
1475 1475
 			: $attendee_data['ATT_email'];
1476
-		$attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] )
1476
+		$attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname'])
1477 1477
 			? $attendee_data['ATT_lname']
1478 1478
 			: $attendee_data['ATT_email'];
1479
-		return EE_Attendee::new_instance( $attendee_data );
1479
+		return EE_Attendee::new_instance($attendee_data);
1480 1480
 	}
1481 1481
 
1482 1482
 
@@ -1494,26 +1494,26 @@  discard block
 block discarded – undo
1494 1494
 		// how have they chosen to pay?
1495 1495
 		$this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free()
1496 1496
 			? 'no_payment_required'
1497
-			: $this->_get_selected_method_of_payment( true );
1497
+			: $this->_get_selected_method_of_payment(true);
1498 1498
 		// choose your own adventure based on method_of_payment
1499
-		switch ( $this->checkout->selected_method_of_payment ) {
1499
+		switch ($this->checkout->selected_method_of_payment) {
1500 1500
 
1501 1501
 			case 'events_sold_out' :
1502 1502
 				$this->checkout->redirect = true;
1503 1503
 				$this->checkout->redirect_url = $this->checkout->cancel_page_url;
1504
-				$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1504
+				$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1505 1505
 				// mark this reg step as completed
1506 1506
 				$this->set_completed();
1507 1507
 				return false;
1508 1508
 				break;
1509 1509
 
1510 1510
 			case 'payments_closed' :
1511
-				if ( apply_filters(
1511
+				if (apply_filters(
1512 1512
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success',
1513 1513
 					false
1514
-				) ) {
1514
+				)) {
1515 1515
 					EE_Error::add_success(
1516
-						__( 'no payment required at this time.', 'event_espresso' ),
1516
+						__('no payment required at this time.', 'event_espresso'),
1517 1517
 						__FILE__,
1518 1518
 						__FUNCTION__,
1519 1519
 						__LINE__
@@ -1525,12 +1525,12 @@  discard block
 block discarded – undo
1525 1525
 				break;
1526 1526
 
1527 1527
 			case 'no_payment_required' :
1528
-				if ( apply_filters(
1528
+				if (apply_filters(
1529 1529
 					'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success',
1530 1530
 					false
1531
-				) ) {
1531
+				)) {
1532 1532
 					EE_Error::add_success(
1533
-						__( 'no payment required.', 'event_espresso' ),
1533
+						__('no payment required.', 'event_espresso'),
1534 1534
 						__FILE__,
1535 1535
 						__FUNCTION__,
1536 1536
 						__LINE__
@@ -1550,15 +1550,15 @@  discard block
 block discarded – undo
1550 1550
 					EE_Registry::instance()->SSN->checkout()->revisit
1551 1551
 				);
1552 1552
 				// calculate difference between the two arrays
1553
-				$registrations = array_diff( $registrations, $ejected_registrations );
1554
-				if ( empty( $registrations ) ) {
1553
+				$registrations = array_diff($registrations, $ejected_registrations);
1554
+				if (empty($registrations)) {
1555 1555
 					$this->_redirect_because_event_sold_out();
1556 1556
 					return false;
1557 1557
 				}
1558 1558
 				$payment_successful = $this->_process_payment();
1559
-				if ( $payment_successful ) {
1559
+				if ($payment_successful) {
1560 1560
 					$this->checkout->continue_reg = true;
1561
-					$this->_maybe_set_completed( $this->checkout->payment_method );
1561
+					$this->_maybe_set_completed($this->checkout->payment_method);
1562 1562
 				} else {
1563 1563
 					$this->checkout->continue_reg = false;
1564 1564
 				}
@@ -1579,10 +1579,10 @@  discard block
 block discarded – undo
1579 1579
 		$this->checkout->continue_reg = false;
1580 1580
 		// set redirect URL
1581 1581
 		$this->checkout->redirect_url = add_query_arg(
1582
-			array( 'e_reg_url_link' => $this->checkout->reg_url_link ),
1582
+			array('e_reg_url_link' => $this->checkout->reg_url_link),
1583 1583
 			$this->checkout->current_step->reg_step_url()
1584 1584
 		);
1585
-		$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1585
+		$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1586 1586
 	}
1587 1587
 
1588 1588
 
@@ -1595,8 +1595,8 @@  discard block
 block discarded – undo
1595 1595
 	 * @return void
1596 1596
 	 * @throws \EE_Error
1597 1597
 	 */
1598
-	protected function _maybe_set_completed( EE_Payment_Method $payment_method ) {
1599
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
1598
+	protected function _maybe_set_completed(EE_Payment_Method $payment_method) {
1599
+		switch ($payment_method->type_obj()->payment_occurs()) {
1600 1600
 			case EE_PMT_Base::offsite :
1601 1601
 				break;
1602 1602
 			case EE_PMT_Base::onsite :
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
 	public function update_reg_step() {
1620 1620
 		$success = true;
1621 1621
 		// if payment required
1622
-		if ( $this->checkout->transaction->total() > 0 ) {
1622
+		if ($this->checkout->transaction->total() > 0) {
1623 1623
 			do_action(
1624 1624
 				'AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway',
1625 1625
 				$this->checkout->transaction
@@ -1627,13 +1627,13 @@  discard block
 block discarded – undo
1627 1627
 			// attempt payment via payment method
1628 1628
 			$success = $this->process_reg_step();
1629 1629
 		}
1630
-		if ( $success && ! $this->checkout->redirect ) {
1630
+		if ($success && ! $this->checkout->redirect) {
1631 1631
 			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn(
1632 1632
 				$this->checkout->transaction->ID()
1633 1633
 			);
1634 1634
 			// set return URL
1635 1635
 			$this->checkout->redirect_url = add_query_arg(
1636
-				array( 'e_reg_url_link' => $this->checkout->reg_url_link ),
1636
+				array('e_reg_url_link' => $this->checkout->reg_url_link),
1637 1637
 				$this->checkout->thank_you_page_url
1638 1638
 			);
1639 1639
 		}
@@ -1653,28 +1653,28 @@  discard block
 block discarded – undo
1653 1653
 		// clear any previous errors related to not selecting a payment method
1654 1654
 //		EE_Error::overwrite_errors();
1655 1655
 		// ya gotta make a choice man
1656
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
1656
+		if (empty($this->checkout->selected_method_of_payment)) {
1657 1657
 			$this->checkout->json_response->set_plz_select_method_of_payment(
1658
-				__( 'Please select a method of payment before proceeding.', 'event_espresso' )
1658
+				__('Please select a method of payment before proceeding.', 'event_espresso')
1659 1659
 			);
1660 1660
 			return false;
1661 1661
 		}
1662 1662
 		// get EE_Payment_Method object
1663
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
1663
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
1664 1664
 			return false;
1665 1665
 		}
1666 1666
 		// setup billing form
1667
-		if ( $this->checkout->payment_method->is_on_site() ) {
1667
+		if ($this->checkout->payment_method->is_on_site()) {
1668 1668
 			$this->checkout->billing_form = $this->_get_billing_form_for_payment_method(
1669 1669
 				$this->checkout->payment_method
1670 1670
 			);
1671 1671
 			// bad billing form ?
1672
-			if ( ! $this->_billing_form_is_valid() ) {
1672
+			if ( ! $this->_billing_form_is_valid()) {
1673 1673
 				return false;
1674 1674
 			}
1675 1675
 		}
1676 1676
 		// ensure primary registrant has been fully processed
1677
-		if ( ! $this->_setup_primary_registrant_prior_to_payment() ) {
1677
+		if ( ! $this->_setup_primary_registrant_prior_to_payment()) {
1678 1678
 			return false;
1679 1679
 		}
1680 1680
 		/** @type EE_Transaction_Processor $transaction_processor */
@@ -1682,18 +1682,18 @@  discard block
 block discarded – undo
1682 1682
 		// in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved
1683 1683
 		//$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params );
1684 1684
 		// attempt payment
1685
-		$payment = $this->_attempt_payment( $this->checkout->payment_method );
1685
+		$payment = $this->_attempt_payment($this->checkout->payment_method);
1686 1686
 		// process results
1687
-		$payment = $this->_validate_payment( $payment );
1688
-		$payment = $this->_post_payment_processing( $payment );
1687
+		$payment = $this->_validate_payment($payment);
1688
+		$payment = $this->_post_payment_processing($payment);
1689 1689
 		// verify payment
1690
-		if ( $payment instanceof EE_Payment ) {
1690
+		if ($payment instanceof EE_Payment) {
1691 1691
 			// store that for later
1692 1692
 			$this->checkout->payment = $payment;
1693 1693
 			/** @type EE_Transaction_Processor $transaction_processor */
1694
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1694
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1695 1695
 			// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1696
-			$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1696
+			$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1697 1697
 			$payment_status = $payment->status();
1698 1698
 			if (
1699 1699
 				$payment_status === EEM_Payment::status_id_approved
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 			} else {
1704 1704
 				return false;
1705 1705
 			}
1706
-		} else if ( $payment === true ) {
1706
+		} else if ($payment === true) {
1707 1707
 			// please note that offline payment methods will NOT make a payment,
1708 1708
 			// but instead just mark themselves as the PMD_ID on the transaction, and return true
1709 1709
 			$this->checkout->payment = $payment;
@@ -1728,7 +1728,7 @@  discard block
 block discarded – undo
1728 1728
 		);
1729 1729
 		$html = $payment_method_billing_info->get_html_and_js();
1730 1730
 		$html .= $this->checkout->redirect_form;
1731
-		EE_Registry::instance()->REQ->add_output( $html );
1731
+		EE_Registry::instance()->REQ->add_output($html);
1732 1732
 		return true;
1733 1733
 	}
1734 1734
 
@@ -1742,28 +1742,28 @@  discard block
 block discarded – undo
1742 1742
 	 * @throws \EE_Error
1743 1743
 	 */
1744 1744
 	private function _billing_form_is_valid() {
1745
-		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) {
1745
+		if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) {
1746 1746
 			return true;
1747 1747
 		}
1748
-		if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) {
1749
-			if ( $this->checkout->billing_form->was_submitted() ) {
1748
+		if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) {
1749
+			if ($this->checkout->billing_form->was_submitted()) {
1750 1750
 				$this->checkout->billing_form->receive_form_submission();
1751
-				if ( $this->checkout->billing_form->is_valid() ) {
1751
+				if ($this->checkout->billing_form->is_valid()) {
1752 1752
 					return true;
1753 1753
 				}
1754 1754
 				$validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated();
1755 1755
 				$error_strings = array();
1756
-				foreach ( $validation_errors as $validation_error ) {
1757
-					if ( $validation_error instanceof EE_Validation_Error ) {
1756
+				foreach ($validation_errors as $validation_error) {
1757
+					if ($validation_error instanceof EE_Validation_Error) {
1758 1758
 						$form_section = $validation_error->get_form_section();
1759
-						if ( $form_section instanceof EE_Form_Input_Base ) {
1759
+						if ($form_section instanceof EE_Form_Input_Base) {
1760 1760
 							$label = $form_section->html_label_text();
1761
-						} elseif ( $form_section instanceof EE_Form_Section_Base ) {
1761
+						} elseif ($form_section instanceof EE_Form_Section_Base) {
1762 1762
 							$label = $form_section->name();
1763 1763
 						} else {
1764
-							$label = __( 'Validation Error', 'event_espresso' );
1764
+							$label = __('Validation Error', 'event_espresso');
1765 1765
 						}
1766
-						$error_strings[] = sprintf( '%1$s: %2$s', $label, $validation_error->getMessage() );
1766
+						$error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage());
1767 1767
 					}
1768 1768
 				}
1769 1769
 				EE_Error::add_error(
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 							'event_espresso'
1774 1774
 						),
1775 1775
 						'<br/>',
1776
-						implode( '<br/>', $error_strings )
1776
+						implode('<br/>', $error_strings)
1777 1777
 					),
1778 1778
 					__FILE__,
1779 1779
 					__FUNCTION__,
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
 			}
1793 1793
 		} else {
1794 1794
 			EE_Error::add_error(
1795
-				__( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ),
1795
+				__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'),
1796 1796
 				__FILE__,
1797 1797
 				__FUNCTION__,
1798 1798
 				__LINE__
@@ -1827,13 +1827,13 @@  discard block
 block discarded – undo
1827 1827
 		// grab the primary_registration object
1828 1828
 		$primary_registration = $this->checkout->transaction->primary_registration();
1829 1829
 		/** @type EE_Transaction_Processor $transaction_processor */
1830
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1830
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1831 1831
 		// at this point we'll consider a TXN to not have been failed
1832
-		$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1832
+		$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1833 1833
 		// save the TXN ( which clears cached copy of primary_registration)
1834 1834
 		$this->checkout->transaction->save();
1835 1835
 		// grab TXN ID and save it to the primary_registration
1836
-		$primary_registration->set_transaction_id( $this->checkout->transaction->ID() );
1836
+		$primary_registration->set_transaction_id($this->checkout->transaction->ID());
1837 1837
 		// save what we have so far
1838 1838
 		$primary_registration->save();
1839 1839
 		return true;
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
 	private function _capture_primary_registration_data_from_billing_form() {
1852 1852
 		// convert billing form data into an attendee
1853 1853
 		$this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data();
1854
-		if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) {
1854
+		if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) {
1855 1855
 			EE_Error::add_error(
1856 1856
 				sprintf(
1857 1857
 					__(
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
 						'event_espresso'
1860 1860
 					),
1861 1861
 					'<br/>',
1862
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1862
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1863 1863
 				),
1864 1864
 				__FILE__,
1865 1865
 				__FUNCTION__,
@@ -1868,7 +1868,7 @@  discard block
 block discarded – undo
1868 1868
 			return false;
1869 1869
 		}
1870 1870
 		$primary_registration = $this->checkout->transaction->primary_registration();
1871
-		if ( ! $primary_registration instanceof EE_Registration ) {
1871
+		if ( ! $primary_registration instanceof EE_Registration) {
1872 1872
 			EE_Error::add_error(
1873 1873
 				sprintf(
1874 1874
 					__(
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
 						'event_espresso'
1877 1877
 					),
1878 1878
 					'<br/>',
1879
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1879
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1880 1880
 				),
1881 1881
 				__FILE__,
1882 1882
 				__FUNCTION__,
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 			);
1885 1885
 			return false;
1886 1886
 		}
1887
-		if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' )
1887
+		if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee')
1888 1888
 		       instanceof
1889 1889
 		       EE_Attendee
1890 1890
 		) {
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
 						'event_espresso'
1896 1896
 					),
1897 1897
 					'<br/>',
1898
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1898
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1899 1899
 				),
1900 1900
 				__FILE__,
1901 1901
 				__FUNCTION__,
@@ -1904,9 +1904,9 @@  discard block
 block discarded – undo
1904 1904
 			return false;
1905 1905
 		}
1906 1906
 		/** @type EE_Registration_Processor $registration_processor */
1907
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1907
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1908 1908
 		// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1909
-		$registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration );
1909
+		$registration_processor->toggle_incomplete_registration_status_to_default($primary_registration);
1910 1910
 		return true;
1911 1911
 	}
1912 1912
 
@@ -1921,22 +1921,22 @@  discard block
 block discarded – undo
1921 1921
 	 * @throws \EE_Error
1922 1922
 	 */
1923 1923
 	private function _get_payment_method_for_selected_method_of_payment() {
1924
-		if ( $this->checkout->selected_method_of_payment === 'events_sold_out' ) {
1924
+		if ($this->checkout->selected_method_of_payment === 'events_sold_out') {
1925 1925
 			$this->_redirect_because_event_sold_out();
1926 1926
 			return null;
1927 1927
 		}
1928 1928
 		// get EE_Payment_Method object
1929
-		if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] ) ) {
1930
-			$payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ];
1929
+		if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) {
1930
+			$payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment];
1931 1931
 		} else {
1932 1932
 			// load EEM_Payment_Method
1933
-			EE_Registry::instance()->load_model( 'Payment_Method' );
1933
+			EE_Registry::instance()->load_model('Payment_Method');
1934 1934
 			/** @type EEM_Payment_Method $EEM_Payment_Method */
1935 1935
 			$EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method;
1936
-			$payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment );
1936
+			$payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment);
1937 1937
 		}
1938 1938
 		// verify $payment_method
1939
-		if ( ! $payment_method instanceof EE_Payment_Method ) {
1939
+		if ( ! $payment_method instanceof EE_Payment_Method) {
1940 1940
 			// not a payment
1941 1941
 			EE_Error::add_error(
1942 1942
 				sprintf(
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
 						'event_espresso'
1946 1946
 					),
1947 1947
 					'<br/>',
1948
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1948
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1949 1949
 				),
1950 1950
 				__FILE__,
1951 1951
 				__FUNCTION__,
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 			return null;
1955 1955
 		}
1956 1956
 		// and verify it has a valid Payment_Method Type object
1957
-		if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) {
1957
+		if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) {
1958 1958
 			// not a payment
1959 1959
 			EE_Error::add_error(
1960 1960
 				sprintf(
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
 						'event_espresso'
1964 1964
 					),
1965 1965
 					'<br/>',
1966
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
1966
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
1967 1967
 				),
1968 1968
 				__FILE__,
1969 1969
 				__FUNCTION__,
@@ -1984,29 +1984,29 @@  discard block
 block discarded – undo
1984 1984
 	 * @return    mixed    EE_Payment | boolean
1985 1985
 	 * @throws \EE_Error
1986 1986
 	 */
1987
-	private function _attempt_payment( EE_Payment_Method $payment_method ) {
1987
+	private function _attempt_payment(EE_Payment_Method $payment_method) {
1988 1988
 		$payment = null;
1989 1989
 		$this->checkout->transaction->save();
1990
-		$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1991
-		if ( ! $payment_processor instanceof EE_Payment_Processor ) {
1990
+		$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1991
+		if ( ! $payment_processor instanceof EE_Payment_Processor) {
1992 1992
 			return false;
1993 1993
 		}
1994 1994
 		try {
1995
-			$payment_processor->set_revisit( $this->checkout->revisit );
1995
+			$payment_processor->set_revisit($this->checkout->revisit);
1996 1996
 			// generate payment object
1997 1997
 			$payment = $payment_processor->process_payment(
1998 1998
 				$payment_method,
1999 1999
 				$this->checkout->transaction,
2000 2000
 				$this->checkout->amount_owing,
2001 2001
 				$this->checkout->billing_form,
2002
-				$this->_get_return_url( $payment_method ),
2002
+				$this->_get_return_url($payment_method),
2003 2003
 				'CART',
2004 2004
 				$this->checkout->admin_request,
2005 2005
 				true,
2006 2006
 				$this->reg_step_url()
2007 2007
 			);
2008
-		} catch ( Exception $e ) {
2009
-			$this->_handle_payment_processor_exception( $e );
2008
+		} catch (Exception $e) {
2009
+			$this->_handle_payment_processor_exception($e);
2010 2010
 		}
2011 2011
 		return $payment;
2012 2012
 	}
@@ -2021,7 +2021,7 @@  discard block
 block discarded – undo
2021 2021
 	 * @return void
2022 2022
 	 * @throws \EE_Error
2023 2023
 	 */
2024
-	protected function _handle_payment_processor_exception( Exception $e ) {
2024
+	protected function _handle_payment_processor_exception(Exception $e) {
2025 2025
 		EE_Error::add_error(
2026 2026
 			sprintf(
2027 2027
 				__(
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
 					'event_espresso'
2030 2030
 				),
2031 2031
 				'<br/>',
2032
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' ),
2032
+				EE_Registry::instance()->CFG->organization->get_pretty('email'),
2033 2033
 				$e->getMessage(),
2034 2034
 				$e->getFile(),
2035 2035
 				$e->getLine()
@@ -2050,9 +2050,9 @@  discard block
 block discarded – undo
2050 2050
 	 * @return string
2051 2051
 	 * @throws \EE_Error
2052 2052
 	 */
2053
-	protected function _get_return_url( EE_Payment_Method $payment_method ) {
2053
+	protected function _get_return_url(EE_Payment_Method $payment_method) {
2054 2054
 		$return_url = '';
2055
-		switch ( $payment_method->type_obj()->payment_occurs() ) {
2055
+		switch ($payment_method->type_obj()->payment_occurs()) {
2056 2056
 			case EE_PMT_Base::offsite :
2057 2057
 				$return_url = add_query_arg(
2058 2058
 					array(
@@ -2081,12 +2081,12 @@  discard block
 block discarded – undo
2081 2081
 	 * @return EE_Payment | FALSE
2082 2082
 	 * @throws \EE_Error
2083 2083
 	 */
2084
-	private function _validate_payment( $payment = null ) {
2085
-		if ( $this->checkout->payment_method->is_off_line() ) {
2084
+	private function _validate_payment($payment = null) {
2085
+		if ($this->checkout->payment_method->is_off_line()) {
2086 2086
 			return true;
2087 2087
 		}
2088 2088
 		// verify payment object
2089
-		if ( ! $payment instanceof EE_Payment ) {
2089
+		if ( ! $payment instanceof EE_Payment) {
2090 2090
 			// not a payment
2091 2091
 			EE_Error::add_error(
2092 2092
 				sprintf(
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
 						'event_espresso'
2096 2096
 					),
2097 2097
 					'<br/>',
2098
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2098
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2099 2099
 				),
2100 2100
 				__FILE__,
2101 2101
 				__FUNCTION__,
@@ -2116,27 +2116,27 @@  discard block
 block discarded – undo
2116 2116
 	 * @return bool
2117 2117
 	 * @throws \EE_Error
2118 2118
 	 */
2119
-	private function _post_payment_processing( $payment = null ) {
2119
+	private function _post_payment_processing($payment = null) {
2120 2120
 		// Off-Line payment?
2121
-		if ( $payment === true ) {
2121
+		if ($payment === true) {
2122 2122
 			//$this->_setup_redirect_for_next_step();
2123 2123
 			return true;
2124 2124
 		// On-Site payment?
2125
-		} else if ( $this->checkout->payment_method->is_on_site() ) {
2126
-			if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite ) ) {
2125
+		} else if ($this->checkout->payment_method->is_on_site()) {
2126
+			if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) {
2127 2127
 				//$this->_setup_redirect_for_next_step();
2128 2128
 				$this->checkout->continue_reg = false;
2129 2129
 			}
2130 2130
 		// Off-Site payment?
2131
-		} else if ( $this->checkout->payment_method->is_off_site() ) {
2131
+		} else if ($this->checkout->payment_method->is_off_site()) {
2132 2132
 			// if a payment object was made and it specifies a redirect url, then we'll setup that redirect info
2133
-			if ( $payment instanceof EE_Payment && $payment->redirect_url() ) {
2134
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' );
2133
+			if ($payment instanceof EE_Payment && $payment->redirect_url()) {
2134
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()');
2135 2135
 				$this->checkout->redirect = true;
2136 2136
 				$this->checkout->redirect_form = $payment->redirect_form();
2137
-				$this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' );
2137
+				$this->checkout->redirect_url = $this->reg_step_url('redirect_form');
2138 2138
 				// set JSON response
2139
-				$this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form );
2139
+				$this->checkout->json_response->set_redirect_form($this->checkout->redirect_form);
2140 2140
 				// set cron job for finalizing the TXN
2141 2141
 				// in case the user does not return from the off-site gateway
2142 2142
 				EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
 					$this->checkout->transaction->ID()
2145 2145
 				);
2146 2146
 				// and lastly, let's bump the payment status to pending
2147
-				$payment->set_status( EEM_Payment::status_id_pending );
2147
+				$payment->set_status(EEM_Payment::status_id_pending);
2148 2148
 				$payment->save();
2149 2149
 			} else {
2150 2150
 				// not a payment
@@ -2156,7 +2156,7 @@  discard block
 block discarded – undo
2156 2156
 							'event_espresso'
2157 2157
 						),
2158 2158
 						'<br/>',
2159
-						EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2159
+						EE_Registry::instance()->CFG->organization->get_pretty('email')
2160 2160
 					),
2161 2161
 					__FILE__,
2162 2162
 					__FUNCTION__,
@@ -2194,21 +2194,21 @@  discard block
 block discarded – undo
2194 2194
 	 * @return bool
2195 2195
 	 * @throws \EE_Error
2196 2196
 	 */
2197
-	private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) {
2197
+	private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) {
2198 2198
 		// off-line payment? carry on
2199
-		if ( $payment_occurs === EE_PMT_Base::offline ) {
2199
+		if ($payment_occurs === EE_PMT_Base::offline) {
2200 2200
 			return true;
2201 2201
 		}
2202 2202
 		// verify payment validity
2203
-		if ( $payment instanceof EE_Payment ) {
2204
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' );
2203
+		if ($payment instanceof EE_Payment) {
2204
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()');
2205 2205
 			$msg = $payment->gateway_response();
2206 2206
 			// check results
2207
-			switch ( $payment->status() ) {
2207
+			switch ($payment->status()) {
2208 2208
 				// good payment
2209 2209
 				case EEM_Payment::status_id_approved :
2210 2210
 					EE_Error::add_success(
2211
-						__( 'Your payment was processed successfully.', 'event_espresso' ),
2211
+						__('Your payment was processed successfully.', 'event_espresso'),
2212 2212
 						__FILE__,
2213 2213
 						__FUNCTION__,
2214 2214
 						__LINE__
@@ -2217,45 +2217,45 @@  discard block
 block discarded – undo
2217 2217
 					break;
2218 2218
 				// slow payment
2219 2219
 				case EEM_Payment::status_id_pending :
2220
-					if ( empty( $msg ) ) {
2220
+					if (empty($msg)) {
2221 2221
 						$msg = __(
2222 2222
 							'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.',
2223 2223
 							'event_espresso'
2224 2224
 						);
2225 2225
 					}
2226
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
2226
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
2227 2227
 					return true;
2228 2228
 					break;
2229 2229
 				// don't wanna payment
2230 2230
 				case EEM_Payment::status_id_cancelled :
2231
-					if ( empty( $msg ) ) {
2231
+					if (empty($msg)) {
2232 2232
 						$msg = _n(
2233 2233
 							'Payment cancelled. Please try again.',
2234 2234
 							'Payment cancelled. Please try again or select another method of payment.',
2235
-							count( $this->checkout->available_payment_methods ),
2235
+							count($this->checkout->available_payment_methods),
2236 2236
 							'event_espresso'
2237 2237
 						);
2238 2238
 					}
2239
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
2239
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
2240 2240
 					return false;
2241 2241
 					break;
2242 2242
 				// not enough payment
2243 2243
 				case EEM_Payment::status_id_declined :
2244
-					if ( empty( $msg ) ) {
2244
+					if (empty($msg)) {
2245 2245
 						$msg = _n(
2246 2246
 							'We\'re sorry but your payment was declined. Please try again.',
2247 2247
 							'We\'re sorry but your payment was declined. Please try again or select another method of payment.',
2248
-							count( $this->checkout->available_payment_methods ),
2248
+							count($this->checkout->available_payment_methods),
2249 2249
 							'event_espresso'
2250 2250
 						);
2251 2251
 					}
2252
-					EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
2252
+					EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
2253 2253
 					return false;
2254 2254
 					break;
2255 2255
 				// bad payment
2256 2256
 				case EEM_Payment::status_id_failed :
2257
-					if ( ! empty( $msg ) ) {
2258
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2257
+					if ( ! empty($msg)) {
2258
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2259 2259
 						return false;
2260 2260
 					}
2261 2261
 					// default to error below
@@ -2264,7 +2264,7 @@  discard block
 block discarded – undo
2264 2264
 		}
2265 2265
 		// off-site payment gateway responses are too unreliable, so let's just assume that
2266 2266
 		// the payment processing is just running slower than the registrant's request
2267
-		if ( $payment_occurs === EE_PMT_Base::offsite ) {
2267
+		if ($payment_occurs === EE_PMT_Base::offsite) {
2268 2268
 			return true;
2269 2269
 		}
2270 2270
 		EE_Error::add_error(
@@ -2274,7 +2274,7 @@  discard block
 block discarded – undo
2274 2274
 					'event_espresso'
2275 2275
 				),
2276 2276
 				'<br/>',
2277
-				EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2277
+				EE_Registry::instance()->CFG->organization->get_pretty('email')
2278 2278
 			),
2279 2279
 			__FILE__,
2280 2280
 			__FUNCTION__,
@@ -2307,13 +2307,13 @@  discard block
 block discarded – undo
2307 2307
 	public function process_gateway_response() {
2308 2308
 		$payment = null;
2309 2309
 		// how have they chosen to pay?
2310
-		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true );
2310
+		$this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true);
2311 2311
 		// get EE_Payment_Method object
2312
-		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) {
2312
+		if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) {
2313 2313
 			$this->checkout->continue_reg = false;
2314 2314
 			return false;
2315 2315
 		}
2316
-		if ( ! $this->checkout->payment_method->is_off_site() ) {
2316
+		if ( ! $this->checkout->payment_method->is_off_site()) {
2317 2317
 			return false;
2318 2318
 		}
2319 2319
 		$this->_validate_offsite_return();
@@ -2327,23 +2327,23 @@  discard block
 block discarded – undo
2327 2327
 		//	true
2328 2328
 		//);
2329 2329
 		// verify TXN
2330
-		if ( $this->checkout->transaction instanceof EE_Transaction ) {
2330
+		if ($this->checkout->transaction instanceof EE_Transaction) {
2331 2331
 			$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
2332
-			if ( ! $gateway instanceof EE_Offsite_Gateway ) {
2332
+			if ( ! $gateway instanceof EE_Offsite_Gateway) {
2333 2333
 				$this->checkout->continue_reg = false;
2334 2334
 				return false;
2335 2335
 			}
2336
-			$payment = $this->_process_off_site_payment( $gateway );
2337
-			$payment = $this->_process_cancelled_payments( $payment );
2338
-			$payment = $this->_validate_payment( $payment );
2336
+			$payment = $this->_process_off_site_payment($gateway);
2337
+			$payment = $this->_process_cancelled_payments($payment);
2338
+			$payment = $this->_validate_payment($payment);
2339 2339
 			// if payment was not declined by the payment gateway or cancelled by the registrant
2340
-			if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) {
2340
+			if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) {
2341 2341
 				//$this->_setup_redirect_for_next_step();
2342 2342
 				// store that for later
2343 2343
 				$this->checkout->payment = $payment;
2344 2344
 				// mark this reg step as completed, as long as gateway doesn't use a separate IPN request,
2345 2345
 				// because we will complete this step during the IPN processing then
2346
-				if ( $gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request() ) {
2346
+				if ($gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request()) {
2347 2347
 					$this->set_completed();
2348 2348
 				}
2349 2349
 				return true;
@@ -2367,21 +2367,21 @@  discard block
 block discarded – undo
2367 2367
 	 * @throws \EE_Error
2368 2368
 	 */
2369 2369
 	private function _validate_offsite_return() {
2370
-		$TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 );
2371
-		if ( $TXN_ID !== $this->checkout->transaction->ID() ) {
2370
+		$TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0);
2371
+		if ($TXN_ID !== $this->checkout->transaction->ID()) {
2372 2372
 			// Houston... we might have a problem
2373 2373
 			$invalid_TXN = false;
2374 2374
 			// first gather some info
2375
-			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
2375
+			$valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
2376 2376
 			$primary_registrant = $valid_TXN instanceof EE_Transaction
2377 2377
 				? $valid_TXN->primary_registration()
2378 2378
 				: null;
2379 2379
 			// let's start by retrieving the cart for this TXN
2380
-			$cart = $this->checkout->get_cart_for_transaction( $this->checkout->transaction );
2381
-			if ( $cart instanceof EE_Cart ) {
2380
+			$cart = $this->checkout->get_cart_for_transaction($this->checkout->transaction);
2381
+			if ($cart instanceof EE_Cart) {
2382 2382
 				// verify that the current cart has tickets
2383 2383
 				$tickets = $cart->get_tickets();
2384
-				if ( empty( $tickets ) ) {
2384
+				if (empty($tickets)) {
2385 2385
 					$invalid_TXN = true;
2386 2386
 				}
2387 2387
 			} else {
@@ -2391,39 +2391,39 @@  discard block
 block discarded – undo
2391 2391
 				? $primary_registrant->session_ID()
2392 2392
 				: null;
2393 2393
 			// validate current Session ID and compare against valid TXN session ID
2394
-			if ( EE_Session::instance()->id() === null ) {
2394
+			if (EE_Session::instance()->id() === null) {
2395 2395
 				$invalid_TXN = true;
2396
-			} else if ( EE_Session::instance()->id() === $valid_TXN_SID ) {
2396
+			} else if (EE_Session::instance()->id() === $valid_TXN_SID) {
2397 2397
 				// WARNING !!!
2398 2398
 				// this could be PayPal sending back duplicate requests (ya they do that)
2399 2399
 				// or it **could** mean someone is simply registering AGAIN after having just done so
2400 2400
 				// so now we need to determine if this current TXN looks valid or not
2401 2401
 				/** @type EE_Transaction_Processor $transaction_processor */
2402
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
2402
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
2403 2403
 				// has this step even been started ?
2404
-				if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false )
2404
+				if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false)
2405 2405
 				) {
2406 2406
 					// really? you're half way through this reg step, but you never started it ?
2407 2407
 					$invalid_TXN = true;
2408 2408
 				}
2409 2409
 			}
2410
-			if ( $invalid_TXN ) {
2410
+			if ($invalid_TXN) {
2411 2411
 				// is the valid TXN completed ?
2412
-				if ( $valid_TXN instanceof EE_Transaction ) {
2412
+				if ($valid_TXN instanceof EE_Transaction) {
2413 2413
 					/** @type EE_Transaction_Processor $transaction_processor */
2414
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
2414
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
2415 2415
 					// has this step even been started ?
2416
-					$reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() );
2417
-					if ( $reg_step_completed !== false && $reg_step_completed !== true ) {
2416
+					$reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug());
2417
+					if ($reg_step_completed !== false && $reg_step_completed !== true) {
2418 2418
 						// so it **looks** like this is a double request from PayPal
2419 2419
 						// so let's try to pick up where we left off
2420 2420
 						$this->checkout->transaction = $valid_TXN;
2421
-						$this->checkout->refresh_all_entities( true );
2421
+						$this->checkout->refresh_all_entities(true);
2422 2422
 						return;
2423 2423
 					}
2424 2424
 				}
2425 2425
 				// you appear to be lost?
2426
-				$this->_redirect_wayward_request( $primary_registrant );
2426
+				$this->_redirect_wayward_request($primary_registrant);
2427 2427
 			}
2428 2428
 		}
2429 2429
 	}
@@ -2438,14 +2438,14 @@  discard block
 block discarded – undo
2438 2438
 	 * @return bool
2439 2439
 	 * @throws \EE_Error
2440 2440
 	 */
2441
-	private function _redirect_wayward_request( EE_Registration $primary_registrant ) {
2442
-		if ( ! $primary_registrant instanceof EE_Registration ) {
2441
+	private function _redirect_wayward_request(EE_Registration $primary_registrant) {
2442
+		if ( ! $primary_registrant instanceof EE_Registration) {
2443 2443
 			// try redirecting based on the current TXN
2444 2444
 			$primary_registrant = $this->checkout->transaction instanceof EE_Transaction
2445 2445
 				? $this->checkout->transaction->primary_registration()
2446 2446
 				: null;
2447 2447
 		}
2448
-		if ( ! $primary_registrant instanceof EE_Registration ) {
2448
+		if ( ! $primary_registrant instanceof EE_Registration) {
2449 2449
 			EE_Error::add_error(
2450 2450
 				sprintf(
2451 2451
 					__(
@@ -2453,7 +2453,7 @@  discard block
 block discarded – undo
2453 2453
 						'event_espresso'
2454 2454
 					),
2455 2455
 					'<br/>',
2456
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
2456
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
2457 2457
 				),
2458 2458
 				__FILE__,
2459 2459
 				__FUNCTION__,
@@ -2484,17 +2484,17 @@  discard block
 block discarded – undo
2484 2484
 	 * @return \EE_Payment
2485 2485
 	 * @throws \EE_Error
2486 2486
 	 */
2487
-	private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) {
2487
+	private function _process_off_site_payment(EE_Offsite_Gateway $gateway) {
2488 2488
 		try {
2489 2489
 			$request_data = \EE_Registry::instance()->REQ->params();
2490 2490
 			// if gateway uses_separate_IPN_request, then we don't have to process the IPN manually
2491 2491
 			$this->set_handle_IPN_in_this_request(
2492
-				$gateway->handle_IPN_in_this_request( $request_data, false )
2492
+				$gateway->handle_IPN_in_this_request($request_data, false)
2493 2493
 			);
2494
-			if ( $this->handle_IPN_in_this_request() ) {
2494
+			if ($this->handle_IPN_in_this_request()) {
2495 2495
 				// get payment details and process results
2496 2496
 				/** @type EE_Payment_Processor $payment_processor */
2497
-				$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
2497
+				$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
2498 2498
 				$payment = $payment_processor->process_ipn(
2499 2499
 					$request_data,
2500 2500
 					$this->checkout->transaction,
@@ -2507,14 +2507,14 @@  discard block
 block discarded – undo
2507 2507
 				$payment = $this->checkout->transaction->last_payment();
2508 2508
 				//$payment_source = 'last_payment';
2509 2509
 			}
2510
-		} catch ( Exception $e ) {
2510
+		} catch (Exception $e) {
2511 2511
 			// let's just eat the exception and try to move on using any previously set payment info
2512 2512
 			$payment = $this->checkout->transaction->last_payment();
2513 2513
 			//$payment_source = 'last_payment after Exception';
2514 2514
 			// but if we STILL don't have a payment object
2515
-			if ( ! $payment instanceof EE_Payment ) {
2515
+			if ( ! $payment instanceof EE_Payment) {
2516 2516
 				// then we'll object ! ( not object like a thing... but object like what a lawyer says ! )
2517
-				$this->_handle_payment_processor_exception( $e );
2517
+				$this->_handle_payment_processor_exception($e);
2518 2518
 			}
2519 2519
 		}
2520 2520
 		// DEBUG LOG
@@ -2539,13 +2539,13 @@  discard block
 block discarded – undo
2539 2539
 	 * @return EE_Payment | FALSE
2540 2540
 	 * @throws \EE_Error
2541 2541
 	 */
2542
-	private function _process_cancelled_payments( $payment = null ) {
2542
+	private function _process_cancelled_payments($payment = null) {
2543 2543
 		if (
2544 2544
 			$payment instanceof EE_Payment
2545
-			&& isset( $_REQUEST['ee_cancel_payment'] )
2545
+			&& isset($_REQUEST['ee_cancel_payment'])
2546 2546
 			&& $payment->status() === EEM_Payment::status_id_failed
2547 2547
 		) {
2548
-			$payment->set_status( EEM_Payment::status_id_cancelled );
2548
+			$payment->set_status(EEM_Payment::status_id_cancelled);
2549 2549
 		}
2550 2550
 		return $payment;
2551 2551
 	}
@@ -2562,14 +2562,14 @@  discard block
 block discarded – undo
2562 2562
 	public function get_transaction_details_for_gateways() {
2563 2563
 		$txn_details = array();
2564 2564
 		// ya gotta make a choice man
2565
-		if ( empty( $this->checkout->selected_method_of_payment ) ) {
2565
+		if (empty($this->checkout->selected_method_of_payment)) {
2566 2566
 			$txn_details = array(
2567
-				'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' )
2567
+				'error' => __('Please select a method of payment before proceeding.', 'event_espresso')
2568 2568
 			);
2569 2569
 		}
2570 2570
 		// get EE_Payment_Method object
2571 2571
 		if (
2572
-			empty( $txn_details )
2572
+			empty($txn_details)
2573 2573
 			&&
2574 2574
 			! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()
2575 2575
 		) {
@@ -2581,8 +2581,8 @@  discard block
 block discarded – undo
2581 2581
 				)
2582 2582
 			);
2583 2583
 		}
2584
-		if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) {
2585
-			$return_url = $this->_get_return_url( $this->checkout->payment_method );
2584
+		if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) {
2585
+			$return_url = $this->_get_return_url($this->checkout->payment_method);
2586 2586
 			$txn_details = array(
2587 2587
 				'TXN_ID'         => $this->checkout->transaction->ID(),
2588 2588
 				'TXN_timestamp'  => $this->checkout->transaction->datetime(),
@@ -2593,7 +2593,7 @@  discard block
 block discarded – undo
2593 2593
 				'PMD_ID'         => $this->checkout->transaction->payment_method_ID(),
2594 2594
 				'payment_amount' => $this->checkout->amount_owing,
2595 2595
 				'return_url'     => $return_url,
2596
-				'cancel_url'     => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ),
2596
+				'cancel_url'     => add_query_arg(array('ee_cancel_payment' => true), $return_url),
2597 2597
 				'notify_url'     => EE_Config::instance()->core->txn_page_url(
2598 2598
 					array(
2599 2599
 						'e_reg_url_link'    => $this->checkout->transaction->primary_registration()->reg_url_link(),
@@ -2602,7 +2602,7 @@  discard block
 block discarded – undo
2602 2602
 				)
2603 2603
 			);
2604 2604
 		}
2605
-		echo json_encode( $txn_details );
2605
+		echo json_encode($txn_details);
2606 2606
 		exit();
2607 2607
 	}
2608 2608
 
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 1 patch
Spacing   +560 added lines, -560 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,9 +869,9 @@  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
@@ -880,34 +880,34 @@  discard block
 block discarded – undo
880 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,19 +1178,19 @@  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';
1193
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1192
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1193
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1194 1194
 
1195 1195
 		} else {
1196 1196
 
@@ -1209,17 +1209,17 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 
1211 1211
 	protected function _registration_details_metaboxes() {
1212
-		do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this );
1212
+		do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1213 1213
 		$this->_set_registration_object();
1214 1214
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1215
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1216
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1217
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1218
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1215
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1216
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1217
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1218
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1219 1219
 		}
1220
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1221
-		if ( $this->_registration->group_size() > 1 ) {
1222
-			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' );
1220
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1221
+		if ($this->_registration->group_size() > 1) {
1222
+			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');
1223 1223
 		}
1224 1224
 	}
1225 1225
 
@@ -1238,22 +1238,22 @@  discard block
 block discarded – undo
1238 1238
 		$is_complete = $this->_registration->transaction()->is_completed();
1239 1239
 		//let's get an array of all possible buttons that we can just reference
1240 1240
 		$status_buttons = $this->_get_reg_status_buttons();
1241
-		$template_args[ 'reg_status_value' ] = $this->_registration->pretty_status();
1242
-		$template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID();
1241
+		$template_args['reg_status_value'] = $this->_registration->pretty_status();
1242
+		$template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID();
1243 1243
 		$template_args['attendee'] = $this->_registration->attendee();
1244
-		$template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php';
1245
-		if ( $this->_set_registration_object() ) {
1244
+		$template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php';
1245
+		if ($this->_set_registration_object()) {
1246 1246
 			$current_status = $this->_registration->status_ID();
1247
-			unset( $status_buttons[$current_status] );
1248
-			if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) {
1249
-				unset( $status_buttons[EEM_Registration::status_id_pending_payment] );
1247
+			unset($status_buttons[$current_status]);
1248
+			if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) {
1249
+				unset($status_buttons[EEM_Registration::status_id_pending_payment]);
1250 1250
 			}
1251
-			$template_args['status_buttons'] = implode( "\n", $status_buttons );
1251
+			$template_args['status_buttons'] = implode("\n", $status_buttons);
1252 1252
 		}
1253 1253
 		$template_args['form_url'] = REG_ADMIN_URL;
1254 1254
 		$template_args['REG_ID'] = $this->_registration->ID();
1255
-		$template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce',  'change_reg_status_nonce', FALSE, FALSE );
1256
-		EEH_Template::display_template( $template, $template_args );
1255
+		$template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE);
1256
+		EEH_Template::display_template($template, $template_args);
1257 1257
 
1258 1258
 	}
1259 1259
 
@@ -1267,11 +1267,11 @@  discard block
 block discarded – undo
1267 1267
 	private function _get_reg_status_buttons() {
1268 1268
 
1269 1269
 		$buttons = array(
1270
-			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">',
1271
-			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">',
1272
-			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">',
1273
-			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">',
1274
-			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">',
1270
+			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">',
1271
+			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">',
1272
+			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">',
1273
+			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">',
1274
+			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">',
1275 1275
 			);
1276 1276
 		return $buttons;
1277 1277
 	}
@@ -1285,13 +1285,13 @@  discard block
 block discarded – undo
1285 1285
 	 *
1286 1286
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1287 1287
 	 */
1288
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1289
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array();
1288
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1289
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1290 1290
 
1291
-		$success = $this->_set_registration_status( $REG_ID, $status );
1291
+		$success = $this->_set_registration_status($REG_ID, $status);
1292 1292
 
1293 1293
 		//notify?
1294
-		if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
1294
+		if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
1295 1295
 			$this->_process_resend_registration();
1296 1296
 		}
1297 1297
 
@@ -1309,19 +1309,19 @@  discard block
 block discarded – undo
1309 1309
 	 * @param bool $status
1310 1310
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1311 1311
 	 */
1312
-	protected function _set_registration_status( $REG_ID, $status = false ) {
1312
+	protected function _set_registration_status($REG_ID, $status = false) {
1313 1313
 		$success = true;
1314 1314
 		// set default status if none is passed
1315 1315
 		$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1316 1316
 
1317 1317
 		//typecast and sanitize reg_id
1318
-		$reg_ids = array_filter( (array) $REG_ID, 'absint' );
1318
+		$reg_ids = array_filter((array) $REG_ID, 'absint');
1319 1319
 
1320 1320
 		//loop through REG_ID's and change status
1321
-		foreach ( $reg_ids as $r_id ) {
1322
-			$registration = EEM_Registration::instance()->get_one_by_ID( $r_id );
1323
-			if ( $registration instanceof EE_Registration ) {
1324
-				$registration->set_status( $status );
1321
+		foreach ($reg_ids as $r_id) {
1322
+			$registration = EEM_Registration::instance()->get_one_by_ID($r_id);
1323
+			if ($registration instanceof EE_Registration) {
1324
+				$registration->set_status($status);
1325 1325
 				$result = $registration->save();
1326 1326
 
1327 1327
 				//verifying explicit fails because update *may* just return 0 for 0 rows affected
@@ -1333,7 +1333,7 @@  discard block
 block discarded – undo
1333 1333
 		$this->_req_data['_REG_ID'] = $reg_ids;
1334 1334
 
1335 1335
 		//return $success and processed registrations
1336
-		return array( 'REG_ID' => $reg_ids, 'success' => $success );
1336
+		return array('REG_ID' => $reg_ids, 'success' => $success);
1337 1337
 	}
1338 1338
 
1339 1339
 
@@ -1345,37 +1345,37 @@  discard block
 block discarded – undo
1345 1345
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1346 1346
 	 * @return void
1347 1347
 	 */
1348
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1348
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1349 1349
 
1350
-		$result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false );
1350
+		$result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false);
1351 1351
 
1352 1352
 
1353
-		$success = isset( $result['success'] ) && $result['success'];
1353
+		$success = isset($result['success']) && $result['success'];
1354 1354
 
1355 1355
 		//setup success message
1356
-		if ( $success ) {
1357
-			$msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1  ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) :  sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ;
1358
-			EE_Error::add_success( $msg );
1356
+		if ($success) {
1357
+			$msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower'));
1358
+			EE_Error::add_success($msg);
1359 1359
 		} else {
1360
-			EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ );
1360
+			EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
1361 1361
 		}
1362 1362
 
1363
-		$route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' );
1363
+		$route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default');
1364 1364
 		//unset nonces
1365
-		foreach ( $this->_req_data as $ref => $value ) {
1366
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1367
-				unset( $this->_req_data[$ref] );
1365
+		foreach ($this->_req_data as $ref => $value) {
1366
+			if (strpos($ref, 'nonce') !== false) {
1367
+				unset($this->_req_data[$ref]);
1368 1368
 				continue;
1369 1369
 			}
1370 1370
 
1371
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1371
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1372 1372
 			$this->_req_data[$ref] = $value;
1373 1373
 		}
1374 1374
 
1375 1375
 		//merge request vars so that the reloaded list table contains any existing filter query params
1376
-		$route = array_merge( $this->_req_data, $route );
1376
+		$route = array_merge($this->_req_data, $route);
1377 1377
 
1378
-		$this->_redirect_after_action( false, '', '', $route, true );
1378
+		$this->_redirect_after_action(false, '', '', $route, true);
1379 1379
 	}
1380 1380
 
1381 1381
 
@@ -1387,29 +1387,29 @@  discard block
 block discarded – undo
1387 1387
 	protected function _change_reg_status() {
1388 1388
 		$this->_req_data['return'] = 'view_registration';
1389 1389
 		//set notify based on whether the send notifications toggle is set or not
1390
-		$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1391
-		$this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : '';
1390
+		$notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']);
1391
+		$this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : '';
1392 1392
 
1393
-		switch ( $this->_req_data['_reg_status_id'] ) {
1394
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1395
-				$this->approve_registration( $notify );
1393
+		switch ($this->_req_data['_reg_status_id']) {
1394
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1395
+				$this->approve_registration($notify);
1396 1396
 				break;
1397
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1398
-				$this->pending_registration( $notify );
1397
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1398
+				$this->pending_registration($notify);
1399 1399
 				break;
1400
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1401
-				$this->not_approve_registration( $notify );
1400
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1401
+				$this->not_approve_registration($notify);
1402 1402
 				break;
1403
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1404
-				$this->decline_registration( $notify );
1403
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1404
+				$this->decline_registration($notify);
1405 1405
 				break;
1406
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1407
-				$this->cancel_registration( $notify );
1406
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1407
+				$this->cancel_registration($notify);
1408 1408
 				break;
1409 1409
 			default :
1410 1410
 				$result['success'] = false;
1411
-				unset( $this->_req_data['return'] );
1412
-				$this->_reg_status_change_return( '', false );
1411
+				unset($this->_req_data['return']);
1412
+				$this->_reg_status_change_return('', false);
1413 1413
 				break;
1414 1414
 		}
1415 1415
 	}
@@ -1422,8 +1422,8 @@  discard block
 block discarded – undo
1422 1422
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1423 1423
 	*		@return void
1424 1424
 	*/
1425
-	protected function approve_registration( $notify = false ) {
1426
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1425
+	protected function approve_registration($notify = false) {
1426
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1427 1427
 	}
1428 1428
 
1429 1429
 
@@ -1435,8 +1435,8 @@  discard block
 block discarded – undo
1435 1435
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1436 1436
 	*		@return void
1437 1437
 	*/
1438
-	protected function decline_registration( $notify = false ) {
1439
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1438
+	protected function decline_registration($notify = false) {
1439
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1440 1440
 	}
1441 1441
 
1442 1442
 
@@ -1448,8 +1448,8 @@  discard block
 block discarded – undo
1448 1448
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1449 1449
 	*		@return void
1450 1450
 	*/
1451
-	protected function cancel_registration( $notify = false ) {
1452
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1451
+	protected function cancel_registration($notify = false) {
1452
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1453 1453
 	}
1454 1454
 
1455 1455
 
@@ -1462,8 +1462,8 @@  discard block
 block discarded – undo
1462 1462
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1463 1463
 	*		@return void
1464 1464
 	*/
1465
-	protected function not_approve_registration( $notify = false ) {
1466
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1465
+	protected function not_approve_registration($notify = false) {
1466
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1467 1467
 	}
1468 1468
 
1469 1469
 
@@ -1474,8 +1474,8 @@  discard block
 block discarded – undo
1474 1474
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1475 1475
 	*		@return void
1476 1476
 	*/
1477
-	protected function pending_registration( $notify = false ) {
1478
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1477
+	protected function pending_registration($notify = false) {
1478
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1479 1479
 	}
1480 1480
 
1481 1481
 
@@ -1489,19 +1489,19 @@  discard block
 block discarded – undo
1489 1489
 	public function _reg_details_meta_box() {
1490 1490
 		EEH_Autoloader::register_line_item_display_autoloaders();
1491 1491
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1492
-		EE_Registry::instance()->load_helper( 'Line_Item' );
1492
+		EE_Registry::instance()->load_helper('Line_Item');
1493 1493
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1494 1494
 		$this->_session = $transaction->session_data();
1495 1495
 
1496 1496
 		$filters = new EE_Line_Item_Filter_Collection();
1497
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1498
-		$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1499
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1497
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1498
+		$filters->add(new EE_Non_Zero_Line_Item_Filter());
1499
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1500 1500
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1501 1501
 
1502 1502
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1503
-		$line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' );
1504
-		$this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) );
1503
+		$line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy');
1504
+		$this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration));
1505 1505
 
1506 1506
 
1507 1507
 		$attendee = $this->_registration->attendee();
@@ -1512,10 +1512,10 @@  discard block
 block discarded – undo
1512 1512
 		)
1513 1513
 			? EEH_Template::get_button_or_link(
1514 1514
 				EE_Admin_Page::add_query_args_and_nonce(
1515
-					array( 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() ),
1515
+					array('action' => 'view_transaction', 'TXN_ID' => $transaction->ID()),
1516 1516
 					TXN_ADMIN_URL
1517 1517
 				),
1518
-				esc_html__( ' View Transaction' ),
1518
+				esc_html__(' View Transaction'),
1519 1519
 				'button secondary-button right',
1520 1520
 				'dashicons dashicons-cart'
1521 1521
 			)
@@ -1535,59 +1535,59 @@  discard block
 block discarded – undo
1535 1535
 					),
1536 1536
 					REG_ADMIN_URL
1537 1537
 				),
1538
-				esc_html__( ' Resend Registration' ),
1538
+				esc_html__(' Resend Registration'),
1539 1539
 				'button secondary-button right',
1540 1540
 				'dashicons dashicons-email-alt'
1541 1541
 			)
1542 1542
 			: '';
1543 1543
 
1544 1544
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1545
-		$payment = $transaction->get_first_related( 'Payment' );
1545
+		$payment = $transaction->get_first_related('Payment');
1546 1546
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1547
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1547
+		$payment_method = $payment->get_first_related('Payment_Method');
1548 1548
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1549
-		$reg_status_class = 'status-' . $this->_registration->status_ID();
1549
+		$reg_status_class = 'status-'.$this->_registration->status_ID();
1550 1550
 		$reg_details = array(
1551 1551
 			'payment_method' => $payment_method->name(),
1552 1552
 			'response_msg' => $payment->gateway_response(),
1553
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1553
+			'registration_id' => $this->_registration->get('REG_code'),
1554 1554
 			'registration_session' => $this->_registration->session_ID(),
1555
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1556
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1555
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1556
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1557 1557
 			);
1558 1558
 
1559 1559
 
1560
-		if ( isset( $reg_details['registration_id'] )) {
1560
+		if (isset($reg_details['registration_id'])) {
1561 1561
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1562
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1562
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1563 1563
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1564 1564
 		}
1565 1565
 
1566
-		if ( isset( $reg_details['payment_method'] ) ) {
1566
+		if (isset($reg_details['payment_method'])) {
1567 1567
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1568
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1568
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1569 1569
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1570 1570
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1571
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1571
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1572 1572
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1573 1573
 		}
1574 1574
 
1575 1575
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1576
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1576
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1577 1577
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1578 1578
 
1579 1579
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1580
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1580
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1581 1581
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1582 1582
 
1583 1583
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1584
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1584
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1585 1585
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1586 1586
 
1587
-		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL );
1587
+		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL);
1588 1588
 
1589
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1590
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1589
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1590
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1591 1591
 
1592 1592
 	}
1593 1593
 
@@ -1601,14 +1601,14 @@  discard block
 block discarded – undo
1601 1601
 	*/
1602 1602
 	public function _reg_questions_meta_box() {
1603 1603
 		//allow someone to override this method entirely
1604
-		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
1605
-			$form = $this->_get_reg_custom_questions_form( $this->_registration->ID() );
1606
-			$this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : '';
1604
+		if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) {
1605
+			$form = $this->_get_reg_custom_questions_form($this->_registration->ID());
1606
+			$this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : '';
1607 1607
 			$this->_template_args['reg_questions_form_action'] = 'edit_registration';
1608 1608
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1609 1609
 
1610
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1611
-			echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1610
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1611
+			echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1612 1612
 		}
1613 1613
 	}
1614 1614
 
@@ -1622,12 +1622,12 @@  discard block
 block discarded – undo
1622 1622
 	 * @param        string $output
1623 1623
 	 * @return        string
1624 1624
 	 */
1625
-	public function form_before_question_group( $output ) {
1625
+	public function form_before_question_group($output) {
1626 1626
 		EE_Error::doing_it_wrong(
1627
-			__CLASS__ . '::' . __FUNCTION__,
1628
-			__( 'This method would have been protected but was used on a filter callback'
1627
+			__CLASS__.'::'.__FUNCTION__,
1628
+			__('This method would have been protected but was used on a filter callback'
1629 1629
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1630
-				'event_espresso' ),
1630
+				'event_espresso'),
1631 1631
 			'4.8.32.rc.000'
1632 1632
 		);
1633 1633
 		return '
@@ -1646,20 +1646,20 @@  discard block
 block discarded – undo
1646 1646
 	 * @param        string $output
1647 1647
 	 * @return        string
1648 1648
 	 */
1649
-	public function form_after_question_group( $output ) {
1649
+	public function form_after_question_group($output) {
1650 1650
 		EE_Error::doing_it_wrong(
1651
-			__CLASS__ . '::' . __FUNCTION__,
1652
-			__( 'This method would have been protected but was used on a filter callback'
1651
+			__CLASS__.'::'.__FUNCTION__,
1652
+			__('This method would have been protected but was used on a filter callback'
1653 1653
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1654
-				'event_espresso' ),
1654
+				'event_espresso'),
1655 1655
 			'4.8.32.rc.000'
1656 1656
 		);
1657 1657
 		return  '
1658 1658
 			<tr class="hide-if-no-js">
1659 1659
 				<th> </th>
1660 1660
 				<td class="reg-admin-edit-attendee-question-td">
1661
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1662
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1661
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1662
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1663 1663
 						<div class="dashicons dashicons-edit"></div>
1664 1664
 					</a>
1665 1665
 				</td>
@@ -1679,18 +1679,18 @@  discard block
 block discarded – undo
1679 1679
 	 * @param        string $label
1680 1680
 	 * @return        string
1681 1681
 	 */
1682
-	public function form_form_field_label_wrap( $label ) {
1682
+	public function form_form_field_label_wrap($label) {
1683 1683
 		EE_Error::doing_it_wrong(
1684
-			__CLASS__ . '::' . __FUNCTION__,
1685
-			__( 'This method would have been protected but was used on a filter callback'
1684
+			__CLASS__.'::'.__FUNCTION__,
1685
+			__('This method would have been protected but was used on a filter callback'
1686 1686
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1687
-				'event_espresso' ),
1687
+				'event_espresso'),
1688 1688
 			'4.8.32.rc.000'
1689 1689
 		);
1690 1690
 		return '
1691 1691
 			<tr>
1692 1692
 				<th>
1693
-					' . $label  . '
1693
+					' . $label.'
1694 1694
 				</th>';
1695 1695
 	}
1696 1696
 
@@ -1704,17 +1704,17 @@  discard block
 block discarded – undo
1704 1704
 	 * @param        string $input
1705 1705
 	 * @return        string
1706 1706
 	 */
1707
-	public function form_form_field_input__wrap( $input ) {
1707
+	public function form_form_field_input__wrap($input) {
1708 1708
 		EE_Error::doing_it_wrong(
1709
-			__CLASS__ . '::' . __FUNCTION__,
1710
-			__( 'This method would have been protected but was used on a filter callback'
1709
+			__CLASS__.'::'.__FUNCTION__,
1710
+			__('This method would have been protected but was used on a filter callback'
1711 1711
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1712
-				'event_espresso' ),
1712
+				'event_espresso'),
1713 1713
 			'4.8.32.rc.000'
1714 1714
 		);
1715 1715
 		return '
1716 1716
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1717
-					' . $input . '
1717
+					' . $input.'
1718 1718
 				</td>
1719 1719
 			</tr>';
1720 1720
 	}
@@ -1728,14 +1728,14 @@  discard block
 block discarded – undo
1728 1728
 	 * @return void
1729 1729
 	 */
1730 1730
 	protected function _update_attendee_registration_form() {
1731
-		do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this );
1732
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
1733
-			$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1734
-			$success = $this->_save_reg_custom_questions_form( $REG_ID );
1735
-			if( $success ) {
1731
+		do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
1732
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
1733
+			$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1734
+			$success = $this->_save_reg_custom_questions_form($REG_ID);
1735
+			if ($success) {
1736 1736
 				$what = __('Registration Form', 'event_espresso');
1737
-				$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1738
-				$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1737
+				$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1738
+				$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1739 1739
 			}
1740 1740
 		}
1741 1741
 	}
@@ -1746,11 +1746,11 @@  discard block
 block discarded – undo
1746 1746
 	 * @param int $REG_ID
1747 1747
 	 * @return EE_Registration_Custom_Questions_Form
1748 1748
 	 */
1749
-	protected function _get_reg_custom_questions_form( $REG_ID ) {
1750
-		if( ! $this->_reg_custom_questions_form ) {
1751
-			require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' );
1752
-			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) );
1753
-			$this->_reg_custom_questions_form->_construct_finalize( null, null );
1749
+	protected function _get_reg_custom_questions_form($REG_ID) {
1750
+		if ( ! $this->_reg_custom_questions_form) {
1751
+			require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php');
1752
+			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID));
1753
+			$this->_reg_custom_questions_form->_construct_finalize(null, null);
1754 1754
 		}
1755 1755
 		return $this->_reg_custom_questions_form;
1756 1756
 	}
@@ -1763,17 +1763,17 @@  discard block
 block discarded – undo
1763 1763
 	 * @param bool $REG_ID
1764 1764
 	 * @return bool
1765 1765
 	 */
1766
-	private function _save_reg_custom_questions_form( $REG_ID = FALSE ) {
1766
+	private function _save_reg_custom_questions_form($REG_ID = FALSE) {
1767 1767
 
1768 1768
 		if ( ! $REG_ID) {
1769
-			EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1769
+			EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1770 1770
 		}
1771
-		$form = $this->_get_reg_custom_questions_form( $REG_ID );
1772
-		$form->receive_form_submission( $this->_req_data );
1771
+		$form = $this->_get_reg_custom_questions_form($REG_ID);
1772
+		$form->receive_form_submission($this->_req_data);
1773 1773
 		$success = false;
1774
-		if( $form->is_valid() ) {
1775
-			foreach( $form->subforms() as $question_group_id => $question_group_form ) {
1776
-				foreach( $question_group_form->inputs() as $question_id => $input ) {
1774
+		if ($form->is_valid()) {
1775
+			foreach ($form->subforms() as $question_group_id => $question_group_form) {
1776
+				foreach ($question_group_form->inputs() as $question_id => $input) {
1777 1777
 					$where_conditions = array(
1778 1778
 							'QST_ID' => $question_id,
1779 1779
 							'REG_ID' => $REG_ID
@@ -1781,19 +1781,19 @@  discard block
 block discarded – undo
1781 1781
 					$possibly_new_values = array(
1782 1782
 							'ANS_value' => $input->normalized_value()
1783 1783
 						);
1784
-					$answer = EEM_Answer::instance()->get_one( array( $where_conditions ) );
1785
-					if( $answer instanceof EE_Answer ) {
1786
-						$success = $answer->save( $possibly_new_values );
1784
+					$answer = EEM_Answer::instance()->get_one(array($where_conditions));
1785
+					if ($answer instanceof EE_Answer) {
1786
+						$success = $answer->save($possibly_new_values);
1787 1787
 					} else {
1788 1788
 						//insert it then
1789
-						$cols_n_vals = array_merge( $where_conditions, $possibly_new_values );
1790
-						$answer = EE_Answer::new_instance( $cols_n_vals );
1789
+						$cols_n_vals = array_merge($where_conditions, $possibly_new_values);
1790
+						$answer = EE_Answer::new_instance($cols_n_vals);
1791 1791
 						$success = $answer->save();
1792 1792
 					}
1793 1793
 				}
1794 1794
 			}
1795 1795
 		} else {
1796
-			EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ );
1796
+			EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
1797 1797
 		}
1798 1798
 		return $success;
1799 1799
 	}
@@ -1811,31 +1811,31 @@  discard block
 block discarded – undo
1811 1811
 		$registrations = $REG->get_all(array(
1812 1812
 			array(
1813 1813
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1814
-				'REG_ID'=>array('!=',$this->_registration->ID())
1814
+				'REG_ID'=>array('!=', $this->_registration->ID())
1815 1815
 			),
1816 1816
 			'force_join'=>array('Attendee')));
1817 1817
 
1818 1818
 		$this->_template_args['attendees'] = array();
1819 1819
 		$this->_template_args['attendee_notice'] = '';
1820
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1821
-			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__ );
1820
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1821
+			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__);
1822 1822
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1823 1823
 		} else {
1824 1824
 
1825 1825
 			$att_nmbr = 1;
1826
-			foreach ( $registrations as $registration ) {
1826
+			foreach ($registrations as $registration) {
1827 1827
 				/* @var $registration EE_Registration */
1828 1828
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1829
-				$this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID();
1830
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1831
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1832
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1833
-				$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 : '';
1829
+				$this->_template_args['attendees'][$att_nmbr]['STS_ID'] = $registration->status_ID();
1830
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1831
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1832
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1833
+				$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 : '';
1834 1834
 
1835
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1835
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1836 1836
 
1837
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1838
-				$this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name();
1837
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1838
+				$this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name();
1839 1839
 
1840 1840
 				$att_nmbr++;
1841 1841
 			}
@@ -1845,8 +1845,8 @@  discard block
 block discarded – undo
1845 1845
 
1846 1846
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
1847 1847
 		}
1848
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
1849
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1848
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
1849
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1850 1850
 
1851 1851
 	}
1852 1852
 
@@ -1867,14 +1867,14 @@  discard block
 block discarded – undo
1867 1867
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
1868 1868
 
1869 1869
 		//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)
1870
-		if ( ! $this->_registration->is_primary_registrant() ) {
1870
+		if ( ! $this->_registration->is_primary_registrant()) {
1871 1871
 
1872 1872
 			$primary_registration = $this->_registration->get_primary_registration();
1873 1873
 			$primary_attendee = $primary_registration instanceof EE_Registration
1874 1874
 				? $primary_registration->attendee()
1875 1875
 				: null;
1876 1876
 
1877
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
1877
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
1878 1878
 				//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.
1879 1879
 				$primary_registration = NULL;
1880 1880
 			}
@@ -1883,27 +1883,27 @@  discard block
 block discarded – undo
1883 1883
 		}
1884 1884
 
1885 1885
 		$this->_template_args['ATT_ID'] = $attendee->ID();
1886
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
1887
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
1888
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
1886
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
1887
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
1888
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
1889 1889
 		$this->_template_args['phone'] = $attendee->phone();
1890 1890
 
1891
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
1891
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
1892 1892
 
1893 1893
 
1894 1894
 		//edit link
1895
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1895
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1896 1896
 		$this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso');
1897 1897
 
1898 1898
 		//create link
1899
-		$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 ): '';
1899
+		$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) : '';
1900 1900
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
1901 1901
 
1902 1902
 		$this->_template_args['att_check'] = $att_check;
1903 1903
 
1904 1904
 
1905
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
1906
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1905
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
1906
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1907 1907
 	}
1908 1908
 
1909 1909
 
@@ -1916,7 +1916,7 @@  discard block
 block discarded – undo
1916 1916
 	 * @access protected
1917 1917
 	 * @return void
1918 1918
 	 */
1919
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
1919
+	protected function _trash_or_restore_registrations($trash = TRUE) {
1920 1920
 		$REGM = EEM_Registration::instance();
1921 1921
 
1922 1922
 		$success = 1;
@@ -1926,26 +1926,26 @@  discard block
 block discarded – undo
1926 1926
 		$dtts = array();
1927 1927
 
1928 1928
 		//if empty _REG_ID then get out because there's nothing to do
1929
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
1929
+		if (empty($this->_req_data['_REG_ID'])) {
1930 1930
 			$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');
1931
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
1932
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
1931
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
1932
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
1933 1933
 		}
1934 1934
 
1935 1935
 		//Checkboxes
1936
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1936
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1937 1937
 			// if array has more than one element than success message should be plural
1938
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1938
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1939 1939
 			// cycle thru checkboxes
1940
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1940
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1941 1941
 				/** @var EE_Registration $REG */
1942
-				$REG = $REGM->get_one_by_ID( $REG_ID);
1942
+				$REG = $REGM->get_one_by_ID($REG_ID);
1943 1943
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
1944
-				if ( $payment_count > 0 ) {
1945
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
1944
+				if ($payment_count > 0) {
1945
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
1946 1946
 					$error = 1;
1947 1947
 					$success = 0;
1948
-					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__ );
1948
+					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__);
1949 1949
 					continue; //can't trash this registration because it has payments.
1950 1950
 				}
1951 1951
 				$ticket = $REG->get_first_related('Ticket');
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 				$dtts = array_merge($dtts, $dtt);
1955 1955
 
1956 1956
 				$updated = $trash ? $REG->delete() : $REG->restore();
1957
-				if ( !$updated ) {
1957
+				if ( ! $updated) {
1958 1958
 					$success = 0;
1959 1959
 				} else {
1960 1960
 					$success = 2;
@@ -1969,7 +1969,7 @@  discard block
 block discarded – undo
1969 1969
 			$tickets[$ticket->ID()] = $ticket;
1970 1970
 			$dtts = $ticket->get_many_related('Datetime');
1971 1971
 			$updated = $trash ? $REG->delete() : $REG->restore();
1972
-			if ( ! $updated ) {
1972
+			if ( ! $updated) {
1973 1973
 				$success = 0;
1974 1974
 			}
1975 1975
 
@@ -1979,10 +1979,10 @@  discard block
 block discarded – undo
1979 1979
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
1980 1980
 		EEM_Datetime::instance()->update_sold($dtts);
1981 1981
 
1982
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1983
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
1982
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1983
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
1984 1984
 		$overwrite_msgs = $error ? TRUE : FALSE;
1985
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
1985
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
1986 1986
 	}
1987 1987
 
1988 1988
 
@@ -2006,16 +2006,16 @@  discard block
 block discarded – undo
2006 2006
 		$success = 1;
2007 2007
 
2008 2008
 		//Checkboxes
2009
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2009
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2010 2010
 			// if array has more than one element than success message should be plural
2011
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
2011
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
2012 2012
 			// cycle thru checkboxes
2013
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
2013
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
2014 2014
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
2015
-				if ( ! $REG instanceof EE_Registration )
2015
+				if ( ! $REG instanceof EE_Registration)
2016 2016
 					continue;
2017 2017
 				$deleted = $this->_delete_registration($REG);
2018
-				if ( !$deleted ) {
2018
+				if ( ! $deleted) {
2019 2019
 					$success = 0;
2020 2020
 				}
2021 2021
 			}
@@ -2025,15 +2025,15 @@  discard block
 block discarded – undo
2025 2025
 			$REG_ID = $this->_req_data['_REG_ID'];
2026 2026
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
2027 2027
 			$deleted = $this->_delete_registration($REG);
2028
-			if ( ! $deleted ) {
2028
+			if ( ! $deleted) {
2029 2029
 				$success = 0;
2030 2030
 			}
2031 2031
 
2032 2032
 		}
2033 2033
 
2034
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
2035
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
2036
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
2034
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
2035
+		$action_desc = __('permanently deleted.', 'event_espresso');
2036
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
2037 2037
 	}
2038 2038
 
2039 2039
 
@@ -2045,31 +2045,31 @@  discard block
 block discarded – undo
2045 2045
 	 * @param  EE_Registration $REG registration to be deleted permenantly
2046 2046
 	 * @return boolean              true = successful deletion, false = fail.
2047 2047
 	 */
2048
-	protected function _delete_registration( EE_Registration $REG ) {
2048
+	protected function _delete_registration(EE_Registration $REG) {
2049 2049
 		//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.
2050 2050
 		$TXN = $REG->get_first_related('Transaction');
2051 2051
 		$REGS = $TXN->get_many_related('Registration');
2052 2052
 
2053 2053
 		$all_trashed = TRUE;
2054
-		foreach ( $REGS as $registration ) {
2055
-			if ( ! $registration->get('REG_deleted') )
2054
+		foreach ($REGS as $registration) {
2055
+			if ( ! $registration->get('REG_deleted'))
2056 2056
 				$all_trashed = FALSE;
2057 2057
 		}
2058 2058
 
2059
-		if ( ! $all_trashed ) {
2060
-			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__ );
2059
+		if ( ! $all_trashed) {
2060
+			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__);
2061 2061
 			return false;
2062 2062
 		}
2063 2063
 
2064 2064
 		//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).
2065
-		foreach ( $REGS as $registration ) {
2065
+		foreach ($REGS as $registration) {
2066 2066
 
2067 2067
 			//delete related answers
2068 2068
 			$registration->delete_related_permanently('Answer');
2069 2069
 
2070 2070
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
2071 2071
 			$attendee = $registration->get_first_related('Attendee');
2072
-			if ( $attendee instanceof EE_Attendee ) {
2072
+			if ($attendee instanceof EE_Attendee) {
2073 2073
 				$registration->_remove_relation_to($attendee, 'Attendee');
2074 2074
 			}
2075 2075
 
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
 			//now delete permanently the checkins related to this registration.
2080 2080
 			$registration->delete_related_permanently('Checkin');
2081 2081
 
2082
-			if ( $registration->ID() === $REG->ID() )
2082
+			if ($registration->ID() === $REG->ID())
2083 2083
 				continue; //we don't want to delete permanently the existing registration just yet.
2084 2084
 
2085 2085
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -2112,35 +2112,35 @@  discard block
 block discarded – undo
2112 2112
 	 * @return void
2113 2113
 	 */
2114 2114
 	public function new_registration() {
2115
-		if ( ! $this->_set_reg_event() ) {
2116
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
2115
+		if ( ! $this->_set_reg_event()) {
2116
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
2117 2117
 		}
2118
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2118
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2119 2119
 		// gotta start with a clean slate if we're not coming here via ajax
2120 2120
 		if (
2121
-			! defined('DOING_AJAX' )
2122
-			&& ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) )
2121
+			! defined('DOING_AJAX')
2122
+			&& ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))
2123 2123
 		) {
2124
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2124
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2125 2125
 		}
2126 2126
 
2127
-		$this->_template_args['event_name'] = '' ;
2127
+		$this->_template_args['event_name'] = '';
2128 2128
 		// event name
2129
-		if ( $this->_reg_event ) {
2129
+		if ($this->_reg_event) {
2130 2130
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2131
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2132
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2133
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2131
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2132
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2133
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2134 2134
 		}
2135 2135
 
2136 2136
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2137 2137
 
2138
-		if ( defined('DOING_AJAX' ) ) {
2138
+		if (defined('DOING_AJAX')) {
2139 2139
 			$this->_return_json();
2140 2140
 		}
2141 2141
 		// grab header
2142
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2143
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2142
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2143
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2144 2144
 
2145 2145
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2146 2146
 		// the details template wrapper
@@ -2157,7 +2157,7 @@  discard block
 block discarded – undo
2157 2157
 	 * @return string html
2158 2158
 	 */
2159 2159
 	protected function _get_registration_step_content() {
2160
-		if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) {
2160
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2161 2161
 			$warning_msg = sprintf(
2162 2162
 				__(
2163 2163
 					'%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',
@@ -2173,7 +2173,7 @@  discard block
 block discarded – undo
2173 2173
 				'</b>'
2174 2174
 			);
2175 2175
 			return '
2176
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2176
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2177 2177
 	<script >
2178 2178
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2179 2179
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2208,16 +2208,16 @@  discard block
 block discarded – undo
2208 2208
 		$cart = EE_Registry::instance()->SSN->cart();
2209 2209
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2210 2210
 
2211
-		switch ( $step ) {
2211
+		switch ($step) {
2212 2212
 			case 'ticket' :
2213 2213
 				$hidden_fields['processing_registration']['value'] = 1;
2214 2214
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2215
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2215
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2216 2216
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2217 2217
 				$template_args['show_notification_toggle'] = FALSE;
2218 2218
 				break;
2219 2219
 			case 'questions' :
2220
-				$hidden_fields[ 'processing_registration' ][ 'value' ] = 2;
2220
+				$hidden_fields['processing_registration']['value'] = 2;
2221 2221
 				$template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso');
2222 2222
 				//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.
2223 2223
 				$template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin();
@@ -2226,10 +2226,10 @@  discard block
 block discarded – undo
2226 2226
 				break;
2227 2227
 		}
2228 2228
 
2229
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2229
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2230 2230
 
2231 2231
 		return EEH_Template::display_template(
2232
-			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2232
+			REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2233 2233
 		);
2234 2234
 	}
2235 2235
 
@@ -2244,11 +2244,11 @@  discard block
 block discarded – undo
2244 2244
 	*		@return boolean
2245 2245
 	*/
2246 2246
 	private function _set_reg_event() {
2247
-		if ( is_object( $this->_reg_event )) {
2247
+		if (is_object($this->_reg_event)) {
2248 2248
 			return TRUE;
2249 2249
 		}
2250
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2251
-		if ( ! $EVT_ID ) {
2250
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2251
+		if ( ! $EVT_ID) {
2252 2252
 			return FALSE;
2253 2253
 		}
2254 2254
 
@@ -2269,82 +2269,82 @@  discard block
 block discarded – undo
2269 2269
 	public function process_reg_step() {
2270 2270
 		EE_System::do_not_cache();
2271 2271
 		$this->_set_reg_event();
2272
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2272
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2273 2273
 
2274 2274
 		//what step are we on?
2275 2275
 		$cart = EE_Registry::instance()->SSN->cart();
2276 2276
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2277 2277
 
2278 2278
 		//if doing ajax then we need to verify the nonce
2279
-		if ( defined( 'DOING_AJAX' ) ) {
2280
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2281
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2279
+		if (defined('DOING_AJAX')) {
2280
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2281
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2282 2282
 		}
2283 2283
 
2284
-		switch ( $step ) {
2284
+		switch ($step) {
2285 2285
 
2286 2286
 			case 'ticket' :
2287 2287
 				//process ticket selection
2288 2288
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2289
-				if ( $success ) {
2290
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2289
+				if ($success) {
2290
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2291 2291
 				} else {
2292 2292
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2293 2293
 				}
2294
-				if ( defined('DOING_AJAX') ) {
2294
+				if (defined('DOING_AJAX')) {
2295 2295
 					$this->new_registration(); //display next step
2296 2296
 				} else {
2297 2297
 					$query_args['action'] = 'new_registration';
2298 2298
 					$query_args['processing_registration'] = 1;
2299 2299
 					$query_args['event_id'] = $this->_reg_event->ID();
2300
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2300
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2301 2301
 				}
2302 2302
 				break;
2303 2303
 
2304 2304
 			case 'questions' :
2305
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2306
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2305
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2306
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2307 2307
 				}
2308 2308
 				//process registration
2309 2309
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2310
-				if ( $cart instanceof EE_Cart ) {
2310
+				if ($cart instanceof EE_Cart) {
2311 2311
 					$grand_total = $cart->get_cart_grand_total();
2312
-					if ( $grand_total instanceof EE_Line_Item ) {
2312
+					if ($grand_total instanceof EE_Line_Item) {
2313 2313
 						$grand_total->save_this_and_descendants_to_txn();
2314 2314
 					}
2315 2315
 				}
2316
-				if ( ! $transaction instanceof EE_Transaction ) {
2316
+				if ( ! $transaction instanceof EE_Transaction) {
2317 2317
 					$query_args = array(
2318 2318
 						'action' => 'new_registration',
2319 2319
 						'processing_registration' => 2,
2320 2320
 						'event_id' => $this->_reg_event->ID()
2321 2321
 					);
2322 2322
 
2323
-					if ( defined('DOING_AJAX' )) {
2323
+					if (defined('DOING_AJAX')) {
2324 2324
 						//display registration form again because there are errors (maybe validation?)
2325 2325
 						$this->new_registration();
2326 2326
 						return;
2327 2327
 					} else {
2328
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2328
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2329 2329
 						return;
2330 2330
 					}
2331 2331
 				}
2332 2332
 				/** @type EE_Transaction_Payments $transaction_payments */
2333
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2333
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2334 2334
 				// maybe update status, and make sure to save transaction if not done already
2335
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2335
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2336 2336
 					$transaction->save();
2337 2337
 				}
2338
-				EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2338
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2339 2339
 				$this->_req_data = array();
2340 2340
 				$query_args = array(
2341 2341
 					'action'        => 'redirect_to_txn',
2342 2342
 					'TXN_ID'        => $transaction->ID(),
2343 2343
 					'EVT_ID'        => $this->_reg_event->ID(),
2344
-					'event_name'    => urlencode( $this->_reg_event->name() ),
2344
+					'event_name'    => urlencode($this->_reg_event->name()),
2345 2345
 					'redirect_from' => 'new_registration'
2346 2346
 				);
2347
-				$this->_redirect_after_action( false, '', '', $query_args, true );
2347
+				$this->_redirect_after_action(false, '', '', $query_args, true);
2348 2348
 				break;
2349 2349
 		}
2350 2350
 
@@ -2361,21 +2361,21 @@  discard block
 block discarded – undo
2361 2361
 	 */
2362 2362
 	public function redirect_to_txn() {
2363 2363
 		EE_System::do_not_cache();
2364
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2364
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2365 2365
 		$query_args = array(
2366 2366
 			'action' => 'view_transaction',
2367
-			'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] )  : 0,
2367
+			'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0,
2368 2368
 			'page'   => 'espresso_transactions'
2369 2369
 		);
2370
-		if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) {
2371
-			$query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ];
2372
-			$query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] );
2373
-			$query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ];
2370
+		if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) {
2371
+			$query_args['EVT_ID'] = $this->_req_data['EVT_ID'];
2372
+			$query_args['event_name'] = urlencode($this->_req_data['event_name']);
2373
+			$query_args['redirect_from'] = $this->_req_data['redirect_from'];
2374 2374
 		}
2375 2375
 		EE_Error::add_success(
2376
-			__( 'Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso' )
2376
+			__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')
2377 2377
 		);
2378
-		$this->_redirect_after_action( false, '', '', $query_args, true );
2378
+		$this->_redirect_after_action(false, '', '', $query_args, true);
2379 2379
 	}
2380 2380
 
2381 2381
 
@@ -2386,7 +2386,7 @@  discard block
 block discarded – undo
2386 2386
 	*		@return void
2387 2387
 	*/
2388 2388
 	protected function _attendee_contact_list_table() {
2389
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2389
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2390 2390
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2391 2391
 		$this->display_admin_list_table_page_with_no_sidebar();
2392 2392
 	}
@@ -2401,10 +2401,10 @@  discard block
 block discarded – undo
2401 2401
 	*		@access public
2402 2402
 	*		@return array
2403 2403
 	*/
2404
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2404
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2405 2405
 
2406
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2407
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2406
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2407
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2408 2408
 		$ATT_MDL = EEM_Attendee::instance();
2409 2409
 
2410 2410
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2432,47 +2432,47 @@  discard block
 block discarded – undo
2432 2432
 				$orderby = 'ATT_lname';
2433 2433
 		}
2434 2434
 
2435
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2435
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2436 2436
 
2437
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2438
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2439
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2437
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2438
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2439
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2440 2440
 
2441 2441
 		$_where = array();
2442 2442
 
2443
-		if ( isset( $this->_req_data['s'] ) ) {
2444
-			$sstr = '%' . $this->_req_data['s'] . '%';
2443
+		if (isset($this->_req_data['s'])) {
2444
+			$sstr = '%'.$this->_req_data['s'].'%';
2445 2445
 			$_where['OR'] = array(
2446
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2447
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2448
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2449
-				'ATT_fname' => array( 'LIKE', $sstr ),
2450
-				'ATT_lname' => array( 'LIKE', $sstr ),
2451
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2452
-				'ATT_email' => array('LIKE', $sstr ),
2453
-				'ATT_address' => array( 'LIKE', $sstr ),
2454
-				'ATT_address2' => array( 'LIKE', $sstr ),
2455
-				'ATT_city' => array( 'LIKE', $sstr ),
2456
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2457
-				'State.STA_name' => array('LIKE', $sstr ),
2458
-				'ATT_phone' => array( 'LIKE', $sstr ),
2459
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2460
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2461
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2462
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2446
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2447
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2448
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2449
+				'ATT_fname' => array('LIKE', $sstr),
2450
+				'ATT_lname' => array('LIKE', $sstr),
2451
+				'ATT_short_bio' => array('LIKE', $sstr),
2452
+				'ATT_email' => array('LIKE', $sstr),
2453
+				'ATT_address' => array('LIKE', $sstr),
2454
+				'ATT_address2' => array('LIKE', $sstr),
2455
+				'ATT_city' => array('LIKE', $sstr),
2456
+				'Country.CNT_name' => array('LIKE', $sstr),
2457
+				'State.STA_name' => array('LIKE', $sstr),
2458
+				'ATT_phone' => array('LIKE', $sstr),
2459
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2460
+				'Registration.REG_code' => array('LIKE', $sstr),
2461
+				'Registration.REG_count' => array('LIKE', $sstr),
2462
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2463 2463
 				);
2464 2464
 		}
2465 2465
 
2466 2466
 
2467
-		$offset = ($current_page-1)*$per_page;
2468
-		$limit = $count ? NULL : array( $offset, $per_page );
2467
+		$offset = ($current_page - 1) * $per_page;
2468
+		$limit = $count ? NULL : array($offset, $per_page);
2469 2469
 
2470
-		if ( $trash ) {
2471
-			$_where['status'] = array( '!=', 'publish' );
2472
-			$all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2470
+		if ($trash) {
2471
+			$_where['status'] = array('!=', 'publish');
2472
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2473 2473
 		} else {
2474
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2475
-			$all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );
2474
+			$_where['status'] = array('IN', array('publish'));
2475
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2476 2476
 		}
2477 2477
 
2478 2478
 		return $all_attendees;
@@ -2489,10 +2489,10 @@  discard block
 block discarded – undo
2489 2489
 	 */
2490 2490
 	protected function _resend_registration() {
2491 2491
 		$this->_process_resend_registration();
2492
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2492
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2493 2493
 			'action' => 'default'
2494 2494
 		);
2495
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2495
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2496 2496
 	}
2497 2497
 
2498 2498
 
@@ -2500,26 +2500,26 @@  discard block
 block discarded – undo
2500 2500
 
2501 2501
 
2502 2502
 
2503
-	public function _registrations_report(){
2504
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2505
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2503
+	public function _registrations_report() {
2504
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2505
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2506 2506
 				array(
2507 2507
 					'page' => 'espresso_batch',
2508 2508
 					'batch' => 'file',
2509
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2510
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2511
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2512
-				)) );
2509
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2510
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2511
+					'return_url' => urlencode($this->_req_data['return_url']),
2512
+				)));
2513 2513
 		} else {
2514 2514
 			$new_request_args = array(
2515 2515
 				'export' => 'report',
2516 2516
 				'action' => 'registrations_report_for_event',
2517
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2517
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2518 2518
 			);
2519 2519
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2520 2520
 
2521
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2522
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2521
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2522
+				require_once(EE_CLASSES.'EE_Export.class.php');
2523 2523
 				$EE_Export = EE_Export::instance($this->_req_data);
2524 2524
 				$EE_Export->export();
2525 2525
 			}
@@ -2528,26 +2528,26 @@  discard block
 block discarded – undo
2528 2528
 
2529 2529
 
2530 2530
 
2531
-	public function _contact_list_export(){
2532
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2533
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2531
+	public function _contact_list_export() {
2532
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2533
+			require_once(EE_CLASSES.'EE_Export.class.php');
2534 2534
 			$EE_Export = EE_Export::instance($this->_req_data);
2535 2535
 			$EE_Export->export_attendees();
2536 2536
 		}
2537 2537
 	}
2538 2538
 
2539
-	public function _contact_list_report(){
2540
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2541
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2539
+	public function _contact_list_report() {
2540
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2541
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2542 2542
 				array(
2543 2543
 					'page' => 'espresso_batch',
2544 2544
 					'batch' => 'file',
2545
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2546
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2547
-				)) );
2545
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2546
+					'return_url' => urlencode($this->_req_data['return_url']),
2547
+				)));
2548 2548
 		} else {
2549
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2550
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2549
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2550
+				require_once(EE_CLASSES.'EE_Export.class.php');
2551 2551
 				$EE_Export = EE_Export::instance($this->_req_data);
2552 2552
 				$EE_Export->report_attendees();
2553 2553
 			}
@@ -2566,73 +2566,73 @@  discard block
 block discarded – undo
2566 2566
 	 * @return void
2567 2567
 	 */
2568 2568
 	protected function _duplicate_attendee() {
2569
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2569
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2570 2570
 		//verify we have necessary info
2571
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2572
-			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__ );
2573
-			$query_args = array( 'action' => $action );
2571
+		if (empty($this->_req_data['_REG_ID'])) {
2572
+			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__);
2573
+			$query_args = array('action' => $action);
2574 2574
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2575 2575
 		}
2576 2576
 
2577 2577
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2578
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2578
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2579 2579
 		$attendee = $registration->attendee();
2580 2580
 
2581 2581
 		//remove relation of existing attendee on registration
2582
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2582
+		$registration->_remove_relation_to($attendee, 'Attendee');
2583 2583
 		//new attendee
2584 2584
 		$new_attendee = clone $attendee;
2585
-		$new_attendee->set( 'ATT_ID', 0 );
2585
+		$new_attendee->set('ATT_ID', 0);
2586 2586
 		$new_attendee->save();
2587 2587
 
2588 2588
 		//add new attendee to reg
2589
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2589
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2590 2590
 
2591
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2591
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2592 2592
 
2593 2593
 		//redirect to edit page for attendee
2594
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2594
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2595 2595
 
2596
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2596
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2597 2597
 	}
2598 2598
 
2599 2599
 
2600 2600
 	//related to cpt routes
2601 2601
 	protected function _insert_update_cpt_item($post_id, $post) {
2602 2602
 		$success = true;
2603
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2603
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2604 2604
 		//for attendee updates
2605
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2605
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2606 2606
 			//note we should only be UPDATING attendees at this point.
2607 2607
 			$updated_fields = array(
2608 2608
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2609 2609
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2610
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2610
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2611 2611
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2612 2612
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2613
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2614
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2615
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2616
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2617
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2618
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2613
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2614
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2615
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2616
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2617
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2618
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2619 2619
 				);
2620
-			foreach ( $updated_fields as $field => $value ) {
2620
+			foreach ($updated_fields as $field => $value) {
2621 2621
 				$attendee->set($field, $value);
2622 2622
 			}
2623 2623
 
2624 2624
 			$success = $attendee->save();
2625 2625
 
2626
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2627
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2628
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2629
-					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 ) );
2626
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2627
+			foreach ($attendee_update_callbacks as $a_callback) {
2628
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2629
+					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));
2630 2630
 				}
2631 2631
 			}
2632 2632
 		}
2633 2633
 
2634
-		if ( $success === FALSE )
2635
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2634
+		if ($success === FALSE)
2635
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2636 2636
 
2637 2637
 	}
2638 2638
 
@@ -2652,17 +2652,17 @@  discard block
 block discarded – undo
2652 2652
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2653 2653
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2654 2654
 
2655
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2656
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2655
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2656
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2657 2657
 		}
2658 2658
 
2659
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2659
+		if (post_type_supports('espresso_attendees', 'comments')) {
2660 2660
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2661 2661
 		}
2662 2662
 
2663
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2664
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2665
-		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');
2663
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2664
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2665
+		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');
2666 2666
 	}
2667 2667
 
2668 2668
 
@@ -2671,10 +2671,10 @@  discard block
 block discarded – undo
2671 2671
 	 * @param  WP_Post $post wp post object
2672 2672
 	 * @return string        attendee contact info ( and form )
2673 2673
 	 */
2674
-	public function attendee_contact_info( $post ) {
2674
+	public function attendee_contact_info($post) {
2675 2675
 		//get attendee object ( should already have it )
2676 2676
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2677
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2677
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2678 2678
 		EEH_Template::display_template($template, $this->_template_args);
2679 2679
 	}
2680 2680
 
@@ -2690,12 +2690,12 @@  discard block
 block discarded – undo
2690 2690
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2691 2691
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2692 2692
 				new EE_Question_Form_Input(
2693
-				EE_Question::new_instance( array(
2693
+				EE_Question::new_instance(array(
2694 2694
 					'QST_ID' => 0,
2695 2695
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2696 2696
 					'QST_system' => 'admin-state'
2697 2697
 					)),
2698
-				EE_Answer::new_instance( array(
2698
+				EE_Answer::new_instance(array(
2699 2699
 					'ANS_ID' => 0,
2700 2700
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2701 2701
 					)),
@@ -2708,12 +2708,12 @@  discard block
 block discarded – undo
2708 2708
 			));
2709 2709
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2710 2710
 				new EE_Question_Form_Input(
2711
-				EE_Question::new_instance( array(
2711
+				EE_Question::new_instance(array(
2712 2712
 					'QST_ID' => 0,
2713 2713
 					'QST_display_text' => __('Country', 'event_espresso'),
2714 2714
 					'QST_system' => 'admin-country'
2715 2715
 					)),
2716
-				EE_Answer::new_instance( array(
2716
+				EE_Answer::new_instance(array(
2717 2717
 					'ANS_ID' => 0,
2718 2718
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2719 2719
 					)),
@@ -2724,8 +2724,8 @@  discard block
 block discarded – undo
2724 2724
 					'append_qstn_id' => FALSE
2725 2725
 					)
2726 2726
 				));
2727
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2728
-		EEH_Template::display_template($template, $this->_template_args );
2727
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2728
+		EEH_Template::display_template($template, $this->_template_args);
2729 2729
 
2730 2730
 	}
2731 2731
 
@@ -2735,11 +2735,11 @@  discard block
 block discarded – undo
2735 2735
 	*		@access protected
2736 2736
 	*		@return void
2737 2737
 	*/
2738
-	public function attendee_registrations_meta_box( $post ) {
2738
+	public function attendee_registrations_meta_box($post) {
2739 2739
 
2740 2740
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2741 2741
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2742
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2742
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2743 2743
 		EEH_Template::display_template($template, $this->_template_args);
2744 2744
 
2745 2745
 	}
@@ -2753,8 +2753,8 @@  discard block
 block discarded – undo
2753 2753
 	 * @return string        html for new form.
2754 2754
 	 */
2755 2755
 	public function after_title_form_fields($post) {
2756
-		if ( $post->post_type == 'espresso_attendees' ) {
2757
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2756
+		if ($post->post_type == 'espresso_attendees') {
2757
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2758 2758
 			$template_args['attendee'] = $this->_cpt_model_obj;
2759 2759
 			EEH_Template::display_template($template, $template_args);
2760 2760
 		}
@@ -2771,21 +2771,21 @@  discard block
 block discarded – undo
2771 2771
 	*		@access protected
2772 2772
 	*		@return void
2773 2773
 	*/
2774
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2774
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2775 2775
 
2776
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2776
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2777 2777
 
2778 2778
 		$ATT_MDL = EEM_Attendee::instance();
2779 2779
 
2780 2780
 		$success = 1;
2781 2781
 		//Checkboxes
2782
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2782
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2783 2783
 			// if array has more than one element than success message should be plural
2784
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2784
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2785 2785
 			// cycle thru checkboxes
2786
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2787
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2788
-				if ( !$updated ) {
2786
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2787
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2788
+				if ( ! $updated) {
2789 2789
 					$success = 0;
2790 2790
 				}
2791 2791
 			}
@@ -2794,18 +2794,18 @@  discard block
 block discarded – undo
2794 2794
 			// grab single id and delete
2795 2795
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2796 2796
 			//get attendee
2797
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2797
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2798 2798
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2799 2799
 			$updated = $att->save();
2800
-			if ( ! $updated ) {
2800
+			if ( ! $updated) {
2801 2801
 				$success = 0;
2802 2802
 			}
2803 2803
 
2804 2804
 		}
2805 2805
 
2806
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2807
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2808
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2806
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2807
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2808
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2809 2809
 
2810 2810
 	}
2811 2811
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Organization_Shortcodes.lib.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -58,96 +58,96 @@  discard block
 block discarded – undo
58 58
 			'[CO_GOOGLE_URL]' => esc_html__('Link to organization Google page', 'event_espresso'),
59 59
 			'[CO_LINKEDIN_URL]' => esc_html__('Link to organization LinkedIn page', 'event_espresso'),
60 60
 			'[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'),
61
-			'[CO_TAX_NUMBER_*]' => sprintf( esc_html__('This is the shortcode used for displaying any tax number for the company.  %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is.  It defaults to "VAT/Tax Number:".  To change this prefix you do the following format for this shortcode:  [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56.  Also take note that if you have NO number in your settings, the prefix is not output either.', 'event_espresso' ),'<strong>','</strong>')
61
+			'[CO_TAX_NUMBER_*]' => sprintf(esc_html__('This is the shortcode used for displaying any tax number for the company.  %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is.  It defaults to "VAT/Tax Number:".  To change this prefix you do the following format for this shortcode:  [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56.  Also take note that if you have NO number in your settings, the prefix is not output either.', 'event_espresso'), '<strong>', '</strong>')
62 62
 			);
63 63
 	}
64 64
 
65 65
 
66
-	protected function _parser( $shortcode ) {
66
+	protected function _parser($shortcode) {
67 67
 
68
-		switch ( $shortcode ) {
68
+		switch ($shortcode) {
69 69
 
70 70
 			case '[COMPANY]' :
71
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'name' );
71
+				return EE_Registry::instance()->CFG->organization->get_pretty('name');
72 72
 				break;
73 73
 
74 74
 			case '[CO_ADD1]' :
75
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' );
75
+				return EE_Registry::instance()->CFG->organization->get_pretty('address_1');
76 76
 				break;
77 77
 
78 78
 			case '[CO_ADD2]' :
79
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' );
79
+				return EE_Registry::instance()->CFG->organization->get_pretty('address_2');
80 80
 				break;
81 81
 
82 82
 			case '[CO_CITY]' :
83
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'city' );
83
+				return EE_Registry::instance()->CFG->organization->get_pretty('city');
84 84
 				break;
85 85
 
86 86
 			case '[CO_STATE]' :
87
-				$state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( EE_Registry::instance()->CFG->organization->STA_ID );
87
+				$state = EE_Registry::instance()->load_model('State')->get_one_by_ID(EE_Registry::instance()->CFG->organization->STA_ID);
88 88
 				return $state->name();
89 89
 				break;
90 90
 
91 91
 			case '[CO_ZIP]' :
92
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'zip' );
92
+				return EE_Registry::instance()->CFG->organization->get_pretty('zip');
93 93
 				break;
94 94
 
95 95
 			case '[CO_EMAIL]' :
96
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'email' );
96
+				return EE_Registry::instance()->CFG->organization->get_pretty('email');
97 97
 				break;
98 98
 
99 99
 			case '[CO_PHONE]' :
100
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'phone' );
100
+				return EE_Registry::instance()->CFG->organization->get_pretty('phone');
101 101
 				break;
102 102
 
103 103
 			case '[CO_LOGO]' :
104
-				return '<img src="' . EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) . '" id="headerImage" />';
104
+				return '<img src="'.EE_Registry::instance()->CFG->organization->get_pretty('logo_url').'" id="headerImage" />';
105 105
 				break;
106 106
 
107 107
 			case '[CO_LOGO_URL]' :
108
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' );
108
+				return EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
109 109
 				break;
110 110
 
111 111
 			case '[CO_FACEBOOK_URL]' :
112
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' );
112
+				return EE_Registry::instance()->CFG->organization->get_pretty('facebook');
113 113
 				break;
114 114
 
115 115
 			case '[CO_TWITTER_URL]' :
116
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' );
116
+				return EE_Registry::instance()->CFG->organization->get_pretty('twitter');
117 117
 				break;
118 118
 
119 119
 			case '[CO_PINTEREST_URL]' :
120
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' );
120
+				return EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
121 121
 				break;
122 122
 
123 123
 			case '[CO_LINKEDIN_URL]' :
124
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' );
124
+				return EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
125 125
 				break;
126 126
 
127 127
 			case '[CO_GOOGLE_URL]' :
128
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'google' );
128
+				return EE_Registry::instance()->CFG->organization->get_pretty('google');
129 129
 				break;
130 130
 
131 131
 			case '[CO_INSTAGRAM_URL]' :
132
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' );
132
+				return EE_Registry::instance()->CFG->organization->get_pretty('instagram');
133 133
 				break;
134 134
 
135 135
 		}
136 136
 
137 137
 		//also allow for parameter shortcode
138
-		if ( strpos( $shortcode, '[CO_TAX_NUMBER_*' ) !== FALSE ) {
138
+		if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== FALSE) {
139 139
 			//first see if there is any company tax number set and bail early if not
140 140
 			$tax_number = EE_Registry::instance()->CFG->organization->vat;
141
-			if ( empty( $tax_number ) ) {
141
+			if (empty($tax_number)) {
142 142
 				return '';
143 143
 			}
144 144
 
145 145
 			//see if there are any attributes.
146
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
146
+			$attrs = $this->_get_shortcode_attrs($shortcode);
147 147
 
148 148
 			//set custom attrs if present (or default)
149
-			$prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso');
150
-			return $prefix . $tax_number;
149
+			$prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso');
150
+			return $prefix.$tax_number;
151 151
 		}
152 152
 
153 153
 		return '';
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Email_Shortcodes.lib.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
 		$this->description = esc_html__('All shortcodes related to emails', 'event_espresso');
44 44
 		$this->_shortcodes = array(
45 45
 			'[SITE_ADMIN_EMAIL]' => esc_html__('Will be replaced with the admin email for the site that Event Espresso is installed on', 'event_espresso'),
46
-			'[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf( esc_html__('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'),'<strong>','</strong>' ),
47
-			'[EVENT_AUTHOR_EMAIL]' => sprintf( esc_html__('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]' ),
48
-			'[CO_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso' ),
46
+			'[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf(esc_html__('This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', 'event_espresso'), '<strong>', '</strong>'),
47
+			'[EVENT_AUTHOR_EMAIL]' => sprintf(esc_html__('This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', 'event_espresso'), '[EVENT_AUTHOR_FORMATTED_EMAIL]'),
48
+			'[CO_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso'),
49 49
 			'[CO_EMAIL]' => esc_html__('This will parse to the email address only for the organization set in Your Organization Settings.', 'event_espresso'),
50
-			'[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso' ),
50
+			'[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__('This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization &lt;[email protected]&gt;"', 'event_espresso'),
51 51
 			'[ESPRESSO_ADMIN_EMAIL]' => esc_html__('This parses to the email address only for the organization set in Your Organization Settings page.', 'event_espresso')
52 52
 			);
53 53
 	}
54 54
 
55 55
 
56
-	protected function _parser( $shortcode ) {
56
+	protected function _parser($shortcode) {
57 57
 
58
-		switch ( $shortcode ) {
58
+		switch ($shortcode) {
59 59
 
60 60
 			case '[SITE_ADMIN_EMAIL]' :
61 61
 				return $this->_get_site_admin_email();
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
 				break;
67 67
 
68 68
 			case '[EVENT_AUTHOR_EMAIL]' :
69
-				return $this->_get_event_admin_emails( FALSE );
69
+				return $this->_get_event_admin_emails(FALSE);
70 70
 				break;
71 71
 
72 72
 			case '[CO_FORMATTED_EMAIL]' :
73 73
 			case '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' :
74
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) . '>';
74
+				return EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.EE_Registry::instance()->CFG->organization->get_pretty('email').'>';
75 75
 				break;
76 76
 
77 77
 			case '[CO_EMAIL]' :
78 78
 			case '[ESPRESSO_ADMIN_EMAIL]' :
79
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'email' );
79
+				return EE_Registry::instance()->CFG->organization->get_pretty('email');
80 80
 				break;
81 81
 
82 82
 			default :
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 
101
-	private function _get_event_admin_emails( $fancy_headers = TRUE ) {
101
+	private function _get_event_admin_emails($fancy_headers = TRUE) {
102 102
 
103
-		if ( !empty( $this->_data->admin_email ) ) {
104
-			if ( ! $fancy_headers )
103
+		if ( ! empty($this->_data->admin_email)) {
104
+			if ( ! $fancy_headers)
105 105
 				return $this->_data->admin_email;
106
-			return !empty( $this->_data->fname ) ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $this->_data->admin_email . '>';
106
+			return ! empty($this->_data->fname) ? $this->_data->fname.' '.$this->_data->lname.' <'.$this->_data->admin_email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$this->_data->admin_email.'>';
107 107
 		}
108 108
 
109 109
 		//k this shortcode has been used else where.  Since we don't know what particular event this is for, let's loop through the events and get an array of event admins for the events.  We'll return the formatted list of admin emails and let the messenger make sure we only pick one if this is for a field that can only have ONE!.
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 		$admin_email = array();
112 112
 
113 113
 		//loop through events and set the list of event_ids to retrieve so we can do ONE query.
114
-		foreach ( $this->_data->events as $event ) {
114
+		foreach ($this->_data->events as $event) {
115 115
 			$ids[] = $event['ID'];
116 116
 		}
117 117
 
118 118
 		//get all the events
119
-		$events = EE_Registry::instance()->load_model('Event')->get_all( array(array('EVT_ID' => array('IN', $ids ) ) ) );
119
+		$events = EE_Registry::instance()->load_model('Event')->get_all(array(array('EVT_ID' => array('IN', $ids))));
120 120
 
121 121
 		//now loop through each event and setup the details
122 122
 		$admin_details = array();
123 123
 		$cnt = 0;
124
-		foreach ( $events as $event ) {
125
-			$user = get_userdata($event->get('EVT_wp_user') );
124
+		foreach ($events as $event) {
125
+			$user = get_userdata($event->get('EVT_wp_user'));
126 126
 			$admin_details[$cnt] = new stdClass();
127 127
 			$admin_details[$cnt]->email = $user->user_email;
128 128
 			$admin_details[$cnt]->first_name = $user->user_firstname;
@@ -131,28 +131,28 @@  discard block
 block discarded – undo
131 131
 		}
132 132
 
133 133
 		//results?
134
-		if ( empty($admin_details) || !is_array($admin_details) ) {
134
+		if (empty($admin_details) || ! is_array($admin_details)) {
135 135
 			$msg[] = esc_html__('The admin details could not be retrieved from the database.', 'event_espresso');
136
-			$msg[] = sprintf( esc_html__('Query: %s', 'event_espresso'), $sql );
137
-			$msg[] = sprintf( esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE) );
138
-			$msg[] = sprintf( esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE) );
139
-			$msg[] = sprintf( esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details) );
140
-			do_action( 'AHEE_log', __FILE__, __FUNCTION__, implode( PHP_EOL, $msg ), 'shortcode_parser' );
136
+			$msg[] = sprintf(esc_html__('Query: %s', 'event_espresso'), $sql);
137
+			$msg[] = sprintf(esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, TRUE));
138
+			$msg[] = sprintf(esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, TRUE));
139
+			$msg[] = sprintf(esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details));
140
+			do_action('AHEE_log', __FILE__, __FUNCTION__, implode(PHP_EOL, $msg), 'shortcode_parser');
141 141
 		}
142 142
 
143
-		foreach ( $admin_details as $admin ) {
143
+		foreach ($admin_details as $admin) {
144 144
 			//only add an admin email if it is present.
145
-			if ( empty( $admin->email ) || $admin->email == '' ) continue;
145
+			if (empty($admin->email) || $admin->email == '') continue;
146 146
 
147
-			if ( ! $fancy_headers ) {
147
+			if ( ! $fancy_headers) {
148 148
 				$admin_email[] = $admin->email;
149 149
 				continue;
150 150
 			}
151 151
 
152
-			$admin_email[] = !empty( $admin->first_name ) ? $admin->first_name . ' ' . $admin->last_name . ' <' . $admin->email . '>' : EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) . ' <' . $admin->email . '>';
152
+			$admin_email[] = ! empty($admin->first_name) ? $admin->first_name.' '.$admin->last_name.' <'.$admin->email.'>' : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$admin->email.'>';
153 153
 		}
154 154
 
155
-		$admin_email = implode( ',', $admin_email );
155
+		$admin_email = implode(',', $admin_email);
156 156
 		return $admin_email;
157 157
 	}
158 158
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Transaction_Shortcodes.lib.php 1 patch
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -42,25 +42,25 @@  discard block
 block discarded – undo
42 42
 		$this->_shortcodes = array(
43 43
 			'[TXN_ID]' => esc_html__('The transaction id for the purchase.', 'event_espresso'),
44 44
 			'[PAYMENT_URL]' => esc_html__('This is a link to make a payment for the event', 'event_espresso'),
45
-			'[PAYMENT_LINK_IF_NEEDED_*]' => esc_html__('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso') . '<ul>'
46
-				. '<li>' . sprintf( esc_html__('%sclass:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
47
-				. '<li>' . sprintf( esc_html__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
48
-				. '<li>' . sprintf( esc_html__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
45
+			'[PAYMENT_LINK_IF_NEEDED_*]' => esc_html__('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso').'<ul>'
46
+				. '<li>'.sprintf(esc_html__('%sclass:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso'), '<strong>', '</strong>').'</li>'
47
+				. '<li>'.sprintf(esc_html__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso'), '<strong>', '</strong>').'</li>'
48
+				. '<li>'.sprintf(esc_html__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso'), '<strong>', '</strong>').'</li>'
49 49
 				. '</ul>',
50
-			'[PAYMENT_DUE_DATE_*]' => esc_html__( 'This is a special dynamic shortcode that allows one to output a payment due date.  It will only result in a date shown if there is money owing.  Three parameters are available on this shortcode:', 'event_espresso' )
50
+			'[PAYMENT_DUE_DATE_*]' => esc_html__('This is a special dynamic shortcode that allows one to output a payment due date.  It will only result in a date shown if there is money owing.  Three parameters are available on this shortcode:', 'event_espresso')
51 51
 				. '<ul>'
52
-				. '<li>' . sprintf( esc_html__( '%sformat:%s This is used to indicate what format the date is in.  Default is whatever is set as date formats for your website.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
53
-				. '<li>' . sprintf( esc_html__( '%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due.  Defaults to 30.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
54
-				. '<li>' . sprintf( esc_html__( '%sprefix_text:%s You can use this to indicate what text will prefix the date string.  Defaults to "Payment in full due by:"', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>',
52
+				. '<li>'.sprintf(esc_html__('%sformat:%s This is used to indicate what format the date is in.  Default is whatever is set as date formats for your website.', 'event_espresso'), '<strong>', '</strong>').'</li>'
53
+				. '<li>'.sprintf(esc_html__('%sdays_until_due:%s This is the number of days form the transaction creation date that the payment is due.  Defaults to 30.', 'event_espresso'), '<strong>', '</strong>').'</li>'
54
+				. '<li>'.sprintf(esc_html__('%sprefix_text:%s You can use this to indicate what text will prefix the date string.  Defaults to "Payment in full due by:"', 'event_espresso'), '<strong>', '</strong>').'</li>',
55 55
 			'[INVOICE_LINK]' => esc_html__('This is a full html link to the invoice', 'event_espresso'),
56 56
 			'[INVOICE_URL]' => esc_html__('This is just the url for the invoice', 'event_espresso'),
57 57
 			'[INVOICE_LOGO_URL]' => esc_html__('This returns the url for the logo uploaded via the invoice settings page.', 'event_espresso'),
58 58
 			'[INVOICE_LOGO]' => esc_html__('This returns the logo uploaded via the invoice settings page wrapped in img_tags and with a "logo screen" classes. The image size is also set in the img tags automatically to match the uploaded logo.', 'event_espresso'),
59 59
 			'[INVOICE_PAYEE_NAME]' => esc_html__('This will parse to either: the value of the "Company Name" field in the invoice payment method settings; if that is blank, then the value of the Company Name in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
60
-			'[INVOICE_PAYEE_ADDRESS]' => esc_html__('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ),
61
-			'[INVOICE_PAYMENT_INSTRUCTIONS]' => esc_html__('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso' ),
62
-			'[INVOICE_PAYEE_EMAIL]' => esc_html__('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ),
63
-			'[INVOICE_PAYEE_TAX_NUMBER_*]' => sprintf( esc_html__('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number.  It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: %1$s[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]%2$s and that will ouptut: GST: 12345t56.  If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso' ), '<code>', '</code>' ),
60
+			'[INVOICE_PAYEE_ADDRESS]' => esc_html__('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
61
+			'[INVOICE_PAYMENT_INSTRUCTIONS]' => esc_html__('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso'),
62
+			'[INVOICE_PAYEE_EMAIL]' => esc_html__('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
63
+			'[INVOICE_PAYEE_TAX_NUMBER_*]' => sprintf(esc_html__('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number.  It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: %1$s[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]%2$s and that will ouptut: GST: 12345t56.  If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso'), '<code>', '</code>'),
64 64
 			'[TOTAL_COST]' => esc_html__('The total cost for the transaction', 'event_espresso'),
65 65
 			'[TXN_STATUS]' => esc_html__('The transaction status for the transaction.', 'event_espresso'),
66 66
 			'[TXN_STATUS_ID]' => esc_html__('The ID representing the transaction status as saved in the db.  This tends to be useful for including with css classes for styling certain statuses differently from others.', 'event_espresso'),
@@ -71,52 +71,52 @@  discard block
 block discarded – undo
71 71
 			'[TOTAL_OWING]' => esc_html__('The total owing on a transaction with no attributes.', 'event_espresso'),
72 72
 			'[TXN_SUBTOTAL]' => esc_html__('The subtotal for all txn line items.', 'event_espresso'),
73 73
 			'[TXN_TAX_SUBTOTAL]' => esc_html__('The subtotal for all tax line items.', 'event_espresso'),
74
-			'[OWING_STATUS_MESSAGE_*]' => esc_html__('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso') . '<p></ul>' .
75
-				'<li><strong>still_owing</strong>:' . esc_html__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso' ) . sprintf( esc_html__( '%sPlease make a payment.%s', 'event_espresso'),  '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ) . '</li>' .
76
-				'<li><strong>none_owing</strong>:' . esc_html__('If the transaction is paid in full, then you can indicate how this gets displayed.  Note, that it defaults to just be the total oweing.', 'event_espresso') . '</li></ul></p>',
74
+			'[OWING_STATUS_MESSAGE_*]' => esc_html__('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso').'<p></ul>'.
75
+				'<li><strong>still_owing</strong>:'.esc_html__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso').sprintf(esc_html__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>').'</li>'.
76
+				'<li><strong>none_owing</strong>:'.esc_html__('If the transaction is paid in full, then you can indicate how this gets displayed.  Note, that it defaults to just be the total oweing.', 'event_espresso').'</li></ul></p>',
77 77
 			'[TXN_TOTAL_TICKETS]' => esc_html__('The total number of all tickets purchased in a transaction', 'event_espresso'),
78
-			'[TKT_QTY_PURCHASED]' => sprintf( esc_html__('The total number of all tickets purchased in a transaction. %1$sNOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.%2$s', 'event_espresso'), '<strong>', '</strong>' ),
78
+			'[TKT_QTY_PURCHASED]' => sprintf(esc_html__('The total number of all tickets purchased in a transaction. %1$sNOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.%2$s', 'event_espresso'), '<strong>', '</strong>'),
79 79
 			'[TRANSACTION_ADMIN_URL]' => esc_html__('The url to the admin page for this transaction', 'event_espresso'),
80 80
 			'[RECEIPT_URL]' => esc_html__('This parses to the generated url for retrieving the receipt for the transaction', 'event_espresso'),
81
-			'[INVOICE_RECEIPT_SWITCHER_URL]' => esc_html__( 'This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active  then will parse to an empty string.', 'event_espresso'),
82
-			'[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf( esc_html__( 'The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso' ), '<code>', '</code>' )
81
+			'[INVOICE_RECEIPT_SWITCHER_URL]' => esc_html__('This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active  then will parse to an empty string.', 'event_espresso'),
82
+			'[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf(esc_html__('The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso'), '<code>', '</code>')
83 83
 			);
84 84
 	}
85 85
 
86 86
 
87
-	protected function _parser( $shortcode ) {
87
+	protected function _parser($shortcode) {
88 88
 
89 89
 		//attempt to get the transaction.  Since this is potentially used in more fields, we may have to look in the _extra_data for the transaction.
90 90
 		$transaction = $this->_data->txn instanceof EE_Transaction ? $this->_data->txn : null;
91
-		$transaction = ! $transaction instanceof EE_Transaction && is_array( $this->_extra_data ) &&  isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn: $transaction;
91
+		$transaction = ! $transaction instanceof EE_Transaction && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn : $transaction;
92 92
 
93 93
 		//payment
94 94
 		$payment = $this->_data->payment instanceof EE_Payment ? $this->_data->payment : null;
95
-		$payment = ! $payment instanceof EE_Payment && is_array( $this->_extra_data ) &&  isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment: $payment;
95
+		$payment = ! $payment instanceof EE_Payment && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment : $payment;
96 96
 
97 97
 
98
-		if ( ! $transaction instanceof EE_Transaction )
98
+		if ( ! $transaction instanceof EE_Transaction)
99 99
 			return '';
100 100
 
101
-		switch ( $shortcode ) {
101
+		switch ($shortcode) {
102 102
 			case '[TXN_ID]' :
103 103
 				return $transaction->ID();
104 104
 				break;
105 105
 
106 106
 			case '[PAYMENT_URL]' :
107 107
 				$payment_url = $transaction->payment_overview_url();
108
-				return empty( $payment_url ) ? esc_html__( 'http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url;
108
+				return empty($payment_url) ? esc_html__('http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url;
109 109
 				break;
110 110
 
111 111
 			case '[INVOICE_LINK]' :
112 112
 				$invoice_url = $transaction->invoice_url();
113
-				$invoice_url = empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
114
-				return sprintf( esc_html__('%sClick here for Invoice%s', 'event_espresso'), '<a href="' . $invoice_url . '">', '</a>' );
113
+				$invoice_url = empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
114
+				return sprintf(esc_html__('%sClick here for Invoice%s', 'event_espresso'), '<a href="'.$invoice_url.'">', '</a>');
115 115
 				break; /**/
116 116
 
117 117
 			case '[INVOICE_URL]' :
118 118
 				$invoice_url = $transaction->invoice_url();
119
-				return empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
119
+				return empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
120 120
 				break;
121 121
 
122 122
 			case '[INVOICE_LOGO_URL]' :
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 				break;
125 125
 
126 126
 			case '[INVOICE_LOGO]' :
127
-				return $this->_get_invoice_logo( TRUE );
127
+				return $this->_get_invoice_logo(TRUE);
128 128
 				break;
129 129
 
130 130
 			case '[INVOICE_PAYEE_NAME]' :
@@ -146,18 +146,18 @@  discard block
 block discarded – undo
146 146
 
147 147
 			case "[TOTAL_COST]" :
148 148
 				$total = $transaction->total();
149
-				return ! empty($total) ? EEH_Template::format_currency( $total ) : '';
149
+				return ! empty($total) ? EEH_Template::format_currency($total) : '';
150 150
 				break;
151 151
 
152 152
 			case "[PAYMENT_STATUS]" :
153 153
 				$status = $transaction->pretty_status();
154
-				return !empty($status) ? $status : esc_html__('Unknown', 'event_espresso');
154
+				return ! empty($status) ? $status : esc_html__('Unknown', 'event_espresso');
155 155
 				break; /**/
156 156
 
157 157
 			// note the [payment_status] shortcode is kind of misleading because payment status might be different from txn status so I'm adding this here for clarity.
158 158
 			case "[TXN_STATUS]" :
159 159
 				$status = $transaction->pretty_status();
160
-				return !empty( $status ) ? $status : esc_html__('Unknown', 'event_espresso');
160
+				return ! empty($status) ? $status : esc_html__('Unknown', 'event_espresso');
161 161
 				break;
162 162
 
163 163
 			case "[TXN_STATUS_ID]" :
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
 				break;
166 166
 
167 167
 			case "[PAYMENT_GATEWAY]" :
168
-				return $this->_get_payment_gateway( $transaction );
168
+				return $this->_get_payment_gateway($transaction);
169 169
 				break;
170 170
 
171 171
 			case "[AMOUNT_PAID]" :
172 172
 				$amount = $payment instanceof EE_Payment ? $payment->amount() : 0;
173
-				return EEH_Template::format_currency( $amount );
173
+				return EEH_Template::format_currency($amount);
174 174
 				break;
175 175
 
176 176
 			case "[TOTAL_AMOUNT_PAID]" :
177
-				return EEH_Template::format_currency( $transaction->paid() );
177
+				return EEH_Template::format_currency($transaction->paid());
178 178
 				break;
179 179
 
180 180
 			case "[TOTAL_OWING]" :
181 181
 				$total_owing = $transaction->remaining();
182
-				return EEH_Template::format_currency( $total_owing );
182
+				return EEH_Template::format_currency($total_owing);
183 183
 				break;
184 184
 
185 185
 			case "[TXN_SUBTOTAL]" :
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				break;
188 188
 
189 189
 			case "[TXN_TAX_SUBTOTAL]" :
190
-				return EEH_Template::format_currency($this->_get_subtotal( TRUE ));
190
+				return EEH_Template::format_currency($this->_get_subtotal(TRUE));
191 191
 				break;
192 192
 
193 193
 			case "[TKT_QTY_PURCHASED]" :
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 				break;
197 197
 
198 198
 			case "[TRANSACTION_ADMIN_URL]" :
199
-				require_once EE_CORE . 'admin/EE_Admin_Page.core.php';
200
-				$query_args = array( 'page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() );
201
-				$url = EE_Admin_Page::add_query_args_and_nonce( $query_args, admin_url('admin.php') );
199
+				require_once EE_CORE.'admin/EE_Admin_Page.core.php';
200
+				$query_args = array('page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID());
201
+				$url = EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php'));
202 202
 				return $url;
203 203
 				break;
204 204
 
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
 				//get primary_registration
207 207
 				$reg = $this->_data->primary_reg_obj;
208 208
 
209
-				if ( ! $reg instanceof EE_Registration ) {
209
+				if ( ! $reg instanceof EE_Registration) {
210 210
 					return '';
211 211
 				}
212 212
 				return $reg->receipt_url();
213 213
 				break;
214 214
 
215 215
 			case "[INVOICE_RECEIPT_SWITCHER_URL]" :
216
-				return $this->_get_invoice_receipt_switcher( FALSE );
216
+				return $this->_get_invoice_receipt_switcher(FALSE);
217 217
 				break;
218 218
 
219 219
 			case "[INVOICE_RECEIPT_SWITCHER_BUTTON]" :
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
 
224 224
 		}
225 225
 
226
-		if ( strpos( $shortcode, '[OWING_STATUS_MESSAGE_*' ) !== FALSE ) {
227
-			return $this->_get_custom_total_oweing( $shortcode );
226
+		if (strpos($shortcode, '[OWING_STATUS_MESSAGE_*') !== FALSE) {
227
+			return $this->_get_custom_total_oweing($shortcode);
228 228
 		}
229 229
 
230
-		if ( strpos( $shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*' ) !== FALSE ) {
231
-			return $this->_get_invoice_payee_tax_number( $shortcode );
230
+		if (strpos($shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*') !== FALSE) {
231
+			return $this->_get_invoice_payee_tax_number($shortcode);
232 232
 		}
233 233
 
234
-		if ( strpos( $shortcode, '[PAYMENT_LINK_IF_NEEDED_*' ) !== FALSE ) {
235
-			return $this->_get_payment_link_if_needed( $shortcode );
234
+		if (strpos($shortcode, '[PAYMENT_LINK_IF_NEEDED_*') !== FALSE) {
235
+			return $this->_get_payment_link_if_needed($shortcode);
236 236
 		}
237 237
 
238
-		if ( strpos( $shortcode, '[PAYMENT_DUE_DATE_*' ) !== false ) {
239
-			return $this->_get_payment_due_date( $shortcode, $transaction );
238
+		if (strpos($shortcode, '[PAYMENT_DUE_DATE_*') !== false) {
239
+			return $this->_get_payment_due_date($shortcode, $transaction);
240 240
 		}
241 241
 
242 242
 		return '';
@@ -253,19 +253,19 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @return string parsed.
255 255
 	 */
256
-	private function _get_custom_total_oweing( $shortcode ) {
257
-		$valid_shortcodes = array( 'transaction' );
258
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
256
+	private function _get_custom_total_oweing($shortcode) {
257
+		$valid_shortcodes = array('transaction');
258
+		$attrs = $this->_get_shortcode_attrs($shortcode);
259 259
 
260 260
 		//ensure default is set.
261 261
 		$addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
262 262
 		$total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0;
263 263
 
264
-		if ( $total_owing > 0 ) {
265
-			$owing_content = ! empty( $attrs['still_owing'] ) ? $attrs['still_owing'] : sprintf( esc_html__( '%sPlease make a payment.%s', 'event_espresso'),  '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' );
266
-			$owing_content = $this->_shortcode_helper->parse_message_template( $owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );
264
+		if ($total_owing > 0) {
265
+			$owing_content = ! empty($attrs['still_owing']) ? $attrs['still_owing'] : sprintf(esc_html__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>');
266
+			$owing_content = $this->_shortcode_helper->parse_message_template($owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message);
267 267
 		} else {
268
-			$owing_content = !empty( $attrs['none_owing']) ? $attrs['none_owing'] : '';
268
+			$owing_content = ! empty($attrs['none_owing']) ? $attrs['none_owing'] : '';
269 269
 		}
270 270
 
271 271
 		return $owing_content;
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
 
274 274
 
275 275
 
276
-	private function _get_payment_gateway( $transaction ) {
277
-		$pm = $this->_get_payment_method( $transaction );
276
+	private function _get_payment_gateway($transaction) {
277
+		$pm = $this->_get_payment_method($transaction);
278 278
 		return $pm instanceof EE_Payment_Method ? $pm->name() : '';
279 279
 	}
280 280
 
@@ -289,37 +289,37 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return string url or html
291 291
 	 */
292
-	private function _get_invoice_logo( $img_tags = FALSE ) {
292
+	private function _get_invoice_logo($img_tags = FALSE) {
293 293
 		//try to get the invoice payment method's logo for this transaction image first
294 294
 		$pm = $this->_get_payment_method();
295
-		if ( $pm instanceof EE_Payment_Method ){
296
-			$invoice_logo_url = $pm->get_extra_meta( 'pdf_logo_image', TRUE );
297
-		}else{
295
+		if ($pm instanceof EE_Payment_Method) {
296
+			$invoice_logo_url = $pm->get_extra_meta('pdf_logo_image', TRUE);
297
+		} else {
298 298
 			$invoice_logo_url = NULL;
299 299
 		}
300
-		if( empty( $invoice_logo_url ) ){
300
+		if (empty($invoice_logo_url)) {
301 301
 			$invoice_logo_url = EE_Registry::instance()->CFG->organization->logo_url;
302 302
 		}
303 303
 
304
-		if ( empty( $invoice_logo_url ) ) {
304
+		if (empty($invoice_logo_url)) {
305 305
 			return '';
306 306
 		}
307 307
 
308
-		if ( ! $img_tags ) {
308
+		if ( ! $img_tags) {
309 309
 			return $invoice_logo_url;
310 310
 		}
311 311
 
312 312
 		//image tags have been requested.
313
-		$image_size = getimagesize( $invoice_logo_url );
313
+		$image_size = getimagesize($invoice_logo_url);
314 314
 		
315 315
 		//if image is wider than 200px, set the wideth to 200
316
-		if ( $image_size[0] > 300 ) {
316
+		if ($image_size[0] > 300) {
317 317
 			$image_width = 300;
318
-		}else{
318
+		} else {
319 319
 			$image_width = $image_size[0];
320 320
 		}
321 321
 
322
-		return '<img class="logo screen" src="' . $invoice_logo_url . '" width="' . $image_width . '" alt="logo" />';
322
+		return '<img class="logo screen" src="'.$invoice_logo_url.'" width="'.$image_width.'" alt="logo" />';
323 323
 	}
324 324
 
325 325
 
@@ -336,26 +336,26 @@  discard block
 block discarded – undo
336 336
 	private function _get_invoice_payee_name() {
337 337
 		$payee_name = NULL;
338 338
 		$pm = $this->_get_payment_method();
339
-		if( $pm instanceof EE_Payment_Method ){
340
-			$payee_name = $pm->get_extra_meta( 'pdf_payee_name', TRUE );
339
+		if ($pm instanceof EE_Payment_Method) {
340
+			$payee_name = $pm->get_extra_meta('pdf_payee_name', TRUE);
341 341
 		}
342
-		$payee_name = empty( $payee_name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : $payee_name;
342
+		$payee_name = empty($payee_name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : $payee_name;
343 343
 		return $payee_name;
344 344
 	}
345 345
 
346 346
 	/**
347 347
 	 * gets the payment method for this transaction. Otherwise gets a default one.
348 348
 	 */
349
-	private function _get_payment_method( $transaction = null ){
350
-		if( $transaction instanceof EE_Transaction ) {
349
+	private function _get_payment_method($transaction = null) {
350
+		if ($transaction instanceof EE_Transaction) {
351 351
 			$payment_method = $transaction->payment_method();
352
-			if ( empty( $payment_method ) ) {
353
-				return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
352
+			if (empty($payment_method)) {
353
+				return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
354 354
 			}
355 355
 			return $payment_method;
356
-		}else{
356
+		} else {
357 357
 			//get the first payment method we can find
358
-			return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
358
+			return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
359 359
 		}
360 360
 	}
361 361
 
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
 	private function _get_invoice_payee_email() {
373 373
 		$payee_email = NULL;
374 374
 		$pm = $this->_get_payment_method();
375
-		if( $pm instanceof EE_Payment_Method ){
376
-			$payee_email = $pm->get_extra_meta( 'pdf_payee_email', TRUE );
375
+		if ($pm instanceof EE_Payment_Method) {
376
+			$payee_email = $pm->get_extra_meta('pdf_payee_email', TRUE);
377 377
 		}
378
-		$payee_email = empty( $payee_email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : $payee_email;
378
+		$payee_email = empty($payee_email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : $payee_email;
379 379
 		return $payee_email;
380 380
 	}
381 381
 
@@ -391,24 +391,24 @@  discard block
 block discarded – undo
391 391
 	 *
392 392
 	 * @return string
393 393
 	 */
394
-	private function _get_invoice_payee_tax_number( $shortcode ) {
394
+	private function _get_invoice_payee_tax_number($shortcode) {
395 395
 		$payee_tax_number = NULL;
396 396
 		$pm = $this->_get_payment_method();
397
-		if( $pm instanceof EE_Payment_Method ){
398
-			$payee_tax_number = $pm->get_extra_meta( 'pdf_payee_tax_number', TRUE );
397
+		if ($pm instanceof EE_Payment_Method) {
398
+			$payee_tax_number = $pm->get_extra_meta('pdf_payee_tax_number', TRUE);
399 399
 		}
400
-		$payee_tax_number = empty( $payee_tax_number ) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number;
400
+		$payee_tax_number = empty($payee_tax_number) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number;
401 401
 
402
-		if ( empty( $payee_tax_number ) ) {
402
+		if (empty($payee_tax_number)) {
403 403
 			return '';
404 404
 		}
405 405
 
406 406
 		//any attributes?
407
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
407
+		$attrs = $this->_get_shortcode_attrs($shortcode);
408 408
 
409 409
 		//prefix?
410
-		$prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : esc_html__( 'VAT/Tax Number: ', 'event_espresso' );
411
-		return $prefix . $payee_tax_number;
410
+		$prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso');
411
+		return $prefix.$payee_tax_number;
412 412
 	}
413 413
 
414 414
 
@@ -425,22 +425,22 @@  discard block
 block discarded – undo
425 425
 	private function _get_invoice_payee_address() {
426 426
 		$payee_address = NULL;
427 427
 		$pm = $this->_get_payment_method();
428
-		if( $pm instanceof EE_Payment_Method ){
429
-			$payee_address = $pm->get_extra_meta( 'pdf_payee_address', TRUE );
428
+		if ($pm instanceof EE_Payment_Method) {
429
+			$payee_address = $pm->get_extra_meta('pdf_payee_address', TRUE);
430 430
 		}
431
-		if ( empty( $payee_address ) ) {
431
+		if (empty($payee_address)) {
432 432
 			$organization = EE_Registry::instance()->CFG->organization;
433
-			$payee_address = $organization->get_pretty( 'address_1' ) . '<br>';
434
-			$payee_address .= !empty( $organization->address_2 ) ? $organization->get_pretty( 'address_2' ) . '<br>' : '';
435
-			$payee_address .= $organization->get_pretty( 'city' ) . '<br>';
433
+			$payee_address = $organization->get_pretty('address_1').'<br>';
434
+			$payee_address .= ! empty($organization->address_2) ? $organization->get_pretty('address_2').'<br>' : '';
435
+			$payee_address .= $organization->get_pretty('city').'<br>';
436 436
 
437 437
 			//state
438
-			$state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $organization->STA_ID );
439
-			$payee_address .= $state instanceof EE_State ? $state->name()  : '';
438
+			$state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID);
439
+			$payee_address .= $state instanceof EE_State ? $state->name() : '';
440 440
 
441 441
 			//Country
442
-			$payee_address .= ! empty( $organization->CNT_ISO ) ? ', ' . $organization->CNT_ISO . '<br>' : '';
443
-			$payee_address .= ! empty( $organization->zip ) ? $organization->zip : '';
442
+			$payee_address .= ! empty($organization->CNT_ISO) ? ', '.$organization->CNT_ISO.'<br>' : '';
443
+			$payee_address .= ! empty($organization->zip) ? $organization->zip : '';
444 444
 		}
445 445
 		return $payee_address;
446 446
 	}
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	private function _get_invoice_payment_instructions() {
459 459
 		$instructions = NULL;
460 460
 		$pm = $this->_get_payment_method();
461
-		return ( $pm instanceof EE_Payment_Method ) ? $pm->get_extra_meta( 'pdf_instructions', TRUE) : '';
461
+		return ($pm instanceof EE_Payment_Method) ? $pm->get_extra_meta('pdf_instructions', TRUE) : '';
462 462
 	}
463 463
 
464 464
 
@@ -472,27 +472,27 @@  discard block
 block discarded – undo
472 472
 	 *
473 473
 	 * @return string
474 474
 	 */
475
-	protected function _get_invoice_receipt_switcher( $button = TRUE ) {
475
+	protected function _get_invoice_receipt_switcher($button = TRUE) {
476 476
 		$reg = $this->_data->primary_reg_obj;
477
-		$message_type = isset( $this->_extra_data['message_type'] ) ? $this->_extra_data['message_type'] : '';
478
-		if ( ! $reg instanceof EE_Registration || empty( $message_type ) ) {
477
+		$message_type = isset($this->_extra_data['message_type']) ? $this->_extra_data['message_type'] : '';
478
+		if ( ! $reg instanceof EE_Registration || empty($message_type)) {
479 479
 			return '';
480 480
 		}
481 481
 
482
-		$switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type  ? true : false;
483
-		$switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? esc_html__('View Invoice', 'event_espresso' ) : esc_html__( 'Switch to Invoice', 'event_espresso' );
484
-		$switch_to_label = ! $switch_to_invoice ? esc_html__( 'Switch to Receipt', 'event_espresso' ) : $switch_to_label;
482
+		$switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false;
483
+		$switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? esc_html__('View Invoice', 'event_espresso') : esc_html__('Switch to Invoice', 'event_espresso');
484
+		$switch_to_label = ! $switch_to_invoice ? esc_html__('Switch to Receipt', 'event_espresso') : $switch_to_label;
485 485
 		$switch_to_url = $switch_to_invoice ? $reg->invoice_url() : $reg->receipt_url();
486 486
 
487
-		if ( ! $button ) {
487
+		if ( ! $button) {
488 488
 			return $switch_to_url;
489 489
 		}
490 490
 
491
-		if ( ! empty( $switch_to_url ) ) {
491
+		if ( ! empty($switch_to_url)) {
492 492
 
493 493
 			return  '
494
-	<form method="post" action="' . $switch_to_url . '" >
495
-		<input class="print_button" type="submit" value="' . $switch_to_label . '" />
494
+	<form method="post" action="' . $switch_to_url.'" >
495
+		<input class="print_button" type="submit" value="' . $switch_to_label.'" />
496 496
 	</form>
497 497
 			';
498 498
 		}
@@ -512,11 +512,11 @@  discard block
 block discarded – undo
512 512
 	 *
513 513
 	 * @return string
514 514
 	 */
515
-	private function _get_receipt_url( EE_Transaction $transaction ) {
515
+	private function _get_receipt_url(EE_Transaction $transaction) {
516 516
 		//get primary_registration
517 517
 		$reg = $this->_data->primary_reg_obj;
518 518
 
519
-		if ( ! $reg instanceof EE_Registration ) {
519
+		if ( ! $reg instanceof EE_Registration) {
520 520
 			return '';
521 521
 		}
522 522
 
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return int
534 534
 	 */
535
-	private function _get_subtotal( $tax = FALSE ) {
536
-		$grand_total = isset( $this->_data->grand_total_line_item ) ? $this->_data->grand_total_line_item : NULL;
535
+	private function _get_subtotal($tax = FALSE) {
536
+		$grand_total = isset($this->_data->grand_total_line_item) ? $this->_data->grand_total_line_item : NULL;
537 537
 
538
-		if ( ! $grand_total instanceof EE_Line_Item ) {
538
+		if ( ! $grand_total instanceof EE_Line_Item) {
539 539
 			return 0;
540 540
 		}
541 541
 
@@ -554,26 +554,26 @@  discard block
 block discarded – undo
554 554
 	 *
555 555
 	 * @return string parsed.
556 556
 	 */
557
-	private function _get_payment_link_if_needed( $shortcode ) {
558
-		$valid_shortcodes = array( 'transaction' );
559
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
557
+	private function _get_payment_link_if_needed($shortcode) {
558
+		$valid_shortcodes = array('transaction');
559
+		$attrs = $this->_get_shortcode_attrs($shortcode);
560 560
 
561 561
 		//ensure default is set.
562 562
 		$addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
563 563
 		$total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0;
564 564
 
565
-		if ( $total_owing > 0 ) {
566
-			$class = isset( $attrs['class'] ) ? $attrs['class'] : 'callout';
567
-			$custom_text = isset( $attrs['custom_text'] ) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.';
568
-			$container_tag = isset( $attrs['container_tag'] ) ? $attrs['container_tag'] : 'p';
569
-			$opening_tag = ! empty( $container_tag ) ? '<' . $container_tag : '';
570
-			$opening_tag .= ! empty( $opening_tag ) && !empty( $class ) ? ' class="' . $class . '"' : $opening_tag;
571
-			$opening_tag .= !empty( $opening_tag ) ? '>' : $opening_tag;
572
-			$closing_tag = ! empty( $container_tag ) ? '</' . $container_tag .'>' : '';
573
-			$content = $opening_tag . sprintf( $custom_text, '<a href="[PAYMENT_URL]">', '</a>' ) . $closing_tag;
565
+		if ($total_owing > 0) {
566
+			$class = isset($attrs['class']) ? $attrs['class'] : 'callout';
567
+			$custom_text = isset($attrs['custom_text']) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.';
568
+			$container_tag = isset($attrs['container_tag']) ? $attrs['container_tag'] : 'p';
569
+			$opening_tag = ! empty($container_tag) ? '<'.$container_tag : '';
570
+			$opening_tag .= ! empty($opening_tag) && ! empty($class) ? ' class="'.$class.'"' : $opening_tag;
571
+			$opening_tag .= ! empty($opening_tag) ? '>' : $opening_tag;
572
+			$closing_tag = ! empty($container_tag) ? '</'.$container_tag.'>' : '';
573
+			$content = $opening_tag.sprintf($custom_text, '<a href="[PAYMENT_URL]">', '</a>').$closing_tag;
574 574
 
575 575
 			//we need to re run this string through the parser to catch any shortcodes that are in it.
576
-			$owing_content = $this->_shortcode_helper->parse_message_template( $content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );
576
+			$owing_content = $this->_shortcode_helper->parse_message_template($content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message);
577 577
 		} else {
578 578
 			return '';
579 579
 		}
@@ -593,31 +593,31 @@  discard block
 block discarded – undo
593 593
 	 * @param EE_Transaction $transaction
594 594
 	 * @return string
595 595
 	 */
596
-	protected function _get_payment_due_date( $shortcode, EE_Transaction $transaction ) {
596
+	protected function _get_payment_due_date($shortcode, EE_Transaction $transaction) {
597 597
 		//if transaction is paid in full then we can just return an empty string
598
-		if ( $transaction->remaining() === 0 ) {
598
+		if ($transaction->remaining() === 0) {
599 599
 			return '';
600 600
 		}
601 601
 
602
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
603
-		$format = isset( $attrs['format'] ) ? $attrs['format'] : get_option( 'date_format' );
604
-		$days_until_due = isset( $attrs['days_until_due'] ) ? (int) $attrs['days_until_due'] : 30;
605
-		$prefix_text = isset( $attrs['prefix_text'] ) ? $attrs['prefix_text'] : esc_html__( 'Payment in full due by: ', 'event_espresso' );
606
-		$transaction_created = $transaction->get_DateTime_object( 'TXN_timestamp' );
602
+		$attrs = $this->_get_shortcode_attrs($shortcode);
603
+		$format = isset($attrs['format']) ? $attrs['format'] : get_option('date_format');
604
+		$days_until_due = isset($attrs['days_until_due']) ? (int) $attrs['days_until_due'] : 30;
605
+		$prefix_text = isset($attrs['prefix_text']) ? $attrs['prefix_text'] : esc_html__('Payment in full due by: ', 'event_espresso');
606
+		$transaction_created = $transaction->get_DateTime_object('TXN_timestamp');
607 607
 
608 608
 		//setup date due:
609 609
 		try {
610
-			if ( $transaction_created instanceof DateTime ) {
611
-				$date_due = $transaction_created->add( new DateInterval( 'P' . $days_until_due . 'D' ) )->format( $format );
610
+			if ($transaction_created instanceof DateTime) {
611
+				$date_due = $transaction_created->add(new DateInterval('P'.$days_until_due.'D'))->format($format);
612 612
 			} else {
613 613
 				throw new Exception();
614 614
 			}
615
-		} catch( Exception $e ) {
615
+		} catch (Exception $e) {
616 616
 			//format was likely invalid.
617 617
 			$date_due = 'Unable to calculate date due, likely the format string is invalid.';
618 618
 		}
619 619
 
620
-		return $prefix_text . $date_due;
620
+		return $prefix_text.$date_due;
621 621
 	}
622 622
 
623 623
 } //end EE_Transaction Shortcodes library
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -959,12 +959,12 @@
 block discarded – undo
959 959
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
960 960
 			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
961 961
 			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable',
962
-		    'reg_list_url' => $default || ! $dtt->event() instanceof \EE_Event
963
-                ? ''
964
-                : EE_Admin_Page::add_query_args_and_nonce(
965
-                    array( 'event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID() ),
966
-                    REG_ADMIN_URL
967
-                )
962
+			'reg_list_url' => $default || ! $dtt->event() instanceof \EE_Event
963
+				? ''
964
+				: EE_Admin_Page::add_query_args_and_nonce(
965
+					array( 'event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID() ),
966
+					REG_ADMIN_URL
967
+				)
968 968
 		);
969 969
 
970 970
 		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
Please login to merge, or discard this patch.
Spacing   +382 added lines, -382 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$this->_name = 'pricing';
55 55
 
56 56
 		//capability check
57
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
57
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
58 58
 			return;
59 59
 		}
60 60
 
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 		//if we were going to add our own metaboxes we'd use the below.
63 63
 		$this->_metaboxes = array(
64 64
 			0 => array(
65
-				'page_route' => array('edit','create_new'),
65
+				'page_route' => array('edit', 'create_new'),
66 66
 				'func' => 'pricing_metabox',
67 67
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
68 68
 				'priority' => 'high',
69 69
 				'context' => 'normal'
70 70
 				),
71 71
 
72
-			);/**/
72
+			); /**/
73 73
 
74 74
 		$this->_remove_metaboxes = array(
75 75
 			0 => array(
@@ -88,24 +88,24 @@  discard block
 block discarded – undo
88 88
 		 *
89 89
 		 * @var array  Expected an array returned with 'date' and 'time' keys.
90 90
 		 */
91
-		$this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
91
+		$this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
92 92
 				'date' => 'Y-m-d',
93 93
 				'time' => 'h:i a'
94 94
 			));
95 95
 
96 96
 		//validate
97
-		$this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null;
98
-		$this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null;
97
+		$this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
98
+		$this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
99 99
 
100 100
 		//validate format strings
101
-		$format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
102
-		if ( is_array( $format_validation ) ) {
103
-			$msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>';
104
-			foreach ( $format_validation as $error ) {
105
-				$msg .= '<li>' . $error . '</li>';
101
+		$format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
102
+		if (is_array($format_validation)) {
103
+			$msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>';
104
+			foreach ($format_validation as $error) {
105
+				$msg .= '<li>'.$error.'</li>';
106 106
 			}
107
-			$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
108
-			EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
107
+			$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
108
+			EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
109 109
 			$this->_date_format_strings = array(
110 110
 				'date' => 'Y-m-d',
111 111
 				'time' => 'h:i a'
@@ -116,60 +116,60 @@  discard block
 block discarded – undo
116 116
 		$this->_scripts_styles = array(
117 117
 			'registers' => array(
118 118
 				'ee-tickets-datetimes-css' => array(
119
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
119
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
120 120
 					'type' => 'css'
121 121
 					),
122 122
 				'ee-dtt-ticket-metabox' => array(
123
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
123
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
124 124
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
125 125
 					)
126 126
 				),
127 127
 			'deregisters' => array(
128
-				'event-editor-css' => array('type' => 'css' ),
128
+				'event-editor-css' => array('type' => 'css'),
129 129
 				'event-datetime-metabox' => array('type' => 'js')
130 130
 				),
131 131
 			'enqueues' => array(
132
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
133
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
132
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
133
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
134 134
 				),
135 135
 			'localize' => array(
136 136
 				'ee-dtt-ticket-metabox' => array(
137 137
 					'DTT_TRASH_BLOCK' => array(
138 138
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
139 139
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
140
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
140
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
141 141
 						'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
142 142
 						'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
143
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
143
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
144 144
 						),
145 145
 					'DTT_ERROR_MSG' => array(
146 146
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
147
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
147
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
148 148
 						),
149 149
 					'DTT_OVERSELL_WARNING' => array(
150 150
 						'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'),
151 151
 						'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso')
152 152
 						),
153
-					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ),
154
-					'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) )
153
+					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']),
154
+					'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week'))
155 155
 					)
156 156
 				)
157 157
 			);
158 158
 
159 159
 
160
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
161
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
160
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
161
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
162 162
 	}
163 163
 
164 164
 
165 165
 
166
-	public function caf_updates( $update_callbacks ) {
167
-		foreach ( $update_callbacks as $key => $callback ) {
168
-			if ( $callback[1] == '_default_tickets_update' )
169
-				unset( $update_callbacks[$key] );
166
+	public function caf_updates($update_callbacks) {
167
+		foreach ($update_callbacks as $key => $callback) {
168
+			if ($callback[1] == '_default_tickets_update')
169
+				unset($update_callbacks[$key]);
170 170
 		}
171 171
 
172
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
172
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
173 173
 		return $update_callbacks;
174 174
 	}
175 175
 
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	 * @param  array    $data   The request data from the form
183 183
 	 * @return bool             success or fail
184 184
 	 */
185
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
185
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
186 186
 		//first we need to start with datetimes cause they are the "root" items attached to events.
187
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
187
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
188 188
 		//next tackle the tickets (and prices?)
189
-		$this->_update_tkts( $evtobj, $saved_dtts, $data );
189
+		$this->_update_tkts($evtobj, $saved_dtts, $data);
190 190
 	}
191 191
 
192 192
 
@@ -197,41 +197,41 @@  discard block
 block discarded – undo
197 197
 	 * @param  array    	$data    the request data from the form
198 198
 	 * @return EE_Datetime[]
199 199
 	 */
200
-	protected function _update_dtts( $evt_obj, $data ) {
201
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
200
+	protected function _update_dtts($evt_obj, $data) {
201
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
202 202
 		$saved_dtt_ids = array();
203 203
 		$saved_dtt_objs = array();
204 204
 
205
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
205
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
206 206
 			//trim all values to ensure any excess whitespace is removed.
207 207
 			$dtt = array_map(
208
-				function( $datetime_data ) {
209
-					return is_array( $datetime_data ) ? $datetime_data : trim( $datetime_data );
208
+				function($datetime_data) {
209
+					return is_array($datetime_data) ? $datetime_data : trim($datetime_data);
210 210
 				},
211 211
 				$dtt
212 212
 			);
213
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
213
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
214 214
 			$datetime_values = array(
215
-				'DTT_ID' 			=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
216
-				'DTT_name' 			=> ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
217
-				'DTT_description' 	=> ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
215
+				'DTT_ID' 			=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
216
+				'DTT_name' 			=> ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
217
+				'DTT_description' 	=> ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
218 218
 				'DTT_EVT_start' 	=> $dtt['DTT_EVT_start'],
219 219
 				'DTT_EVT_end' 		=> $dtt['DTT_EVT_end'],
220
-				'DTT_reg_limit' 	=> empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ],
221
-				'DTT_order' 		=> ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
220
+				'DTT_reg_limit' 	=> empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
221
+				'DTT_order' 		=> ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
222 222
 			);
223 223
 
224 224
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
225 225
 
226
-			if ( !empty( $dtt['DTT_ID'] ) ) {
227
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
226
+			if ( ! empty($dtt['DTT_ID'])) {
227
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
228 228
 
229 229
 				//set date and time format according to what is set in this class.
230
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
231
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
230
+				$DTM->set_date_format($this->_date_format_strings['date']);
231
+				$DTM->set_time_format($this->_date_format_strings['time']);
232 232
 
233
-				foreach ( $datetime_values as $field => $value ) {
234
-					$DTM->set( $field, $value );
233
+				foreach ($datetime_values as $field => $value) {
234
+					$DTM->set($field, $value);
235 235
 				}
236 236
 
237 237
 				// make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.
@@ -239,24 +239,24 @@  discard block
 block discarded – undo
239 239
 				$saved_dtt_ids[$DTM->ID()] = $DTM->ID();
240 240
 
241 241
 			} else {
242
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
242
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
243 243
 
244 244
 				//reset date and times to match the format
245
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
246
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
247
-				foreach( $datetime_values as $field => $value ) {
248
-					$DTM->set( $field, $value );
245
+				$DTM->set_date_format($this->_date_format_strings['date']);
246
+				$DTM->set_time_format($this->_date_format_strings['time']);
247
+				foreach ($datetime_values as $field => $value) {
248
+					$DTM->set($field, $value);
249 249
 				}
250 250
 			}
251 251
 
252 252
 
253 253
 			$DTM->save();
254
-			$DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
254
+			$DTM = $evt_obj->_add_relation_to($DTM, 'Datetime');
255 255
 			$evt_obj->save();
256 256
 
257 257
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
258
-			if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) {
259
-				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') );
258
+			if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) {
259
+				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start'));
260 260
 				$DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
261 261
 				$DTM->save();
262 262
 			}
@@ -271,25 +271,25 @@  discard block
 block discarded – undo
271 271
 		}
272 272
 
273 273
 		//now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
274
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
274
+		$old_datetimes = explode(',', $data['datetime_IDs']);
275 275
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
276 276
 
277
-		if ( is_array( $old_datetimes ) ) {
278
-			$dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids );
279
-			foreach ( $dtts_to_delete as $id ) {
280
-				$id = absint( $id );
281
-				if ( empty( $id ) )
277
+		if (is_array($old_datetimes)) {
278
+			$dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids);
279
+			foreach ($dtts_to_delete as $id) {
280
+				$id = absint($id);
281
+				if (empty($id))
282 282
 					continue;
283 283
 
284 284
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
285 285
 
286 286
 				//remove tkt relationships.
287 287
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
288
-				foreach ( $related_tickets as $tkt ) {
288
+				foreach ($related_tickets as $tkt) {
289 289
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
290 290
 				}
291 291
 
292
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
292
+				$evt_obj->_remove_relation_to($id, 'Datetime');
293 293
 				$dtt_to_remove->refresh_cache_of_related_objects();
294 294
 
295 295
 			}
@@ -310,85 +310,85 @@  discard block
 block discarded – undo
310 310
 	 * @param  array            $data       incoming request data
311 311
 	 * @return EE_Ticket[]
312 312
 	 */
313
-	protected function _update_tkts( $evtobj, $saved_dtts, $data ) {
313
+	protected function _update_tkts($evtobj, $saved_dtts, $data) {
314 314
 
315 315
 		$new_tkt = null;
316 316
 		$new_default = null;
317 317
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
318 318
 		$data = stripslashes_deep($data);
319
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
319
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
320 320
 		$saved_tickets = $dtts_on_existing = array();
321
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
321
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
322 322
 
323 323
 		//load money helper
324 324
 
325
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
325
+		foreach ($data['edit_tickets'] as $row => $tkt) {
326 326
 
327 327
 			$update_prices = $create_new_TKT = FALSE;
328 328
 
329 329
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
330 330
 
331
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
332
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
331
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
332
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
333 333
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
334 334
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
335 335
 
336 336
 			// trim inputs to ensure any excess whitespace is removed.
337 337
 			$tkt = array_map(
338
-				function( $ticket_data ) {
339
-					return is_array( $ticket_data ) ? $ticket_data : trim( $ticket_data );
338
+				function($ticket_data) {
339
+					return is_array($ticket_data) ? $ticket_data : trim($ticket_data);
340 340
 				},
341 341
 				$tkt
342 342
 			);
343 343
 
344 344
 			//note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
345 345
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
346
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
346
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
347 347
 
348 348
 			//note incoming base price needs converted from localized value.
349
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
349
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
350 350
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
351 351
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
352
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
352
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
353 353
 
354 354
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
355 355
 
356 356
 			$now = null;
357
-			if ( empty( $tkt['TKT_start_date'] ) ) {
357
+			if (empty($tkt['TKT_start_date'])) {
358 358
 				//lets' use now in the set timezone.
359
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
360
-				$tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
359
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
360
+				$tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
361 361
 			}
362 362
 
363
-			if ( empty( $tkt['TKT_end_date'] ) ) {
363
+			if (empty($tkt['TKT_end_date'])) {
364 364
 				/**
365 365
 				 * set the TKT_end_date to the first datetime attached to the ticket.
366 366
 				 */
367
-				$first_dtt = $saved_dtts[reset( $tkt_dtt_rows )];
368
-				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] );
367
+				$first_dtt = $saved_dtts[reset($tkt_dtt_rows)];
368
+				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']);
369 369
 			}
370 370
 
371 371
 			$TKT_values = array(
372
-				'TKT_ID' 			=> ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
373
-				'TTM_ID' 			=> ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
374
-				'TKT_name' 			=> ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
375
-				'TKT_description' 	=> ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
372
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
373
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
374
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
375
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
376 376
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
377 377
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
378
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ],
379
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'],
380
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
381
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
378
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
379
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
380
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
381
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
382 382
 				'TKT_row' 			=> $row,
383
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
384
-				'TKT_taxable' 		=> ! empty( $tkt['TKT_taxable'] ) ? 1 : 0,
385
-				'TKT_required' 		=> ! empty( $tkt['TKT_required'] ) ? 1 : 0,
383
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
384
+				'TKT_taxable' 		=> ! empty($tkt['TKT_taxable']) ? 1 : 0,
385
+				'TKT_required' 		=> ! empty($tkt['TKT_required']) ? 1 : 0,
386 386
 				'TKT_price' 		=> $ticket_price
387 387
 			);
388 388
 
389 389
 
390 390
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
391
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
391
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
392 392
 				$TKT_values['TKT_ID'] = 0;
393 393
 				$TKT_values['TKT_is_default'] = 0;
394 394
 				$update_prices = TRUE;
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
 			// but DID have it's items modified.
401 401
 			// keep in mind that if the TKT has been sold (and we have changed pricing information),
402 402
 			// then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
403
-			if ( absint( $TKT_values['TKT_ID'] ) ) {
404
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
405
-				if ( $TKT instanceof EE_Ticket ) {
403
+			if (absint($TKT_values['TKT_ID'])) {
404
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
405
+				if ($TKT instanceof EE_Ticket) {
406 406
 
407
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
407
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
408 408
 					// are there any registrations using this ticket ?
409 409
 					$tickets_sold = $TKT->count_related(
410 410
 						'Registration',
411
-						array( array(
412
-								'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) )
413
-						) )
411
+						array(array(
412
+								'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))
413
+						))
414 414
 					);
415 415
 					//set ticket formats
416
-					$TKT->set_date_format( $this->_date_format_strings['date'] );
417
-					$TKT->set_time_format( $this->_date_format_strings['time'] );
416
+					$TKT->set_date_format($this->_date_format_strings['date']);
417
+					$TKT->set_time_format($this->_date_format_strings['time']);
418 418
 
419 419
 					// let's just check the total price for the existing ticket
420 420
 					// and determine if it matches the new total price.
@@ -424,17 +424,17 @@  discard block
 block discarded – undo
424 424
 							? TRUE : FALSE;
425 425
 
426 426
 					//set new values
427
-					foreach ( $TKT_values as $field => $value ) {
428
-						if ( $field === 'TKT_qty' ) {
429
-							$TKT->set_qty( $value );
427
+					foreach ($TKT_values as $field => $value) {
428
+						if ($field === 'TKT_qty') {
429
+							$TKT->set_qty($value);
430 430
 						} else {
431
-							$TKT->set( $field, $value );
431
+							$TKT->set($field, $value);
432 432
 						}
433 433
 					}
434 434
 
435 435
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
436
-					if ( $create_new_TKT ) {
437
-						$new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id );
436
+					if ($create_new_TKT) {
437
+						$new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id);
438 438
 					}
439 439
 				}
440 440
 
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
 				$TKT = EE_Ticket::new_instance(
444 444
 					$TKT_values,
445 445
 					$timezone,
446
-					array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ]  )
446
+					array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
447 447
 				);
448
-				if ( $TKT instanceof EE_Ticket ) {
448
+				if ($TKT instanceof EE_Ticket) {
449 449
 					// make sure ticket has an ID of setting relations won't work
450 450
 					$TKT->save();
451
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
451
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
452 452
 					$update_prices = TRUE;
453 453
 				}
454 454
 			}
@@ -456,37 +456,37 @@  discard block
 block discarded – undo
456 456
 			//$TKT->save();
457 457
 
458 458
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
459
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
460
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
459
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
460
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
461 461
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
462 462
 			}
463 463
 
464 464
 			//let's make sure the base price is handled
465
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
465
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
466 466
 
467 467
 			//add/update price_modifiers
468
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
468
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
469 469
 
470 470
 			//need to make sue that the TKT_price is accurate after saving the prices.
471 471
 			$TKT->ensure_TKT_Price_correct();
472 472
 
473 473
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
474
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
475
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
474
+			if ( ! defined('DOING_AUTOSAVE')) {
475
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
476 476
 					$update_prices = TRUE;
477 477
 					$new_default = clone $TKT;
478
-					$new_default->set( 'TKT_ID', 0 );
479
-					$new_default->set( 'TKT_is_default', 1 );
480
-					$new_default->set( 'TKT_row', 1 );
481
-					$new_default->set( 'TKT_price', $ticket_price );
478
+					$new_default->set('TKT_ID', 0);
479
+					$new_default->set('TKT_is_default', 1);
480
+					$new_default->set('TKT_row', 1);
481
+					$new_default->set('TKT_price', $ticket_price);
482 482
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
483 483
 					$new_default->_remove_relations('Datetime');
484 484
 					//todo we need to add the current attached prices as new prices to the new default ticket.
485
-					$new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices );
485
+					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
486 486
 					//don't forget the base price!
487
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
487
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
488 488
 					$new_default->save();
489
-					do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data );
489
+					do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data);
490 490
 				}
491 491
 			}
492 492
 
@@ -497,19 +497,19 @@  discard block
 block discarded – undo
497 497
 			//let's assign any tickets that have been setup to the saved_tickets tracker
498 498
 			//save existing TKT
499 499
 			$TKT->save();
500
-			if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) {
500
+			if ($create_new_TKT && $new_tkt instanceof EE_Ticket) {
501 501
 				//save new TKT
502 502
 				$new_tkt->save();
503 503
 				//add new ticket to array
504
-				$saved_tickets[ $new_tkt->ID() ] = $new_tkt;
504
+				$saved_tickets[$new_tkt->ID()] = $new_tkt;
505 505
 
506
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
506
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
507 507
 
508 508
 			} else {
509 509
 				//add tkt to saved tkts
510
-				$saved_tickets[ $TKT->ID() ] = $TKT;
510
+				$saved_tickets[$TKT->ID()] = $TKT;
511 511
 
512
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
512
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
513 513
 			}
514 514
 
515 515
 		}
@@ -519,22 +519,22 @@  discard block
 block discarded – undo
519 519
 		// (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).
520 520
 		// Or a draft event was saved and in the process of editing a ticket is trashed.
521 521
 		// No sense in keeping all the related data in the db!
522
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
523
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
522
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
523
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
524 524
 
525
-		foreach ( $tickets_removed as $id ) {
526
-			$id = absint( $id );
525
+		foreach ($tickets_removed as $id) {
526
+			$id = absint($id);
527 527
 
528 528
 			//get the ticket for this id
529 529
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
530 530
 
531 531
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
532
-			if ( $tkt_to_remove->get('TKT_is_default') )
532
+			if ($tkt_to_remove->get('TKT_is_default'))
533 533
 				continue;
534 534
 
535 535
 			// if this tkt has any registrations attached so then we just ARCHIVE
536 536
 			// because we don't actually permanently delete these tickets.
537
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
537
+			if ($tkt_to_remove->count_related('Registration') > 0) {
538 538
 				$tkt_to_remove->delete();
539 539
 				continue;
540 540
 			}
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 			// (remember this process can ONLY kick off if there are NO tkts_sold)
544 544
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
545 545
 
546
-			foreach( $dtts as $dtt ) {
546
+			foreach ($dtts as $dtt) {
547 547
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
548 548
 			}
549 549
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			// tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
552 552
 			$tkt_to_remove->delete_related_permanently('Price');
553 553
 
554
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
554
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
555 555
 
556 556
 			// finally let's delete this ticket
557 557
 			// (which should not be blocked at this point b/c we've removed all our relationships)
@@ -583,39 +583,39 @@  discard block
 block discarded – undo
583 583
 		// and removing the ticket from datetimes it got removed from.
584 584
 
585 585
 		// first let's add datetimes
586
-		if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) {
587
-			foreach ( $added_datetimes as $row_id ) {
586
+		if ( ! empty($added_datetimes) && is_array($added_datetimes)) {
587
+			foreach ($added_datetimes as $row_id) {
588 588
 				$row_id = (int) $row_id;
589
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
590
-					$ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
589
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
590
+					$ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime');
591 591
 					// Is this an existing ticket (has an ID) and does it have any sold?
592 592
 					// If so, then we need to add that to the DTT sold because this DTT is getting added.
593
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
594
-						$saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() );
595
-						$saved_datetimes[ $row_id ]->save();
593
+					if ($ticket->ID() && $ticket->sold() > 0) {
594
+						$saved_datetimes[$row_id]->increase_sold($ticket->sold());
595
+						$saved_datetimes[$row_id]->save();
596 596
 					}
597 597
 				}
598 598
 			}
599 599
 		}
600 600
 		// then remove datetimes
601
-		if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) {
602
-			foreach ( $removed_datetimes as $row_id ) {
603
-				$row_id = (int)$row_id;
601
+		if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) {
602
+			foreach ($removed_datetimes as $row_id) {
603
+				$row_id = (int) $row_id;
604 604
 				// its entirely possible that a datetime got deleted (instead of just removed from relationship.
605 605
 				// So make sure we skip over this if the dtt isn't in the $saved_datetimes array)
606
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
607
-					$ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
606
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
607
+					$ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime');
608 608
 					// Is this an existing ticket (has an ID) and does it have any sold?
609 609
 					// If so, then we need to remove it's sold from the DTT_sold.
610
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
611
-						$saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() );
612
-						$saved_datetimes[ $row_id ]->save();
610
+					if ($ticket->ID() && $ticket->sold() > 0) {
611
+						$saved_datetimes[$row_id]->decrease_sold($ticket->sold());
612
+						$saved_datetimes[$row_id]->save();
613 613
 					}
614 614
 				}
615 615
 			}
616 616
 		}
617 617
 		// cap ticket qty by datetime reg limits
618
-		$ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) );
618
+		$ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
619 619
 		return $ticket;
620 620
 	}
621 621
 
@@ -636,39 +636,39 @@  discard block
 block discarded – undo
636 636
 		EE_Ticket $ticket,
637 637
 		$price_rows = array(),
638 638
 		$ticket_price = 0,
639
-		$base_price = 0 ,
639
+		$base_price = 0,
640 640
 		$base_price_id = 0
641 641
 	) {
642 642
 
643 643
 		// create new ticket that's a copy of the existing
644 644
 		// except a new id of course (and not archived)
645 645
 		// AND has the new TKT_price associated with it.
646
-		$new_ticket = clone( $ticket );
647
-		$new_ticket->set( 'TKT_ID', 0 );
648
-		$new_ticket->set( 'TKT_deleted', 0 );
649
-		$new_ticket->set( 'TKT_price', $ticket_price );
650
-		$new_ticket->set( 'TKT_sold', 0 );
646
+		$new_ticket = clone($ticket);
647
+		$new_ticket->set('TKT_ID', 0);
648
+		$new_ticket->set('TKT_deleted', 0);
649
+		$new_ticket->set('TKT_price', $ticket_price);
650
+		$new_ticket->set('TKT_sold', 0);
651 651
 		// let's get a new ID for this ticket
652 652
 		$new_ticket->save();
653 653
 		// we also need to make sure this new ticket gets the same datetime attachments as the archived ticket
654
-		$datetimes_on_existing = $ticket->get_many_related( 'Datetime' );
654
+		$datetimes_on_existing = $ticket->get_many_related('Datetime');
655 655
 		$new_ticket = $this->_update_ticket_datetimes(
656 656
 			$new_ticket,
657 657
 			$datetimes_on_existing,
658
-			array_keys( $datetimes_on_existing )
658
+			array_keys($datetimes_on_existing)
659 659
 		);
660 660
 
661 661
 		// $ticket will get archived later b/c we are NOT adding it to the saved_tickets array.
662 662
 		// if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining
663 663
 		// available.
664
-		if ( $ticket->sold() > 0 ) {
664
+		if ($ticket->sold() > 0) {
665 665
 			$new_qty = $ticket->qty() - $ticket->sold();
666
-			$new_ticket->set_qty( $new_qty );
666
+			$new_ticket->set_qty($new_qty);
667 667
 		}
668 668
 		//now we update the prices just for this ticket
669
-		$new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true );
669
+		$new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true);
670 670
 		//and we update the base price
671
-		$new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id );
671
+		$new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id);
672 672
 		return $new_ticket;
673 673
 	}
674 674
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
689 689
 	 * @return EE_Ticket
690 690
 	 */
691
-	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
691
+	protected function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
692 692
 
693 693
 		//let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
694 694
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 		$updated_prices = array();
697 697
 
698 698
 		// if $base_price ! FALSE then updating a base price.
699
-		if ( $base_price !== FALSE ) {
699
+		if ($base_price !== FALSE) {
700 700
 			$prices[1] = array(
701 701
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
702 702
 				'PRT_ID' => 1,
@@ -707,47 +707,47 @@  discard block
 block discarded – undo
707 707
 		}
708 708
 
709 709
 		//possibly need to save tkt
710
-		if ( ! $ticket->ID() )
710
+		if ( ! $ticket->ID())
711 711
 			$ticket->save();
712 712
 
713
-		foreach ( $prices as $row => $prc ) {
714
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
715
-			if ( empty($prt_id) )
713
+		foreach ($prices as $row => $prc) {
714
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
715
+			if (empty($prt_id))
716 716
 				continue; //prices MUST have a price type id.
717 717
 			$PRC_values = array(
718
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
718
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
719 719
 				'PRT_ID' => $prt_id,
720
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
721
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
722
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
720
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
721
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
722
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
723 723
 				'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor
724 724
 				'PRC_order' => $row
725 725
 				);
726
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
726
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
727 727
 				$PRC_values['PRC_ID'] = 0;
728
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
728
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
729 729
 			} else {
730
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
730
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
731 731
 				//update this price with new values
732
-				foreach ( $PRC_values as $field => $newprc ) {
733
-					$PRC->set( $field, $newprc );
732
+				foreach ($PRC_values as $field => $newprc) {
733
+					$PRC->set($field, $newprc);
734 734
 				}
735 735
 			}
736 736
 			$PRC->save();
737 737
 			$prcid = $PRC->ID();
738 738
 			$updated_prices[$prcid] = $PRC;
739
-			$ticket->_add_relation_to( $PRC, 'Price' );
739
+			$ticket->_add_relation_to($PRC, 'Price');
740 740
 		}
741 741
 
742 742
 		//now let's remove any prices that got removed from the ticket
743
-		if ( !empty ( $current_prices_on_ticket ) ) {
743
+		if ( ! empty ($current_prices_on_ticket)) {
744 744
 			$current = array_keys($current_prices_on_ticket);
745 745
 			$updated = array_keys($updated_prices);
746 746
 			$prices_to_remove = array_diff($current, $updated);
747
-			if ( !empty( $prices_to_remove ) ) {
748
-				foreach ( $prices_to_remove as $prc_id ) {
747
+			if ( ! empty($prices_to_remove)) {
748
+				foreach ($prices_to_remove as $prc_id) {
749 749
 					$p = $current_prices_on_ticket[$prc_id];
750
-					$ticket->_remove_relation_to( $p, 'Price' );
750
+					$ticket->_remove_relation_to($p, 'Price');
751 751
 
752 752
 					//delete permanently the price
753 753
 					$p->delete_permanently();
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 
761 761
 
762 762
 
763
-	public function autosave_handling( $event_admin_obj ) {
763
+	public function autosave_handling($event_admin_obj) {
764 764
 		return $event_admin_obj; //doing nothing for the moment.
765 765
 		//todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
766 766
 
@@ -794,12 +794,12 @@  discard block
 block discarded – undo
794 794
 
795 795
 		//default main template args
796 796
 		$main_template_args = array(
797
-			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
797
+			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
798 798
 			'existing_datetime_ids' => '',
799 799
 			'total_dtt_rows' => 1,
800
-			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
800
+			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
801 801
 			'datetime_rows' => '',
802
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
802
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
803 803
 			'ticket_rows' => '',
804 804
 			'existing_ticket_ids' => '',
805 805
 			'total_ticket_rows' => 1,
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 
810 810
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
811 811
 
812
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
812
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
813 813
 
814 814
 		/**
815 815
 		 * 1. Start with retrieving Datetimes
@@ -817,8 +817,8 @@  discard block
 block discarded – undo
817 817
 		 * 3. For each ticket get related prices
818 818
 		 */
819 819
 
820
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
821
-		$times = $DTM->get_all_event_dates( $evtID );
820
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
821
+		$times = $DTM->get_all_event_dates($evtID);
822 822
 
823 823
 
824 824
 
@@ -826,31 +826,31 @@  discard block
 block discarded – undo
826 826
 
827 827
 		/** @see https://events.codebasehq.com/projects/event-espresso/tickets/9486 for why we are counting $dttrow and then setting that on the Datetime object */
828 828
 		$dttrow = 1;
829
-		foreach ( $times as $time ) {
829
+		foreach ($times as $time) {
830 830
 			$dttid = $time->get('DTT_ID');
831
-			$time->set( 'DTT_order', $dttrow );
831
+			$time->set('DTT_order', $dttrow);
832 832
 			$existing_datetime_ids[] = $dttid;
833 833
 
834 834
 			//tickets attached
835
-			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array();
835
+			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array();
836 836
 
837 837
 			//if there are no related tickets this is likely a new event OR autodraft
838 838
 			// event so we need to generate the default tickets because dtts
839 839
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
840 840
 			// datetime on the event.
841
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
841
+			if (empty ($related_tickets) && count($times) < 2) {
842 842
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
843 843
 
844 844
 				//this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save).
845 845
 				$default_prices = EEM_Price::instance()->get_all_default_prices();
846 846
 
847
-				$main_default_ticket = reset( $related_tickets );
848
-				if ( $main_default_ticket instanceof EE_Ticket ) {
849
-					foreach ( $default_prices as $default_price ) {
850
-						if ( $default_price->is_base_price() ) {
847
+				$main_default_ticket = reset($related_tickets);
848
+				if ($main_default_ticket instanceof EE_Ticket) {
849
+					foreach ($default_prices as $default_price) {
850
+						if ($default_price->is_base_price()) {
851 851
 							continue;
852 852
 						}
853
-						$main_default_ticket->cache( 'Price', $default_price );
853
+						$main_default_ticket->cache('Price', $default_price);
854 854
 					}
855 855
 				}
856 856
 			}
@@ -859,11 +859,11 @@  discard block
 block discarded – undo
859 859
 			//we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information.
860 860
 
861 861
 			//loop through and setup the ticket rows and make sure the order is set.
862
-			foreach ( $related_tickets as $ticket ) {
862
+			foreach ($related_tickets as $ticket) {
863 863
 				$tktid = $ticket->get('TKT_ID');
864 864
 				$tktrow = $ticket->get('TKT_row');
865 865
 				//we only want unique tickets in our final display!!
866
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
866
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
867 867
 					$existing_ticket_ids[] = $tktid;
868 868
 					$all_tickets[] = $ticket;
869 869
 				}
@@ -872,57 +872,57 @@  discard block
 block discarded – undo
872 872
 				$datetime_tickets[$dttid][] = $tktrow;
873 873
 
874 874
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
875
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
875
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
876 876
 					$ticket_datetimes[$tktid][] = $dttrow;
877 877
 			}
878 878
 			$dttrow++;
879 879
 		}
880 880
 
881
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
882
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
883
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
881
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
882
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
883
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
884 884
 
885 885
 		//sort $all_tickets by order
886
-		usort( $all_tickets, function( $a, $b ) {
886
+		usort($all_tickets, function($a, $b) {
887 887
 			$a_order = (int) $a->get('TKT_order');
888 888
 			$b_order = (int) $b->get('TKT_order');
889
-			if ( $a_order == $b_order ) {
889
+			if ($a_order == $b_order) {
890 890
 				return 0;
891 891
 			}
892
-			return ( $a_order < $b_order ) ? -1 : 1;
892
+			return ($a_order < $b_order) ? -1 : 1;
893 893
 		});
894 894
 
895 895
 		//k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
896 896
 		$dttrow = 1;
897
-		foreach ( $times as $time ) {
898
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
897
+		foreach ($times as $time) {
898
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
899 899
 			$dttrow++;
900 900
 		}
901 901
 
902 902
 		//then loop through all tickets for the ticket rows.
903 903
 		$tktrow = 1;
904
-		foreach ( $all_tickets as $ticket ) {
905
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
904
+		foreach ($all_tickets as $ticket) {
905
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
906 906
 			$tktrow++;
907 907
 		}
908 908
 
909 909
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
910
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
911
-		EEH_Template::display_template( $template, $main_template_args );
910
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
911
+		EEH_Template::display_template($template, $main_template_args);
912 912
 		return;
913 913
 	}
914 914
 
915 915
 
916 916
 
917
-	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
917
+	protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
918 918
 
919 919
 		$dtt_display_template_args = array(
920
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
921
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
920
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
921
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
922 922
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
923 923
 			);
924
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
925
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
924
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
925
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
926 926
 	}
927 927
 
928 928
 
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 	 *
941 941
 	 * @return string Generated edit row.
942 942
 	 */
943
-	protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
943
+	protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
944 944
 
945 945
 		// if the incoming $dtt object is NOT an instance of EE_Datetime then force default to true.
946 946
 		$default = ! $dtt instanceof EE_Datetime ? true : false;
@@ -948,36 +948,36 @@  discard block
 block discarded – undo
948 948
 		$template_args = array(
949 949
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
950 950
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
951
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
951
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
952 952
 			'DTT_ID' => $default ? '' : $dtt->ID(),
953 953
 			'DTT_name' => $default ? '' : $dtt->name(),
954 954
 			'DTT_description' => $default ? '' : $dtt->description(),
955
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
956
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
957
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
955
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
956
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
957
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
958 958
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
959 959
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
960
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
961
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable',
960
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
961
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable',
962 962
 		    'reg_list_url' => $default || ! $dtt->event() instanceof \EE_Event
963 963
                 ? ''
964 964
                 : EE_Admin_Page::add_query_args_and_nonce(
965
-                    array( 'event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID() ),
965
+                    array('event_id' => $dtt->event()->ID(), 'datetime_id' => $dtt->ID()),
966 966
                     REG_ADMIN_URL
967 967
                 )
968 968
 		);
969 969
 
970
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
970
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
971 971
 
972 972
 		//allow filtering of template args at this point.
973
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event );
973
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
974 974
 
975
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
976
-		return EEH_Template::display_template( $template, $template_args, TRUE );
975
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
976
+		return EEH_Template::display_template($template, $template_args, TRUE);
977 977
 	}
978 978
 
979 979
 
980
-	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
980
+	protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
981 981
 
982 982
 		$template_args = array(
983 983
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -985,47 +985,47 @@  discard block
 block discarded – undo
985 985
 			'DTT_description' => $default ? '' : $dtt->description(),
986 986
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
987 987
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
988
-			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
988
+			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
989 989
 			'DTT_ID' => $default ? '' : $dtt->ID()
990 990
 			);
991 991
 
992 992
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
993
-		if ( !$default ) {
993
+		if ( ! $default) {
994 994
 			$tktrow = 1;
995
-			foreach ( $all_tickets as $ticket ) {
996
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
995
+			foreach ($all_tickets as $ticket) {
996
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
997 997
 				$tktrow++;
998 998
 			}
999 999
 		}
1000 1000
 
1001 1001
 		//filter template args at this point
1002
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event );
1002
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
1003 1003
 
1004
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
1005
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1004
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
1005
+		return EEH_Template::display_template($template, $template_args, TRUE);
1006 1006
 	}
1007 1007
 
1008 1008
 
1009 1009
 
1010
-	protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
1011
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
1012
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
1010
+	protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
1011
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
1012
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
1013 1013
 
1014
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
1014
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
1015 1015
 		$template_args = array(
1016 1016
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
1017
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
1017
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1018 1018
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
1019 1019
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
1020
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
1021
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
1020
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
1021
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
1022 1022
 			);
1023 1023
 
1024 1024
 		//filter template args
1025
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event );
1025
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
1026 1026
 
1027
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
1028
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1027
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
1028
+		return EEH_Template::display_template($template, $template_args, TRUE);
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1047,37 +1047,37 @@  discard block
 block discarded – undo
1047 1047
 	 *
1048 1048
 	 * @return [type] [description]
1049 1049
 	 */
1050
-	protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
1050
+	protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
1051 1051
 
1052 1052
 		//if $ticket is not an instance of EE_Ticket then force default to true.
1053
-		$default =  ! $ticket instanceof EE_Ticket ? true : false;
1053
+		$default = ! $ticket instanceof EE_Ticket ? true : false;
1054 1054
 
1055
-		$prices = ! empty( $ticket ) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
1055
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
1056 1056
 
1057 1057
 		//if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on
1058 1058
 		//the object.  This is done by not including any query_params.
1059
-		if ( $ticket instanceof EE_Ticket && $ticket->is_default() && ( count( $prices ) === 1  || empty( $prices ) ) ) {
1060
-			$prices = $ticket->get_many_related( 'Price' );
1059
+		if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) {
1060
+			$prices = $ticket->get_many_related('Price');
1061 1061
 		}
1062 1062
 
1063 1063
 		// check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
1064
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
1064
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
1065 1065
 
1066
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1066
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1067 1067
 
1068 1068
 		$ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal();
1069
-		$base_price = $default ? NULL :  $ticket->base_price();
1069
+		$base_price = $default ? NULL : $ticket->base_price();
1070 1070
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
1071 1071
 
1072 1072
 		//breaking out complicated condition for ticket_status
1073
-		if ( $default ) {
1074
-			$ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
1073
+		if ($default) {
1074
+			$ticket_status_class = ' tkt-status-'.EE_Ticket::onsale;
1075 1075
 		} else {
1076
-			$ticket_status_class =  $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
1076
+			$ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status();
1077 1077
 		}
1078 1078
 
1079 1079
 		//breaking out complicated condition for TKT_taxable
1080
-		if ( $default ) {
1080
+		if ($default) {
1081 1081
 			$TKT_taxable = '';
1082 1082
 		} else {
1083 1083
 			$TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
@@ -1092,19 +1092,19 @@  discard block
 block discarded – undo
1092 1092
 			'edit_tkt_expanded' => '',
1093 1093
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
1094 1094
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
1095
-			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
1096
-			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']  ),
1097
-			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1095
+			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1096
+			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1097
+			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1098 1098
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
1099 1099
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
1100 1100
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
1101
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
1102
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
1103
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
1104
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
1105
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
1101
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1102
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1103
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1104
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1105
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1106 1106
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
1107
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
1107
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
1108 1108
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
1109 1109
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
1110 1110
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -1113,99 +1113,99 @@  discard block
 block discarded – undo
1113 1113
 			'ticket_price_rows' => '',
1114 1114
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
1115 1115
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1116
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
1117
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
1116
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1117
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1118 1118
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
1119 1119
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
1120 1120
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1121 1121
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
1122
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
1122
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
1123 1123
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
1124 1124
 			'TKT_taxable' => $TKT_taxable,
1125 1125
 			'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1126 1126
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1127
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
1127
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
1128 1128
 			'TKT_subtotal_amount' => $ticket_subtotal,
1129
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
1130
-			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE,
1129
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
1130
+			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE,
1131 1131
 			'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1132 1132
 			'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1133 1133
 			'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1134 1134
 			);
1135 1135
 
1136
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1136
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1137 1137
 
1138 1138
 		//handle rows that should NOT be empty
1139
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1139
+		if (empty($template_args['TKT_start_date'])) {
1140 1140
 			//if empty then the start date will be now.
1141
-			$template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp'));
1142
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1141
+			$template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp'));
1142
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1143 1143
 		}
1144 1144
 
1145
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1145
+		if (empty($template_args['TKT_end_date'])) {
1146 1146
 
1147 1147
 			//get the earliest datetime (if present);
1148
-			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1148
+			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1149 1149
 
1150
-			if ( !empty( $earliest_dtt ) ) {
1151
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
1150
+			if ( ! empty($earliest_dtt)) {
1151
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
1152 1152
 			} else {
1153 1153
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
1154
-				$template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
1154
+				$template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1155 1155
 			}
1156
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1156
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1157 1157
 		}
1158 1158
 
1159 1159
 		//generate ticket_datetime items
1160
-		if ( ! $default ) {
1160
+		if ( ! $default) {
1161 1161
 			$dttrow = 1;
1162
-			foreach ( $all_dtts as $dtt ) {
1163
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
1162
+			foreach ($all_dtts as $dtt) {
1163
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
1164 1164
 				$dttrow++;
1165 1165
 			}
1166 1166
 		}
1167 1167
 
1168 1168
 		$prcrow = 1;
1169
-		foreach ( $prices as $price ) {
1170
-			if ( $price->is_base_price() ) {
1169
+		foreach ($prices as $price) {
1170
+			if ($price->is_base_price()) {
1171 1171
 				$prcrow++;
1172 1172
 				continue;
1173 1173
 			}
1174
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
1175
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
1176
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
1174
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
1175
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
1176
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
1177 1177
 			$prcrow++;
1178 1178
 		}
1179 1179
 
1180 1180
 		//filter $template_args
1181
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event );
1181
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event);
1182 1182
 
1183
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1184
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1183
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
1184
+		return EEH_Template::display_template($template, $template_args, TRUE);
1185 1185
 	}
1186 1186
 
1187 1187
 
1188 1188
 
1189 1189
 
1190 1190
 
1191
-	protected function _get_tax_rows( $tktrow, $ticket ) {
1191
+	protected function _get_tax_rows($tktrow, $ticket) {
1192 1192
 		$tax_rows = '';
1193
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1193
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
1194 1194
 		$template_args = array();
1195
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1196
-		foreach ( $taxes as $tax ) {
1197
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
1195
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1196
+		foreach ($taxes as $tax) {
1197
+			$tax_added = $this->_get_tax_added($tax, $ticket);
1198 1198
 			$template_args = array(
1199
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1199
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1200 1200
 				'tax_id' => $tax->ID(),
1201 1201
 				'tkt_row' => $tktrow,
1202 1202
 				'tax_label' => $tax->get('PRC_name'),
1203 1203
 				'tax_added' => $tax_added,
1204
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
1204
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
1205 1205
 				'tax_amount' => $tax->get('PRC_amount')
1206 1206
 				);
1207
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
1208
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
1207
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
1208
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
1209 1209
 		}
1210 1210
 
1211 1211
 
@@ -1213,81 +1213,81 @@  discard block
 block discarded – undo
1213 1213
 	}
1214 1214
 
1215 1215
 
1216
-	protected function _get_tax_added( EE_Price $tax, $ticket ) {
1217
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
1216
+	protected function _get_tax_added(EE_Price $tax, $ticket) {
1217
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1218 1218
 		return $subtotal * $tax->get('PRC_amount') / 100;
1219 1219
 	}
1220 1220
 
1221 1221
 
1222 1222
 
1223 1223
 
1224
-	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1225
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1224
+	protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
1225
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1226 1226
 		$template_args = array(
1227 1227
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1228 1228
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1229 1229
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1230
-			'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ),
1230
+			'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
1231 1231
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
1232 1232
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1233 1233
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
1234 1234
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1235 1235
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
1236
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1237
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1238
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
1239
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1240
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
1236
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1237
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1238
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1239
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1240
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1241 1241
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
1242 1242
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
1243
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1244
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1243
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1244
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1245 1245
 			);
1246 1246
 
1247
-	$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event );
1247
+	$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event);
1248 1248
 
1249
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1250
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1249
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1250
+		return EEH_Template::display_template($template, $template_args, TRUE);
1251 1251
 	}
1252 1252
 
1253 1253
 
1254
-	protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1255
-		if ( $price->is_base_price() ) {
1256
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1254
+	protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1255
+		if ($price->is_base_price()) {
1256
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1257 1257
 		} else {
1258
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1258
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1259 1259
 		}
1260 1260
 
1261 1261
 	}
1262 1262
 
1263 1263
 
1264
-	protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1264
+	protected function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1265 1265
 		$template_args = array(
1266 1266
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1267
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1268
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1267
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1268
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1269 1269
 				'PRT_name' => __('Price', 'event_espresso'),
1270 1270
 				'price_selected_operator' => '+',
1271 1271
 				'price_selected_is_percent' => 0
1272 1272
 			);
1273
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1273
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1274 1274
 
1275
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event );
1275
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1276 1276
 
1277
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1277
+		return EEH_Template::display_template($template, $template_args, TRUE);
1278 1278
 	}
1279 1279
 
1280 1280
 
1281 1281
 
1282
-	protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1283
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1284
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1285
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1286
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1287
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1282
+	protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1283
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1284
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1285
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1286
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1287
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1288 1288
 		$price_option_spans = '';
1289 1289
 		//setup pricetypes for selector
1290
-		foreach ( $price_types as $price_type ) {
1290
+		foreach ($price_types as $price_type) {
1291 1291
 			$all_price_types[] = array(
1292 1292
 				'id' => $price_type->ID(),
1293 1293
 				'text' => $price_type->get('PRT_name'),
@@ -1299,50 +1299,50 @@  discard block
 block discarded – undo
1299 1299
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1300 1300
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1301 1301
 				);
1302
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1302
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1303 1303
 		}
1304 1304
 
1305
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1305
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1306 1306
 		$main_name = $select_name;
1307
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1307
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1308 1308
 
1309 1309
 		$template_args = array(
1310 1310
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1311
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1312
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1311
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1312
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1313 1313
 			'main_name' => $main_name,
1314 1314
 			'selected_price_type_id' => $selected_price_type_id,
1315 1315
 			'price_option_spans' => $price_option_spans,
1316
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1317
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1316
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1317
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1318 1318
 			'disabled' => $disabled
1319 1319
 			);
1320 1320
 
1321
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event );
1321
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1322 1322
 
1323
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1323
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1324 1324
 
1325
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1325
+		return EEH_Template::display_template($template, $template_args, TRUE);
1326 1326
 	}
1327 1327
 
1328 1328
 
1329 1329
 
1330
-	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1331
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1332
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1333
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1330
+	protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1331
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1332
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1333
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1334 1334
 		$template_args = array(
1335
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1335
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1336 1336
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1337
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1338
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1339
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1337
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1338
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1339
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1340 1340
 			'tkt_status_class' => '',
1341 1341
 			);
1342 1342
 
1343
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event );
1344
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1345
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1343
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1344
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1345
+		return EEH_Template::display_template($template, $template_args, TRUE);
1346 1346
 	}
1347 1347
 
1348 1348
 
@@ -1350,53 +1350,53 @@  discard block
 block discarded – undo
1350 1350
 	protected function _get_ticket_js_structure($all_dtts, $all_tickets) {
1351 1351
 		$template_args = array(
1352 1352
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1353
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1354
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1353
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1354
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1355 1355
 			'default_price_rows' => '',
1356 1356
 			'default_base_price_amount' => 0,
1357 1357
 			'default_base_price_name' => '',
1358 1358
 			'default_base_price_description' => '',
1359
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1360
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1359
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1360
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1361 1361
 			'existing_available_datetime_tickets_list' => '',
1362 1362
 			'existing_available_ticket_datetimes_list' => '',
1363
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1364
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1363
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1364
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1365 1365
 			);
1366 1366
 
1367 1367
 		$tktrow = 1;
1368
-		foreach ( $all_tickets as $ticket ) {
1369
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1368
+		foreach ($all_tickets as $ticket) {
1369
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1370 1370
 			$tktrow++;
1371 1371
 		}
1372 1372
 
1373 1373
 
1374 1374
 		$dttrow = 1;
1375
-		foreach ( $all_dtts as $dtt ) {
1376
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1375
+		foreach ($all_dtts as $dtt) {
1376
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1377 1377
 			$dttrow++;
1378 1378
 		}
1379 1379
 
1380 1380
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1381 1381
 		$prcrow = 1;
1382
-		foreach ( $default_prices as $price ) {
1383
-			if ( $price->is_base_price() ) {
1382
+		foreach ($default_prices as $price) {
1383
+			if ($price->is_base_price()) {
1384 1384
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1385 1385
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1386 1386
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1387 1387
 				$prcrow++;
1388 1388
 				continue;
1389 1389
 			}
1390
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1391
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1392
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1390
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1391
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1392
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1393 1393
 			$prcrow++;
1394 1394
 		}
1395 1395
 
1396
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event );
1396
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1397 1397
 
1398
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1399
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1398
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1399
+		return EEH_Template::display_template($template, $template_args, TRUE);
1400 1400
 	}
1401 1401
 
1402 1402
 
Please login to merge, or discard this patch.
espresso.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'ABSPATH' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('ABSPATH')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  *
42 42
  */
43 43
 
44
-if ( function_exists( 'espresso_version' ) ) {
44
+if (function_exists('espresso_version')) {
45 45
 
46 46
 	/**
47 47
 	 *    espresso_duplicate_plugin_error
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	function espresso_duplicate_plugin_error() {
51 51
 		?>
52 52
 		<div class="error">
53
-			<p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p>
53
+			<p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p>
54 54
 		</div>
55 55
 		<?php
56
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
56
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
57 57
 	}
58
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
58
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59 59
 
60 60
 } else {
61 61
 
@@ -66,103 +66,103 @@  discard block
 block discarded – undo
66 66
 	 * @return string
67 67
 	 */
68 68
 	function espresso_version() {
69
-		return apply_filters( 'FHEE__espresso__espresso_version', '4.9.8.rc.010' );
69
+		return apply_filters('FHEE__espresso__espresso_version', '4.9.8.rc.010');
70 70
 	}
71 71
 
72 72
 	// define versions
73
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
74
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.1' );
75
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' );
76
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
77
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
78
-	define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION );
79
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
73
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
74
+	define('EE_MIN_WP_VER_REQUIRED', '4.1');
75
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
76
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
77
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
78
+	define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION);
79
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
80 80
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
81
-	if ( ! defined( 'DS' ) ) {
82
-		define( 'DS', '/' );
81
+	if ( ! defined('DS')) {
82
+		define('DS', '/');
83 83
 	}
84
-	if ( ! defined( 'PS' ) ) {
85
-		define( 'PS', PATH_SEPARATOR );
84
+	if ( ! defined('PS')) {
85
+		define('PS', PATH_SEPARATOR);
86 86
 	}
87
-	if ( ! defined( 'SP' ) ) {
88
-		define( 'SP', ' ' );
87
+	if ( ! defined('SP')) {
88
+		define('SP', ' ');
89 89
 	}
90
-	if ( ! defined( 'EENL' ) ) {
91
-		define( 'EENL', "\n" );
90
+	if ( ! defined('EENL')) {
91
+		define('EENL', "\n");
92 92
 	}
93
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
93
+	define('EE_SUPPORT_EMAIL', '[email protected]');
94 94
 	// define the plugin directory and URL
95
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
96
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
97
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
95
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
96
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
97
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
98 98
 	// main root folder paths
99
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
100
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
101
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
102
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
103
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
104
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
105
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
106
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
99
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
100
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
101
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
102
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
103
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
104
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
105
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
106
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
107 107
 	// core system paths
108
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
109
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
110
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
111
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
112
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
113
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
114
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
115
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
116
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
117
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
118
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
119
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
108
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
109
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
110
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
111
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
112
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
113
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
114
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
115
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
116
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
117
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
118
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
119
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
120 120
 	// gateways
121
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
122
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
121
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
122
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
123 123
 	// asset URL paths
124
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
125
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
126
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
127
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
128
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
129
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
124
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
125
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
126
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
127
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
128
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
129
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
130 130
 	// define upload paths
131 131
 	$uploads = wp_upload_dir();
132 132
 	// define the uploads directory and URL
133
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS );
134
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS );
133
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
134
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
135 135
 	// define the templates directory and URL
136
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS );
137
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS );
136
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
137
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
138 138
 	// define the gateway directory and URL
139
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS );
140
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS );
139
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
140
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
141 141
 	// languages folder/path
142
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
143
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
142
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
143
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
144 144
 	//check for dompdf fonts in uploads
145
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
146
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
145
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
146
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
147 147
 	}
148 148
 	//ajax constants
149
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false );
150
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false );
149
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
150
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
151 151
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
152 152
 	//you're better to use this than its straight value (currently -1) in case you ever
153 153
 	//want to change its default value! or find when -1 means infinity
154
-	define( 'EE_INF_IN_DB', -1 );
155
-	define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX );
156
-	define( 'EE_DEBUG', false );
154
+	define('EE_INF_IN_DB', -1);
155
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
156
+	define('EE_DEBUG', false);
157 157
 
158 158
 	/**
159 159
 	 *    espresso_plugin_activation
160 160
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
161 161
 	 */
162 162
 	function espresso_plugin_activation() {
163
-		update_option( 'ee_espresso_activation', true );
163
+		update_option('ee_espresso_activation', true);
164 164
 	}
165
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
165
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
166 166
 
167 167
 
168 168
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		//	}
177 177
 		//
178 178
 	}
179
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
179
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
180 180
 
181 181
 
182 182
 
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	function espresso_load_error_handling() {
188 188
 		// load debugging tools
189
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
190
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
189
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
190
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
191 191
 			EEH_Debug_Tools::instance();
192 192
 		}
193 193
 		// load error handling
194
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
195
-			require_once( EE_CORE . 'EE_Error.core.php' );
194
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
195
+			require_once(EE_CORE.'EE_Error.core.php');
196 196
 		} else {
197
-			wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
197
+			wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso'));
198 198
 		}
199 199
 	}
200 200
 
@@ -208,25 +208,25 @@  discard block
 block discarded – undo
208 208
 	 * @param    string $full_path_to_file
209 209
 	 * @throws    EE_Error
210 210
 	 */
211
-	function espresso_load_required( $classname, $full_path_to_file ) {
211
+	function espresso_load_required($classname, $full_path_to_file) {
212 212
 		static $error_handling_loaded = false;
213
-		if ( ! $error_handling_loaded ) {
213
+		if ( ! $error_handling_loaded) {
214 214
 			espresso_load_error_handling();
215 215
 			$error_handling_loaded = true;
216 216
 		}
217
-		if ( is_readable( $full_path_to_file ) ) {
218
-			require_once( $full_path_to_file );
217
+		if (is_readable($full_path_to_file)) {
218
+			require_once($full_path_to_file);
219 219
 		} else {
220
-			throw new EE_Error ( sprintf(
221
-				__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
220
+			throw new EE_Error(sprintf(
221
+				__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
222 222
 				$classname
223
-			) );
223
+			));
224 224
 		}
225 225
 	}
226 226
 
227
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
228
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
229
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
227
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
228
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
229
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
230 230
 	new EE_Bootstrap();
231 231
 
232 232
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
 
237 237
 
238
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
238
+if ( ! function_exists('espresso_deactivate_plugin')) {
239 239
 	/**
240 240
 	*    deactivate_plugin
241 241
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
245 245
 	* @return    void
246 246
 	*/
247
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
248
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
249
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
247
+	function espresso_deactivate_plugin($plugin_basename = '') {
248
+		if ( ! function_exists('deactivate_plugins')) {
249
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
250 250
 		}
251
-		unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] );
252
-		deactivate_plugins( $plugin_basename );
251
+		unset($_GET['activate'], $_REQUEST['activate']);
252
+		deactivate_plugins($plugin_basename);
253 253
 	}
254 254
 }
Please login to merge, or discard this patch.