Completed
Branch FET-8394-move-rules-into-core (5a0f96)
by
unknown
09:47 queued 10s
created
admin_pages/events/Events_Admin_Page.core.php 3 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 	 * This just returns whatever is set as the _event object property
1292 1292
 	 *
1293 1293
 	 * //todo this will become obsolete once the models are in place
1294
-	 * @return object
1294
+	 * @return EE_CPT_Base
1295 1295
 	 */
1296 1296
 	public function get_event_object() {
1297 1297
 		return $this->_cpt_model_obj;
@@ -1761,9 +1761,8 @@  discard block
 block discarded – undo
1761 1761
 	 * _trash_or_restore_events
1762 1762
 	 *
1763 1763
 	 * @access  private
1764
-	 * @param  int $event_id
1765 1764
 	 * @param  string $event_status
1766
-	 * @return void
1765
+	 * @return boolean
1767 1766
 	 */
1768 1767
 	private function _change_event_status($EVT_ID = FALSE, $event_status = FALSE) {
1769 1768
 		// grab event id
@@ -1883,7 +1882,7 @@  discard block
 block discarded – undo
1883 1882
 	 *
1884 1883
 	 * @access  private
1885 1884
 	 * @param  int $EVT_ID
1886
-	 * @return void
1885
+	 * @return boolean
1887 1886
 	 */
1888 1887
 	private function _permanently_delete_event($EVT_ID = FALSE) {
1889 1888
 		// grab event id
Please login to merge, or discard this patch.
Braces   +23 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -871,8 +872,9 @@  discard block
 block discarded – undo
871 872
 		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
872 873
 
873 874
 		//very important.  If we don't have a venue name then we'll get out because not necessary to create empty venue
874
-		if ( empty( $data['venue_title'] ) )
875
-			return;
875
+		if ( empty( $data['venue_title'] ) ) {
876
+					return;
877
+		}
876 878
 
877 879
 		$venue_array = array(
878 880
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
@@ -1194,7 +1196,9 @@  discard block
 block discarded – undo
1194 1196
 
1195 1197
 
1196 1198
 		//if no postid then get out cause we need it for stuff in here
1197
-		if ( empty( $postid ) ) return;
1199
+		if ( empty( $postid ) ) {
1200
+			return;
1201
+		}
1198 1202
 
1199 1203
 
1200 1204
 		//handle datetime saves
@@ -1436,10 +1440,11 @@  discard block
 block discarded – undo
1436 1440
 			//get the earliest datetime (if present);
1437 1441
 			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1438 1442
 
1439
-			if ( !empty( $earliest_dtt ) )
1440
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1441
-			else
1442
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1443
+			if ( !empty( $earliest_dtt ) ) {
1444
+							$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1445
+			} else {
1446
+							$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1447
+			}
1443 1448
 		}
1444 1449
 
1445 1450
 		$template_args = array_merge( $template_args, $price_args );
@@ -1715,8 +1720,9 @@  discard block
 block discarded – undo
1715 1720
 		}
1716 1721
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1717 1722
 
1718
-		if ( $redirect_after )
1719
-			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1723
+		if ( $redirect_after ) {
1724
+					$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1725
+		}
1720 1726
 	}
1721 1727
 
1722 1728
 	/**
@@ -1841,8 +1847,9 @@  discard block
 block discarded – undo
1841 1847
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1842 1848
 		}
1843 1849
 
1844
-		if ( $redirect_after )
1845
-			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1850
+		if ( $redirect_after ) {
1851
+					$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1852
+		}
1846 1853
 	}
1847 1854
 
1848 1855
 	/**
@@ -2074,8 +2081,10 @@  discard block
 block discarded – undo
2074 2081
 	 * @return void
2075 2082
 	 */
2076 2083
 	private function _set_category_object() {
2077
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2078
-			return; //already have the category object so get out.
2084
+		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) {
2085
+					return;
2086
+		}
2087
+		//already have the category object so get out.
2079 2088
 
2080 2089
 		//set default category object
2081 2090
 		$this->_set_empty_category_object();
Please login to merge, or discard this patch.
Spacing   +386 added lines, -386 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
 /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			'espresso_events' => 'edit'
68 68
 			);
69 69
 
70
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
70
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
71 71
 	}
72 72
 
73 73
 	protected function _ajax_hooks() {
@@ -93,20 +93,20 @@  discard block
 block discarded – undo
93 93
 				'edit' => __('Update Event', 'event_espresso'),
94 94
 				'add_category' => __('Save New Category', 'event_espresso'),
95 95
 				'edit_category' => __('Update Category', 'event_espresso'),
96
-				'template_settings' => __( 'Update Settings', 'event_espresso' )
96
+				'template_settings' => __('Update Settings', 'event_espresso')
97 97
 				)
98 98
 		);
99 99
 	}
100 100
 
101 101
 	protected function _set_page_routes() {
102 102
 		//load formatter helper
103
-		EE_Registry::instance()->load_helper( 'Formatter' );
103
+		EE_Registry::instance()->load_helper('Formatter');
104 104
 		//load field generator helper
105
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
105
+		EE_Registry::instance()->load_helper('Form_Fields');
106 106
 
107 107
 		//is there a evt_id in the request?
108
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
109
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
108
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
109
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
110 110
 
111 111
 
112 112
 		$this->_page_routes = array(
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 				'help_tour' => array(
321 321
 					'Event_Editor_Help_Tour'
322 322
 					),
323
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
323
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
324 324
 				'require_nonce' => FALSE
325 325
 			),
326 326
 			'edit' => array(
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 				'help_tour' => array(
377 377
 					'Event_Edit_Help_Tour'
378 378
 				),
379
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
379
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
380 380
 				'require_nonce' => FALSE
381 381
 			),
382 382
 			'default_event_settings' => array(
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 						'filename' => 'events_default_settings_status'
399 399
 					)
400 400
 				),
401
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
401
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
402 402
 				'require_nonce' => FALSE
403 403
 			),
404 404
 			//template settings
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 						'filename' => 'general_settings_templates'
415 415
 					)
416 416
 				),
417
-				'help_tour' => array( 'Templates_Help_Tour' ),
417
+				'help_tour' => array('Templates_Help_Tour'),
418 418
 				'require_nonce' => FALSE
419 419
 			),
420 420
 			//event category stuff
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 					'label' => __('Edit Category', 'event_espresso'),
439 439
 					'order' => 15,
440 440
 					'persistent' => FALSE,
441
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
441
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
442 442
 					),
443 443
 				'help_tabs' => array(
444 444
 					'edit_category_help_tab' => array(
@@ -508,14 +508,14 @@  discard block
 block discarded – undo
508 508
 
509 509
 	public function load_scripts_styles() {
510 510
 
511
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
512
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
511
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
512
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
513 513
 		wp_enqueue_style('events-admin-css');
514 514
 		wp_enqueue_style('ee-cat-admin');
515 515
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
516 516
 		//registers for all views
517 517
 		//scripts
518
-		wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
518
+		wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
519 519
 	}
520 520
 
521 521
 	/**
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 	public function load_scripts_styles_edit() {
534 534
 		//styles
535 535
 		wp_enqueue_style('espresso-ui-theme');
536
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
536
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
537 537
 		wp_enqueue_style('event-editor-css');
538 538
 
539 539
 		//scripts
540
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
540
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
541 541
 		wp_enqueue_script('event-datetime-metabox');
542 542
 
543 543
 		EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
@@ -589,35 +589,35 @@  discard block
 block discarded – undo
589 589
 	 */
590 590
 	public function verify_event_edit($event = NULL) {
591 591
 		// no event?
592
-		if ( empty( $event )) {
592
+		if (empty($event)) {
593 593
 			// set event
594 594
 			$event = $this->_cpt_model_obj;
595 595
 		}
596 596
 		// STILL no event?
597
-		if ( empty ( $event )) {
597
+		if (empty ($event)) {
598 598
 			return;
599 599
 		}
600 600
 		// first check if event is active.
601
-		if ( $event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed ) {
601
+		if ($event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed) {
602 602
 			return;
603 603
 		}
604 604
 		$orig_status = $event->status();
605 605
 		//made it here so it IS active... next check that any of the tickets are sold.
606
-		if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) {
607
-			if ( $event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out  ) {
608
-				EE_Error::add_attention( sprintf(
609
-					__( 'Please note that the Event Status has automaticallly been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You <em>can</em> change the status back to something else before updating if you wish.', 'event_espresso' ),
610
-					EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
606
+		if ($event->is_sold_out() || $event->is_sold_out(TRUE)) {
607
+			if ($event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out) {
608
+				EE_Error::add_attention(sprintf(
609
+					__('Please note that the Event Status has automaticallly been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You <em>can</em> change the status back to something else before updating if you wish.', 'event_espresso'),
610
+					EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
611 611
 				));
612 612
 			}
613 613
 			return;
614 614
 		}
615 615
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
616
-		if ( ! $event->tickets_on_sale() ) {
616
+		if ( ! $event->tickets_on_sale()) {
617 617
 			return;
618 618
 		}
619 619
 		//made it here so show warning
620
-		EE_Error::add_attention( $this->_edit_event_warning() );
620
+		EE_Error::add_attention($this->_edit_event_warning());
621 621
 	}
622 622
 
623 623
 
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 			),
658 658
 		);
659 659
 
660
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
660
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
661 661
 			$this->_views['trash'] = array(
662 662
 				'slug' => 'trash',
663 663
 				'label' => __('Trash', 'event_espresso'),
@@ -687,39 +687,39 @@  discard block
 block discarded – undo
687 687
 				'desc' => __('View Registrations for Event', 'event_espresso')
688 688
 			)
689 689
 		);
690
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
690
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
691 691
 		$statuses = array(
692 692
 			'sold_out_status' => array(
693
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
694
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
693
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
694
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
695 695
 			),
696 696
 			'active_status' => array(
697
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
698
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
697
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
698
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
699 699
 			),
700 700
 			'upcoming_status' => array(
701
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
702
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
701
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
702
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
703 703
 			),
704 704
 			'postponed_status' => array(
705
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
706
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
705
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
706
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
707 707
 			),
708 708
 			'cancelled_status' => array(
709
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
710
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
709
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
710
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
711 711
 			),
712 712
 			'expired_status' => array(
713
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
714
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
713
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
714
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
715 715
 			),
716 716
 			'inactive_status' => array(
717
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
718
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
717
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
718
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
719 719
 			)
720 720
 		);
721
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
722
-		return array_merge( $items, $statuses );
721
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
722
+		return array_merge($items, $statuses);
723 723
 	}
724 724
 
725 725
 
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
 	 * @return EEM_Event
732 732
 	 */
733 733
 	private function _event_model() {
734
-		if ( ! $this->_event_model instanceof EEM_Event ) {
735
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
734
+		if ( ! $this->_event_model instanceof EEM_Event) {
735
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
736 736
 		}
737 737
 		return $this->_event_model;
738 738
 	}
@@ -751,12 +751,12 @@  discard block
 block discarded – undo
751 751
 	 * @param  string $new_slug  what the slug is
752 752
 	 * @return string            The new html string for the permalink area
753 753
 	 */
754
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
754
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
755 755
 		//make sure this is only when editing
756
-		if ( !empty( $id ) ) {
757
-			$post = get_post( $id );
758
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> ';
759
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\'' . $post->ID . '\']"">';
756
+		if ( ! empty($id)) {
757
+			$post = get_post($id);
758
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> ';
759
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\''.$post->ID.'\']"">';
760 760
 		}
761 761
 		return $return;
762 762
 	}
@@ -772,8 +772,8 @@  discard block
 block discarded – undo
772 772
 	 * @return string html for generated table
773 773
 	 */
774 774
 	protected function _events_overview_list_table() {
775
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
776
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) .
775
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
776
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button').
777 777
 		$this->_display_legend($this->_event_legend_items());
778 778
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
779 779
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -791,46 +791,46 @@  discard block
 block discarded – undo
791 791
 
792 792
 
793 793
 
794
-	protected function _insert_update_cpt_item( $post_id, $post ) {
794
+	protected function _insert_update_cpt_item($post_id, $post) {
795 795
 
796 796
 		$event_values = array(
797
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
798
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
797
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
798
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
799 799
 			'EVT_additional_limit' => min(
800
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
801
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
802
-			'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
803
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
804
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
805
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
806
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
807
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
800
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
801
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
802
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
803
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
804
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
805
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
806
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
807
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
808 808
 			);
809 809
 
810 810
 		//update event
811
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
811
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
812 812
 
813 813
 
814 814
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
815
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
816
-		$event = $this->_event_model()->get_one( array($get_one_where) );
815
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
816
+		$event = $this->_event_model()->get_one(array($get_one_where));
817 817
 
818 818
 
819 819
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
820
-		$event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) );
820
+		$event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')));
821 821
 
822 822
 		$att_success = TRUE;
823 823
 
824
-		foreach ( $event_update_callbacks as $e_callback ) {
825
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
826
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
824
+		foreach ($event_update_callbacks as $e_callback) {
825
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
826
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
827 827
 		}
828 828
 
829 829
 		//any errors?
830
-		if ( $success && FALSE === $att_success ) {
831
-			EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
832
-		} else if ( $success === FALSE ) {
833
-			EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
830
+		if ($success && FALSE === $att_success) {
831
+			EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
832
+		} else if ($success === FALSE) {
833
+			EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
834 834
 		}
835 835
 	}
836 836
 
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 	/**
841 841
 	 * @see parent::restore_item()
842 842
 	 */
843
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
843
+	protected function _restore_cpt_item($post_id, $revision_id) {
844 844
 		//copy existing event meta to new post
845 845
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
846 846
 
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 		$post_evt->restore_revision($revision_id);
849 849
 
850 850
 		//related objs restore
851
-		$post_evt->restore_revision($revision_id, array( 'Venue', 'Datetime', 'Price' ) );
851
+		$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
852 852
 	}
853 853
 
854 854
 
@@ -860,50 +860,50 @@  discard block
 block discarded – undo
860 860
 	 * @param  array  $data   The request data from the form
861 861
 	 * @return bool           Success or fail.
862 862
 	 */
863
-	protected function _default_venue_update( $evtobj, $data ) {
864
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
863
+	protected function _default_venue_update($evtobj, $data) {
864
+		require_once(EE_MODELS.'EEM_Venue.model.php');
865 865
 		$venue_model = EE_Registry::instance()->load_model('Venue');
866 866
 		$rows_affected = NULL;
867
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
867
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
868 868
 
869 869
 		//very important.  If we don't have a venue name then we'll get out because not necessary to create empty venue
870
-		if ( empty( $data['venue_title'] ) )
870
+		if (empty($data['venue_title']))
871 871
 			return;
872 872
 
873 873
 		$venue_array = array(
874 874
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
875
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
876
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
877
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
878
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
879
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
880
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
881
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
882
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
883
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
884
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
885
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
886
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
887
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
888
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
889
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
890
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
875
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
876
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
877
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
878
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
879
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
880
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
881
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
882
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
883
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
884
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
885
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
886
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
887
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
888
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
889
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
890
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
891 891
 				'status' => 'publish'
892 892
 			);
893 893
 
894 894
 
895 895
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
896
-		if ( !empty( $venue_id ) ) {
897
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
898
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
896
+		if ( ! empty($venue_id)) {
897
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
898
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
899 899
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
900
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
900
+			$evtobj->_add_relation_to($venue_id, 'Venue');
901 901
 			return $rows_affected > 0 ? TRUE : FALSE;
902 902
 		} else {
903 903
 			//we insert the venue
904
-			$venue_id = $venue_model->insert( $venue_array );
905
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
906
-			return !empty( $venue_id ) ? TRUE : FALSE;
904
+			$venue_id = $venue_model->insert($venue_array);
905
+			$evtobj->_add_relation_to($venue_id, 'Venue');
906
+			return ! empty($venue_id) ? TRUE : FALSE;
907 907
 		}
908 908
 		return TRUE; //when we have the ancestor come in it's already been handled by the revision save.
909 909
 	}
@@ -917,50 +917,50 @@  discard block
 block discarded – undo
917 917
 	 * @param  array    $data   The request data from the form
918 918
 	 * @return bool             success or fail
919 919
 	 */
920
-	protected function _default_tickets_update( $evtobj, $data ) {
920
+	protected function _default_tickets_update($evtobj, $data) {
921 921
 		$success = TRUE;
922
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
923
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
924
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
922
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
923
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
924
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
925 925
 			$datetime_values = array(
926
-				'DTT_ID' => !empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
926
+				'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
927 927
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
928 928
 				'DTT_EVT_end' => $dtt['DTT_EVT_end'],
929
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? INF : $dtt['DTT_reg_limit'],
929
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? INF : $dtt['DTT_reg_limit'],
930 930
 				'DTT_order' => $row,
931 931
 				);
932 932
 
933 933
 			//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.
934 934
 
935
-			if ( !empty( $dtt['DTT_ID'] ) ) {
936
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
937
-				$DTM->set_date_format( $incoming_date_formats[0] );
938
-				$DTM->set_time_format( $incoming_date_formats[1] );
939
-				foreach ( $datetime_values as $field => $value ) {
940
-					$DTM->set( $field, $value );
935
+			if ( ! empty($dtt['DTT_ID'])) {
936
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
937
+				$DTM->set_date_format($incoming_date_formats[0]);
938
+				$DTM->set_time_format($incoming_date_formats[1]);
939
+				foreach ($datetime_values as $field => $value) {
940
+					$DTM->set($field, $value);
941 941
 				}
942 942
 
943 943
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
944 944
 				$saved_dtts[$DTM->ID()] = $DTM;
945 945
 			} else {
946
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
947
-				$DTM->set_date_format( $incoming_date_formats[0] );
948
-				$DTM->set_time_format( $incoming_date_formats[1] );
949
-				$DTM->set_timezone( $evtobj->get_timezone() );
950
-				foreach ( $datetime_values as $field => $value ) {
951
-					$DTM->set( $field, $value );
946
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
947
+				$DTM->set_date_format($incoming_date_formats[0]);
948
+				$DTM->set_time_format($incoming_date_formats[1]);
949
+				$DTM->set_timezone($evtobj->get_timezone());
950
+				foreach ($datetime_values as $field => $value) {
951
+					$DTM->set($field, $value);
952 952
 				}
953 953
 			}
954 954
 			$DTM->save();
955 955
 
956
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
956
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
957 957
 
958 958
 			//load DTT helper
959 959
 			EE_Registry::instance()->load_helper('DTT_Helper');
960 960
 
961 961
 			//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.
962
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
963
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
962
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
963
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
964 964
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
965 965
 				$DTT->save();
966 966
 			}
@@ -968,42 +968,42 @@  discard block
 block discarded – undo
968 968
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
969 969
 			$saved_dtt = $DTT;
970 970
 
971
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
971
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
972 972
 		}
973 973
 
974 974
 		//no dtts get deleted so we don't do any of that logic here.
975 975
 		//update tickets next
976
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
977
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
978
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
976
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
977
+		foreach ($data['edit_tickets'] as $row => $tkt) {
978
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
979 979
 			$update_prices = false;
980
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
980
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
981 981
 
982
-			if ( empty( $tkt['TKT_start_date'] ) ) {
982
+			if (empty($tkt['TKT_start_date'])) {
983 983
 				//let's use now in the set timezone.
984
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
985
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
984
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
985
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
986 986
 			}
987 987
 
988
-			if ( empty( $tkt['TKT_end_date'] ) ) {
988
+			if (empty($tkt['TKT_end_date'])) {
989 989
 				//use the start date of the first datetime
990
-				$dtt = $evtobj->get_first_related( 'Datetime' );
991
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
990
+				$dtt = $evtobj->get_first_related('Datetime');
991
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
992 992
 			}
993 993
 
994 994
 			$TKT_values = array(
995
-				'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
996
-				'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
997
-				'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
998
-				'TKT_description' => !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
995
+				'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
996
+				'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
997
+				'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
998
+				'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
999 999
 				'TKT_start_date' => $tkt['TKT_start_date'],
1000 1000
 				'TKT_end_date' => $tkt['TKT_end_date'],
1001
-				'TKT_qty' => empty( $tkt['TKT_qty'] ) ? INF : $tkt['TKT_qty'],
1002
-				'TKT_uses' => empty( $tkt['TKT_uses'] ) ? INF : $tkt['TKT_uses'],
1003
-				'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1004
-				'TKT_max' => empty( $tkt['TKT_max'] ) ? INF : $tkt['TKT_max'],
1001
+				'TKT_qty' => empty($tkt['TKT_qty']) ? INF : $tkt['TKT_qty'],
1002
+				'TKT_uses' => empty($tkt['TKT_uses']) ? INF : $tkt['TKT_uses'],
1003
+				'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1004
+				'TKT_max' => empty($tkt['TKT_max']) ? INF : $tkt['TKT_max'],
1005 1005
 				'TKT_row' => $row,
1006
-				'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1006
+				'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1007 1007
 				'TKT_price' => $ticket_price
1008 1008
 				);
1009 1009
 
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
 
1012 1012
 
1013 1013
 			//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.
1014
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1014
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1015 1015
 				$TKT_values['TKT_ID'] = 0;
1016 1016
 				$TKT_values['TKT_is_default'] = 0;
1017 1017
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1022,25 +1022,25 @@  discard block
 block discarded – undo
1022 1022
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1023 1023
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1024 1024
 
1025
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1026
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1025
+			if ( ! empty($tkt['TKT_ID'])) {
1026
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1027 1027
 
1028 1028
 
1029
-				$ticket_sold = $TKT->count_related('Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1029
+				$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1030 1030
 
1031 1031
 				//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1032
-				$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && !$TKT->get('TKT_deleted') ? TRUE : FALSE;
1032
+				$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? TRUE : FALSE;
1033 1033
 
1034
-				$TKT->set_date_format( $incoming_date_formats[0] );
1035
-				$TKT->set_time_format( $incoming_date_formats[1] );
1034
+				$TKT->set_date_format($incoming_date_formats[0]);
1035
+				$TKT->set_time_format($incoming_date_formats[1]);
1036 1036
 
1037 1037
 				//set new values
1038
-				foreach ( $TKT_values as $field => $value ) {
1039
-					$TKT->set( $field, $value );
1038
+				foreach ($TKT_values as $field => $value) {
1039
+					$TKT->set($field, $value);
1040 1040
 				}
1041 1041
 
1042 1042
 				//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1043
-				if ( $create_new_TKT ) {
1043
+				if ($create_new_TKT) {
1044 1044
 					//archive the old ticket first
1045 1045
 					$TKT->set('TKT_deleted', 1);
1046 1046
 					$TKT->save();
@@ -1051,31 +1051,31 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
 					//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1053 1053
 					$TKT = clone $TKT;
1054
-					$TKT->set( 'TKT_ID', 0 );
1055
-					$TKT->set( 'TKT_deleted', 0 );
1056
-					$TKT->set( 'TKT_price', $ticket_price );
1057
-					$TKT->set( 'TKT_sold', 0 );
1054
+					$TKT->set('TKT_ID', 0);
1055
+					$TKT->set('TKT_deleted', 0);
1056
+					$TKT->set('TKT_price', $ticket_price);
1057
+					$TKT->set('TKT_sold', 0);
1058 1058
 
1059 1059
 					//now we need to make sure that $new prices are created as well and attached to new ticket.
1060 1060
 					$update_prices = TRUE;
1061 1061
 				}
1062 1062
 
1063 1063
 				//make sure price is set if it hasn't been already
1064
-				$TKT->set( 'TKT_price', $ticket_price );
1064
+				$TKT->set('TKT_price', $ticket_price);
1065 1065
 
1066 1066
 			} else {
1067 1067
 				//no TKT_id so a new TKT
1068 1068
 				$TKT_values['TKT_price'] = $ticket_price;
1069
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1069
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1070 1070
 
1071 1071
 				//need to reset values to properly account for the date formats
1072
-				$TKT->set_date_format( $incoming_date_formats[0] );
1073
-				$TKT->set_time_format( $incoming_date_formats[1] );
1074
-				$TKT->set_timezone( $evtobj->get_timezone() );
1072
+				$TKT->set_date_format($incoming_date_formats[0]);
1073
+				$TKT->set_time_format($incoming_date_formats[1]);
1074
+				$TKT->set_timezone($evtobj->get_timezone());
1075 1075
 
1076 1076
 				//set new values
1077
-				foreach ( $TKT_values as $field => $value ) {
1078
-					$TKT->set( $field, $value );
1077
+				foreach ($TKT_values as $field => $value) {
1078
+					$TKT->set($field, $value);
1079 1079
 				}
1080 1080
 
1081 1081
 				$update_prices = TRUE;
@@ -1085,27 +1085,27 @@  discard block
 block discarded – undo
1085 1085
 			$TKT->save();
1086 1086
 
1087 1087
 			//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.
1088
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1089
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1088
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1089
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1090 1090
 				EE_Registry::instance()->load_helper('DTT_Helper');
1091 1091
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1092 1092
 				$TKT->save();
1093 1093
 			}
1094 1094
 
1095 1095
 			//initially let's add the ticket to the dtt
1096
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1096
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1097 1097
 
1098 1098
 			$saved_tickets[$TKT->ID()] = $TKT;
1099 1099
 
1100 1100
 			//add prices to ticket
1101
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1101
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1102 1102
 		}
1103 1103
 		//however now we need to handle permanantly deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanantely because there is no need to save in db.
1104
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1105
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1104
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1105
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1106 1106
 
1107
-		foreach ( $tickets_removed as $id ) {
1108
-			$id = absint( $id );
1107
+		foreach ($tickets_removed as $id) {
1108
+			$id = absint($id);
1109 1109
 
1110 1110
 			//get the ticket for this id
1111 1111
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1114 1114
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1115 1115
 
1116
-			foreach( $dtts as $dtt ) {
1116
+			foreach ($dtts as $dtt) {
1117 1117
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1118 1118
 			}
1119 1119
 
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1125 1125
 			$tkt_to_remove->delete_permanently();
1126 1126
 		}/**/
1127
-		return array( $saved_dtt, $saved_tickets );
1127
+		return array($saved_dtt, $saved_tickets);
1128 1128
 	}
1129 1129
 
1130 1130
 
@@ -1139,31 +1139,31 @@  discard block
 block discarded – undo
1139 1139
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1140 1140
 	 * @return  void
1141 1141
 	 */
1142
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1143
-		foreach ( $prices as $row => $prc ) {
1142
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1143
+		foreach ($prices as $row => $prc) {
1144 1144
 			$PRC_values = array(
1145
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1146
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1147
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1148
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1149
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1145
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1146
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1147
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1148
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1149
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1150 1150
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1151 1151
 				'PRC_order' => $row
1152 1152
 				);
1153 1153
 
1154
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1154
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1155 1155
 				$PRC_values['PRC_ID'] = 0;
1156
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1156
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1157 1157
 			} else {
1158
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1158
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1159 1159
 				//update this price with new values
1160
-				foreach ( $PRC_values as $field => $newprc ) {
1161
-					$PRC->set( $field, $newprc );
1160
+				foreach ($PRC_values as $field => $newprc) {
1161
+					$PRC->set($field, $newprc);
1162 1162
 				}
1163 1163
 				$PRC->save();
1164 1164
 			}
1165 1165
 
1166
-			$PRC = $ticket->_add_relation_to( $PRC, 'Price' );
1166
+			$PRC = $ticket->_add_relation_to($PRC, 'Price');
1167 1167
 		}
1168 1168
 	}
1169 1169
 
@@ -1186,33 +1186,33 @@  discard block
 block discarded – undo
1186 1186
 
1187 1187
 		return; //TEMPORARILY EXITING CAUSE THIS IS A TODO
1188 1188
 
1189
-		$postid = isset( $this->_req_data['post_ID'] ) ? $this->_req_data['post_ID'] : NULL;
1189
+		$postid = isset($this->_req_data['post_ID']) ? $this->_req_data['post_ID'] : NULL;
1190 1190
 
1191 1191
 
1192 1192
 		//if no postid then get out cause we need it for stuff in here
1193
-		if ( empty( $postid ) ) return;
1193
+		if (empty($postid)) return;
1194 1194
 
1195 1195
 
1196 1196
 		//handle datetime saves
1197 1197
 		$items = array();
1198 1198
 
1199
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $postid );
1200
-		$event = $this->_event_model()->get_one( array($get_one_where) );
1199
+		$get_one_where = array($this->_event_model()->primary_key_name() => $postid);
1200
+		$event = $this->_event_model()->get_one(array($get_one_where));
1201 1201
 
1202 1202
 		//now let's get the attached datetimes from the most recent autosave
1203 1203
 		$dtts = $event->get_many_related('Datetime');
1204 1204
 
1205 1205
 		$dtt_ids = array();
1206
-		foreach( $dtts as $dtt ) {
1206
+		foreach ($dtts as $dtt) {
1207 1207
 			$dtt_ids[] = $dtt->ID();
1208 1208
 			$order = $dtt->order();
1209 1209
 			$this->_template_args['data']['items']['ID-'.$order] = $dtt->ID();
1210 1210
 		}
1211
-		$this->_template_args['data']['items']['datetime_IDS'] = serialize( $dtt_ids );
1211
+		$this->_template_args['data']['items']['datetime_IDS'] = serialize($dtt_ids);
1212 1212
 
1213 1213
 		//handle DECAF venues
1214 1214
 		//we need to make sure that the venue_id gets updated in the form so that future autosaves will properly conntect that venue to the event.
1215
-		if ( $do_venue_autosaves = apply_filters( 'FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE ) ) {
1215
+		if ($do_venue_autosaves = apply_filters('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE)) {
1216 1216
 			$venue = $event->get_first_related('Venue');
1217 1217
 			$this->_template_args['data']['items']['venue-id'] = $venue->ID();
1218 1218
 		}
@@ -1223,23 +1223,23 @@  discard block
 block discarded – undo
1223 1223
 
1224 1224
 		$ticket_ids = array();
1225 1225
 		$price_ids = array();
1226
-		foreach ( $tickets as $ticket ) {
1226
+		foreach ($tickets as $ticket) {
1227 1227
 			$ticket_ids[] = $price->ID();
1228 1228
 			$ticket_order = $price->get('TKT_order');
1229
-			$this->_template_args['data']['items']['edit-ticket-id-' . $ticket_order] = $ticket->ID();
1230
-			$this->_template_args['data']['items']['edit-ticket-event-id-' . $order] = $event->ID();
1229
+			$this->_template_args['data']['items']['edit-ticket-id-'.$ticket_order] = $ticket->ID();
1230
+			$this->_template_args['data']['items']['edit-ticket-event-id-'.$order] = $event->ID();
1231 1231
 
1232 1232
 			//now we have to make sure the prices are updated appropriately
1233 1233
 			$prices = $ticket->get_many_related('Prices');
1234 1234
 
1235
-			foreach ( $prices as $price ) {
1235
+			foreach ($prices as $price) {
1236 1236
 				$price_ids[] = $price->ID();
1237 1237
 				$price_order = $price->get('PRC_order');
1238
-				$this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-' . $ticket_order . '-' . $price_order] = $price->ID();
1239
-				$this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-' . $ticket_row . '-' . $price_row] = $price->ID();
1240
-				$this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-' . $ticket_row . '-' . $price_row] = $price->get('PRC_is_default');
1238
+				$this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-'.$ticket_order.'-'.$price_order] = $price->ID();
1239
+				$this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-'.$ticket_row.'-'.$price_row] = $price->ID();
1240
+				$this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-'.$ticket_row.'-'.$price_row] = $price->get('PRC_is_default');
1241 1241
 			}
1242
-			$this->_template_args['data']['items']['price-IDs-ticketrow-' . $ticket_row] = implode(',', $price_ids);
1242
+			$this->_template_args['data']['items']['price-IDs-ticketrow-'.$ticket_row] = implode(',', $price_ids);
1243 1243
 		}
1244 1244
 		$this->_template_args['data']['items']['ticket-IDs'] = implode(',', $ticket_ids);
1245 1245
 	}
@@ -1257,26 +1257,26 @@  discard block
 block discarded – undo
1257 1257
 	private function _generate_publish_box_extra_content() {
1258 1258
 
1259 1259
 		//load formatter helper
1260
-  		EE_Registry::instance()->load_helper( 'Formatter' );
1260
+  		EE_Registry::instance()->load_helper('Formatter');
1261 1261
 
1262 1262
   		//args for getting related registrations
1263
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1264
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1265
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1263
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1264
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1265
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1266 1266
 
1267 1267
 
1268 1268
 		// publish box
1269
-		$publish_box_extra_args['view_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_approved ), REG_ADMIN_URL);
1270
-		$publish_box_extra_args['view_not_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_not_approved ), REG_ADMIN_URL);
1271
-		$publish_box_extra_args['view_pending_payment_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_pending_payment ), REG_ADMIN_URL);
1269
+		$publish_box_extra_args['view_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_approved), REG_ADMIN_URL);
1270
+		$publish_box_extra_args['view_not_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_not_approved), REG_ADMIN_URL);
1271
+		$publish_box_extra_args['view_pending_payment_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_pending_payment), REG_ADMIN_URL);
1272 1272
 		$publish_box_extra_args['approved_regs'] = $this->_cpt_model_obj->count_related('Registration', $approved_query_args);
1273 1273
 		$publish_box_extra_args['not_approved_regs'] = $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args);
1274 1274
 		$publish_box_extra_args['pending_payment_regs'] = $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args);
1275
-		$publish_box_extra_args['misc_pub_section_class'] = apply_filters( 'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', 'misc-pub-section');
1275
+		$publish_box_extra_args['misc_pub_section_class'] = apply_filters('FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', 'misc-pub-section');
1276 1276
 		//$publish_box_extra_args['email_attendees_url'] = add_query_arg(array('event_admin_reports' => 'event_newsletter', 'event_id' => $this->_cpt_model_obj->id), 'admin.php?page=espresso_registrations');
1277
-		$publish_box_extra_args['event_editor_overview_add'] = do_action( 'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', $this->_cpt_model_obj );
1277
+		$publish_box_extra_args['event_editor_overview_add'] = do_action('AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', $this->_cpt_model_obj);
1278 1278
 		// load template
1279
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1279
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1280 1280
 	}
1281 1281
 
1282 1282
 
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
 		$this->verify_cpt_object();
1309 1309
 		add_meta_box('espresso_event_editor_tickets', __('Event Datetime & Ticket', 'event_espresso'), array($this, 'ticket_metabox'), $this->page_slug, 'normal', 'high');
1310 1310
 		add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'default');
1311
-		add_meta_box('espresso_event_editor_venue', __('Venue Details', 'event_espresso'), array( $this, 'venue_metabox' ), $this->page_slug, 'normal', 'core');
1311
+		add_meta_box('espresso_event_editor_venue', __('Venue Details', 'event_espresso'), array($this, 'venue_metabox'), $this->page_slug, 'normal', 'core');
1312 1312
 		//note if you're looking for other metaboxes in here, where a metabox has a related management page in the admin you will find it setup in the related management page's "_Hooks" file.  i.e. messages metabox is found in "espresso_events_Messages_Hooks.class.php".
1313 1313
 	}
1314 1314
 
@@ -1333,53 +1333,53 @@  discard block
 block discarded – undo
1333 1333
 			'disabled' => ''
1334 1334
 			);
1335 1335
 
1336
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1336
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1337 1337
 
1338
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1338
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1339 1339
 
1340 1340
 		/**
1341 1341
 		 * 1. Start with retrieving Datetimes
1342 1342
 		 * 2. Fore each datetime get related tickets
1343 1343
 		 * 3. For each ticket get related prices
1344 1344
 		 */
1345
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1346
-		EE_Registry::instance()->load_helper('DTT_Helper' );
1345
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1346
+		EE_Registry::instance()->load_helper('DTT_Helper');
1347 1347
 
1348 1348
 		$firstdtt = array_slice($times, 0, 1);
1349 1349
 		//do we get related tickets?
1350
-		if ( $firstdtt[0]->get('DTT_ID') !== 0 ) {
1351
-			foreach ( $times as $time ) {
1350
+		if ($firstdtt[0]->get('DTT_ID') !== 0) {
1351
+			foreach ($times as $time) {
1352 1352
 				$existing_datetime_ids[] = $time->get('DTT_ID');
1353 1353
 				$template_args['time'] = $time;
1354
-				$related_tickets = $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none' ) );
1354
+				$related_tickets = $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none'));
1355 1355
 
1356
-				if ( !empty($related_tickets) ) {
1356
+				if ( ! empty($related_tickets)) {
1357 1357
 					$template_args['total_ticket_rows'] = count($related_tickets);
1358 1358
 					$row = 0;
1359
-					foreach ( $related_tickets as $ticket ) {
1359
+					foreach ($related_tickets as $ticket) {
1360 1360
 						$existing_ticket_ids[] = $ticket->get('TKT_ID');
1361
-						$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1361
+						$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1362 1362
 
1363 1363
 						$row++;
1364 1364
 					}
1365 1365
 				} else {
1366 1366
 					$template_args['total_ticket_rows'] = 1;
1367 1367
 					$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1368
-					$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1368
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1369 1369
 				}
1370 1370
 			}
1371 1371
 		} else {
1372 1372
 			$template_args['time'] = $times[0];
1373 1373
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1374
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); //note we're just sending the first default row (decaf can't manage default tickets so this should be sufficent);
1374
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); //note we're just sending the first default row (decaf can't manage default tickets so this should be sufficent);
1375 1375
 		}
1376 1376
 
1377 1377
 		$template_args['event_datetime_help_link'] = $this->_get_help_tab_link('event_editor_event_datetimes_help_tab');
1378 1378
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1379 1379
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1380 1380
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1381
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1382
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1381
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1382
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1383 1383
 		EEH_Template::display_template($template, $template_args);
1384 1384
 	}
1385 1385
 
@@ -1393,21 +1393,21 @@  discard block
 block discarded – undo
1393 1393
 	 * @param  boolean    $skeleton whether we're generating a skeleton for js manipulation
1394 1394
 	 * @return string               generated html for the ticket row.
1395 1395
 	 */
1396
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1396
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1397 1397
 		$template_args = array(
1398
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1399
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1398
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1399
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1400 1400
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1401 1401
 			'TKT_ID' => $ticket->get('TKT_ID'),
1402 1402
 			'TKT_name' => $ticket->get('TKT_name'),
1403 1403
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1404 1404
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1405 1405
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1406
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1406
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1407 1407
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1408 1408
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1409
-			'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1410
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1409
+			'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1410
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1411 1411
 			);
1412 1412
 
1413 1413
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1423,23 +1423,23 @@  discard block
 block discarded – undo
1423 1423
 
1424 1424
 		//make sure we have default start and end dates if skeleton
1425 1425
 		//handle rows that should NOT be empty
1426
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1426
+		if (empty($template_args['TKT_start_date'])) {
1427 1427
 			//if empty then the start date will be now.
1428 1428
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1429 1429
 		}
1430 1430
 
1431
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1431
+		if (empty($template_args['TKT_end_date'])) {
1432 1432
 			//get the earliest datetime (if present);
1433
-			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1433
+			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1434 1434
 
1435
-			if ( !empty( $earliest_dtt ) )
1435
+			if ( ! empty($earliest_dtt))
1436 1436
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1437 1437
 			else
1438
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1438
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1439 1439
 		}
1440 1440
 
1441
-		$template_args = array_merge( $template_args, $price_args );
1442
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1441
+		$template_args = array_merge($template_args, $price_args);
1442
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1443 1443
 		return EEH_Template::display_template($template, $template_args, TRUE);
1444 1444
 	}
1445 1445
 
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
 			array('id' => false, 'text' => __('No', 'event_espresso'))
1453 1453
 		);
1454 1454
 
1455
-		$default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE);
1455
+		$default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE);
1456 1456
 
1457 1457
 		//$template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active());
1458 1458
 		$template_args['_event'] = $this->_cpt_model_obj;
@@ -1461,8 +1461,8 @@  discard block
 block discarded – undo
1461 1461
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1462 1462
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1463 1463
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1464
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
1465
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1464
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
1465
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1466 1466
 		EEH_Template::display_template($templatepath, $template_args);
1467 1467
 	}
1468 1468
 
@@ -1476,14 +1476,14 @@  discard block
 block discarded – undo
1476 1476
 
1477 1477
 		//first let's see if we have a venue already
1478 1478
 		$event_id = $this->_cpt_model_obj->ID();
1479
-		$venue = !empty( $event_id ) ? $this->_cpt_model_obj->venues() : NULL;
1480
-		$venue = empty( $venue ) ? EE_Registry::instance()->load_model('Venue')->create_default_object() : array_shift( $venue );
1479
+		$venue = ! empty($event_id) ? $this->_cpt_model_obj->venues() : NULL;
1480
+		$venue = empty($venue) ? EE_Registry::instance()->load_model('Venue')->create_default_object() : array_shift($venue);
1481 1481
 		$template_args['_venue'] = $venue;
1482 1482
 
1483 1483
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
1484 1484
 			$QFI = new EE_Question_Form_Input(
1485
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
1486
-				EE_Answer::new_instance( array(  'ANS_value'=> $venue->state_ID() )),
1485
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
1486
+				EE_Answer::new_instance(array('ANS_value'=> $venue->state_ID())),
1487 1487
 				array(
1488 1488
 					'input_name' =>  'state',
1489 1489
 					'input_id' => 'phys-state',
@@ -1495,8 +1495,8 @@  discard block
 block discarded – undo
1495 1495
 		);
1496 1496
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
1497 1497
 			$QFI = new EE_Question_Form_Input(
1498
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
1499
-				EE_Answer::new_instance( array(  'ANS_value'=> $venue->country_ID() )),
1498
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
1499
+				EE_Answer::new_instance(array('ANS_value'=> $venue->country_ID())),
1500 1500
 				array(
1501 1501
 					'input_name' =>  'countries',
1502 1502
 					'input_id' => 'phys-country',
@@ -1507,8 +1507,8 @@  discard block
 block discarded – undo
1507 1507
 			)
1508 1508
 		);
1509 1509
 
1510
-		$template_path = EVENTS_TEMPLATE_PATH . 'event_venues_metabox_content.template.php';
1511
-		EEH_Template::display_template( $template_path, $template_args );
1510
+		$template_path = EVENTS_TEMPLATE_PATH.'event_venues_metabox_content.template.php';
1511
+		EEH_Template::display_template($template_path, $template_args);
1512 1512
 	}
1513 1513
 
1514 1514
 
@@ -1535,21 +1535,21 @@  discard block
 block discarded – undo
1535 1535
 		$EEME = $this->_event_model();
1536 1536
 
1537 1537
 		$offset = ($current_page - 1) * $per_page;
1538
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1538
+		$limit = $count ? NULL : $offset.','.$per_page;
1539 1539
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1540 1540
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1541 1541
 
1542 1542
 		if (isset($this->_req_data['month_range'])) {
1543 1543
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1544
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1545
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1544
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1545
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1546 1546
 		}
1547 1547
 
1548 1548
 		$where = array();
1549 1549
 
1550
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1550
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1551 1551
 		//determine what post_status our condition will have for the query.
1552
-		switch ( $status ) {
1552
+		switch ($status) {
1553 1553
 			case 'month' :
1554 1554
 			case 'today' :
1555 1555
 			case NULL :
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
 				break;
1558 1558
 
1559 1559
 			case 'draft' :
1560
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1560
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1561 1561
 				break;
1562 1562
 
1563 1563
 			default :
@@ -1565,43 +1565,43 @@  discard block
 block discarded – undo
1565 1565
 		}
1566 1566
 
1567 1567
 		//categories?
1568
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1568
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1569 1569
 
1570
-		if ( !empty ( $category ) ) {
1570
+		if ( ! empty ($category)) {
1571 1571
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1572 1572
 			$where['Term_Taxonomy.term_id'] = $category;
1573 1573
 		}
1574 1574
 
1575 1575
 		//date where conditions
1576
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1576
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1577 1577
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1578
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1579
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1580
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1581
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1578
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1579
+			$start = $DateTime->format(implode(' ', $start_formats));
1580
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1581
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1582 1582
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1583
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1584
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1585
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1586
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1587
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1588
-			$now = date( 'Y-m-01' );
1589
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1590
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1591
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1592
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1583
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1584
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1585
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1586
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1587
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1588
+			$now = date('Y-m-01');
1589
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1590
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1591
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1592
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1593 1593
 		}
1594 1594
 		
1595 1595
 
1596
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1597
-			$where['EVT_wp_user'] =  get_current_user_id();
1596
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1597
+			$where['EVT_wp_user'] = get_current_user_id();
1598 1598
 		} else {
1599
-			if ( ! isset( $where['status'] ) ) {
1600
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1599
+			if ( ! isset($where['status'])) {
1600
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1601 1601
 					$where['OR'] = array(
1602
-						'status*restrict_private' => array( '!=', 'private' ),
1602
+						'status*restrict_private' => array('!=', 'private'),
1603 1603
 						'AND' => array(
1604
-							'status*inclusive' => array( '=', 'private' ),
1604
+							'status*inclusive' => array('=', 'private'),
1605 1605
 							'EVT_wp_user' => get_current_user_id()
1606 1606
 						)
1607 1607
 					);
@@ -1609,16 +1609,16 @@  discard block
 block discarded – undo
1609 1609
 			}
1610 1610
 		}
1611 1611
 
1612
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1613
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1612
+		if (isset($this->_req_data['EVT_wp_user'])) {
1613
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1614 1614
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1615 1615
 			}
1616 1616
 		}
1617 1617
 
1618 1618
 
1619 1619
 		//search query handling
1620
-		if ( isset( $this->_req_data['s'] ) ) {
1621
-			$search_string = '%' . $this->_req_data['s'] . '%';
1620
+		if (isset($this->_req_data['s'])) {
1621
+			$search_string = '%'.$this->_req_data['s'].'%';
1622 1622
 			$where['OR'] = array(
1623 1623
 				'EVT_name' => array('LIKE', $search_string),
1624 1624
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1627,32 +1627,32 @@  discard block
 block discarded – undo
1627 1627
 		}
1628 1628
 
1629 1629
 
1630
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1631
-		$query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data );
1630
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1631
+		$query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data);
1632 1632
 
1633 1633
 
1634 1634
 		//let's first check if we have special requests coming in.
1635
-		if ( isset( $this->_req_data['active_status'] ) ) {
1636
-			switch ( $this->_req_data['active_status'] ) {
1635
+		if (isset($this->_req_data['active_status'])) {
1636
+			switch ($this->_req_data['active_status']) {
1637 1637
 				case 'upcoming' :
1638
-					return $EEME->get_upcoming_events( $query_params, $count );
1638
+					return $EEME->get_upcoming_events($query_params, $count);
1639 1639
 					break;
1640 1640
 
1641 1641
 				case 'expired' :
1642
-					return $EEME->get_expired_events( $query_params, $count );
1642
+					return $EEME->get_expired_events($query_params, $count);
1643 1643
 					break;
1644 1644
 
1645 1645
 				case 'active' :
1646
-					return $EEME->get_active_events( $query_params, $count );
1646
+					return $EEME->get_active_events($query_params, $count);
1647 1647
 					break;
1648 1648
 
1649 1649
 				case 'inactive' :
1650
-					return $EEME->get_inactive_events( $query_params, $count );
1650
+					return $EEME->get_inactive_events($query_params, $count);
1651 1651
 					break;
1652 1652
 			}
1653 1653
 		}
1654 1654
 
1655
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1655
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1656 1656
 
1657 1657
 		return $events;
1658 1658
 	}
@@ -1661,23 +1661,23 @@  discard block
 block discarded – undo
1661 1661
 
1662 1662
 
1663 1663
 	//handling for WordPress CPT actions (trash, restore, delete)
1664
-	public function trash_cpt_item( $post_id ) {
1664
+	public function trash_cpt_item($post_id) {
1665 1665
 		$this->_req_data['EVT_ID'] = $post_id;
1666
-		$this->_trash_or_restore_event( 'trash', FALSE );
1666
+		$this->_trash_or_restore_event('trash', FALSE);
1667 1667
 	}
1668 1668
 
1669 1669
 
1670 1670
 
1671 1671
 
1672
-	public function restore_cpt_item( $post_id ) {
1672
+	public function restore_cpt_item($post_id) {
1673 1673
 		$this->_req_data['EVT_ID'] = $post_id;
1674
-		$this->_trash_or_restore_event( 'draft', FALSE );
1674
+		$this->_trash_or_restore_event('draft', FALSE);
1675 1675
 	}
1676 1676
 
1677 1677
 
1678
-	public function delete_cpt_item( $post_id ) {
1678
+	public function delete_cpt_item($post_id) {
1679 1679
 		$this->_req_data['EVT_ID'] = $post_id;
1680
-		$this->_delete_event( FALSE );
1680
+		$this->_delete_event(FALSE);
1681 1681
 	}
1682 1682
 
1683 1683
 
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
 	 * @param  string $event_status
1690 1690
 	 * @return void
1691 1691
 	 */
1692
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1692
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1693 1693
 		//determine the event id and set to array.
1694 1694
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1695 1695
 		// loop thru events
@@ -1697,7 +1697,7 @@  discard block
 block discarded – undo
1697 1697
 			// clean status
1698 1698
 			$event_status = sanitize_key($event_status);
1699 1699
 			// grab status
1700
-			if (!empty($event_status)) {
1700
+			if ( ! empty($event_status)) {
1701 1701
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1702 1702
 			} else {
1703 1703
 				$success = FALSE;
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 		}
1712 1712
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1713 1713
 
1714
-		if ( $redirect_after )
1714
+		if ($redirect_after)
1715 1715
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1716 1716
 	}
1717 1717
 
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
 		// clean status
1727 1727
 		$event_status = sanitize_key($event_status);
1728 1728
 		// grab status
1729
-		if (!empty($event_status)) {
1729
+		if ( ! empty($event_status)) {
1730 1730
 			$success = TRUE;
1731 1731
 			//determine the event id and set to array.
1732 1732
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1763,13 +1763,13 @@  discard block
 block discarded – undo
1763 1763
 	 */
1764 1764
 	private function _change_event_status($EVT_ID = FALSE, $event_status = FALSE) {
1765 1765
 		// grab event id
1766
-		if (!$EVT_ID) {
1766
+		if ( ! $EVT_ID) {
1767 1767
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1768 1768
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1769 1769
 			return FALSE;
1770 1770
 		}
1771 1771
 
1772
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1772
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1773 1773
 
1774 1774
 		// clean status
1775 1775
 		$event_status = sanitize_key($event_status);
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
 				$hook = FALSE;
1796 1796
 		}
1797 1797
 		//use class to change status
1798
-		$this->_cpt_model_obj->set_status( $event_status );
1798
+		$this->_cpt_model_obj->set_status($event_status);
1799 1799
 		$success = $this->_cpt_model_obj->save();
1800 1800
 
1801 1801
 		if ($success === FALSE) {
@@ -1815,15 +1815,15 @@  discard block
 block discarded – undo
1815 1815
 	 * @access protected
1816 1816
 	 * @return void
1817 1817
 	 */
1818
-	protected function _delete_event( $redirect_after = TRUE ) {
1818
+	protected function _delete_event($redirect_after = TRUE) {
1819 1819
 		//determine the event id and set to array.
1820 1820
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1821
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1821
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1822 1822
 
1823 1823
 
1824 1824
 		// loop thru events
1825 1825
 		if ($EVT_ID) {
1826
-			$success = $this->_permanently_delete_event( $EVT_ID );
1826
+			$success = $this->_permanently_delete_event($EVT_ID);
1827 1827
 			// get list of events with no prices
1828 1828
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1829 1829
 			// remove this event from the list of events with no prices
@@ -1837,7 +1837,7 @@  discard block
 block discarded – undo
1837 1837
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1838 1838
 		}
1839 1839
 
1840
-		if ( $redirect_after )
1840
+		if ($redirect_after)
1841 1841
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1842 1842
 	}
1843 1843
 
@@ -1883,7 +1883,7 @@  discard block
 block discarded – undo
1883 1883
 	 */
1884 1884
 	private function _permanently_delete_event($EVT_ID = FALSE) {
1885 1885
 		// grab event id
1886
-		if (!$EVT_ID = absint($EVT_ID)) {
1886
+		if ( ! $EVT_ID = absint($EVT_ID)) {
1887 1887
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1888 1888
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1889 1889
 			return FALSE;
@@ -1894,10 +1894,10 @@  discard block
 block discarded – undo
1894 1894
 
1895 1895
 		//need to delete related tickets and prices first.
1896 1896
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1897
-		foreach ( $datetimes as $datetime ) {
1897
+		foreach ($datetimes as $datetime) {
1898 1898
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1899 1899
 			$tickets = $datetime->get_many_related('Ticket');
1900
-			foreach ( $tickets as $ticket ) {
1900
+			foreach ($tickets as $ticket) {
1901 1901
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1902 1902
 				$ticket->delete_related_permanently('Price');
1903 1903
 				$ticket->delete_permanently();
@@ -1907,14 +1907,14 @@  discard block
 block discarded – undo
1907 1907
 
1908 1908
 		//what about related venues or terms?
1909 1909
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1910
-		foreach ( $venues as $venue ) {
1910
+		foreach ($venues as $venue) {
1911 1911
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1912 1912
 		}
1913 1913
 
1914 1914
 		//any attached question groups?
1915 1915
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1916
-		if ( !empty( $question_groups ) ) {
1917
-			foreach ( $question_groups as $question_group ) {
1916
+		if ( ! empty($question_groups)) {
1917
+			foreach ($question_groups as $question_group) {
1918 1918
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1919 1919
 			}
1920 1920
 		}
@@ -1923,13 +1923,13 @@  discard block
 block discarded – undo
1923 1923
 
1924 1924
 
1925 1925
 		//Message Template Groups
1926
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1926
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1927 1927
 
1928 1928
 
1929 1929
 		//term taxonomies
1930 1930
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1931 1931
 
1932
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1932
+		foreach ($term_taxonomies as $term_taxonomy) {
1933 1933
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1934 1934
 		}
1935 1935
 
@@ -1943,7 +1943,7 @@  discard block
 block discarded – undo
1943 1943
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1944 1944
 			return FALSE;
1945 1945
 		}
1946
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted' );
1946
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted');
1947 1947
 		return TRUE;
1948 1948
 	}
1949 1949
 
@@ -1960,7 +1960,7 @@  discard block
 block discarded – undo
1960 1960
 	 */
1961 1961
 	public function total_events() {
1962 1962
 
1963
-		$count = EEM_Event::instance()->count( array(), 'EVT_ID', true );
1963
+		$count = EEM_Event::instance()->count(array(), 'EVT_ID', true);
1964 1964
 		return $count;
1965 1965
 	}
1966 1966
 
@@ -1975,10 +1975,10 @@  discard block
 block discarded – undo
1975 1975
 	 */
1976 1976
 	public function total_events_draft() {
1977 1977
 		$where = array(
1978
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
1978
+			'status' => array('IN', array('draft', 'auto-draft'))
1979 1979
 			);
1980 1980
 
1981
-		$count = EEM_Event::instance()->count( array( $where ), 'EVT_ID', true );
1981
+		$count = EEM_Event::instance()->count(array($where), 'EVT_ID', true);
1982 1982
 		return $count;
1983 1983
 	}
1984 1984
 
@@ -1997,7 +1997,7 @@  discard block
 block discarded – undo
1997 1997
 			'status' => 'trash'
1998 1998
 			);
1999 1999
 
2000
-		$count = EEM_Event::instance()->count( array( $where ), 'EVT_ID', true );
2000
+		$count = EEM_Event::instance()->count(array($where), 'EVT_ID', true);
2001 2001
 		return $count;
2002 2002
 	}
2003 2003
 
@@ -2025,11 +2025,11 @@  discard block
 block discarded – undo
2025 2025
 			// translated
2026 2026
 			TRUE
2027 2027
 		);
2028
-		$this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment;
2028
+		$this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment;
2029 2029
 
2030 2030
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2031 2031
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2032
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2032
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2033 2033
 		$this->display_admin_page_with_sidebar();
2034 2034
 	}
2035 2035
 
@@ -2055,9 +2055,9 @@  discard block
 block discarded – undo
2055 2055
 
2056 2056
 	protected function _template_settings() {
2057 2057
 		$this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso');
2058
-		$this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />';
2059
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>';
2060
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2058
+		$this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />';
2059
+		$this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>';
2060
+		$this->display_admin_caf_preview_page('template_settings_tab');
2061 2061
 	}
2062 2062
 
2063 2063
 
@@ -2070,22 +2070,22 @@  discard block
 block discarded – undo
2070 2070
 	 * @return void
2071 2071
 	 */
2072 2072
 	private function _set_category_object() {
2073
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2073
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2074 2074
 			return; //already have the category object so get out.
2075 2075
 
2076 2076
 		//set default category object
2077 2077
 		$this->_set_empty_category_object();
2078 2078
 
2079 2079
 		//only set if we've got an id
2080
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2080
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2081 2081
 			return;
2082 2082
 		}
2083 2083
 
2084 2084
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2085 2085
 
2086
-		$term = get_term( $category_id, 'espresso_event_categories' );
2086
+		$term = get_term($category_id, 'espresso_event_categories');
2087 2087
 
2088
-		if ( !empty( $term ) ) {
2088
+		if ( ! empty($term)) {
2089 2089
 			$this->_category->category_name = $term->name;
2090 2090
 			$this->_category->category_identifier = $term->slug;
2091 2091
 			$this->_category->category_desc = $term->description;
@@ -2099,13 +2099,13 @@  discard block
 block discarded – undo
2099 2099
 
2100 2100
 	private function _set_empty_category_object() {
2101 2101
 		$this->_category = new stdClass();
2102
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2102
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2103 2103
 		$this->_category->id = $this->_category->parent = 0;
2104 2104
 	}
2105 2105
 
2106 2106
 
2107 2107
 	protected function _category_list_table() {
2108
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2108
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2109 2109
 		$this->_search_btn_label = __('Categories', 'event_espresso');
2110 2110
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2111 2111
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2115,22 +2115,22 @@  discard block
 block discarded – undo
2115 2115
 	protected function _category_details($view) {
2116 2116
 
2117 2117
 		//load formatter helper
2118
-		EE_Registry::instance()->load_helper( 'Formatter' );
2118
+		EE_Registry::instance()->load_helper('Formatter');
2119 2119
 		//load field generator helper
2120
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
2120
+		EE_Registry::instance()->load_helper('Form_Fields');
2121 2121
 
2122 2122
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
2123 2123
 		$this->_set_add_edit_form_tags($route);
2124 2124
 
2125 2125
 		$this->_set_category_object();
2126
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2126
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2127 2127
 
2128 2128
 		$delete_action = 'delete_category';
2129 2129
 
2130 2130
 		//custom redirect
2131
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2131
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2132 2132
 
2133
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2133
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2134 2134
 
2135 2135
 		//take care of contents
2136 2136
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2144,25 +2144,25 @@  discard block
 block discarded – undo
2144 2144
 			'type' => 'wp_editor',
2145 2145
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2146 2146
 			'class' => 'my_editor_custom',
2147
-			'wpeditor_args' => array('media_buttons' => FALSE )
2147
+			'wpeditor_args' => array('media_buttons' => FALSE)
2148 2148
 		);
2149
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2149
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2150 2150
 
2151
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2151
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2152 2152
 
2153 2153
 		//setup category select for term parents.
2154 2154
 		$category_select_values[] = array(
2155 2155
 			'text' => __('No Parent', 'event_espresso'),
2156 2156
 			'id' => 0
2157 2157
 			);
2158
-		foreach ( $all_terms as $term ) {
2158
+		foreach ($all_terms as $term) {
2159 2159
 			$category_select_values[] = array(
2160 2160
 				'text' => $term->name,
2161 2161
 				'id' => $term->term_id
2162 2162
 				);
2163 2163
 		}
2164 2164
 
2165
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2165
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2166 2166
 
2167 2167
 		$template_args = array(
2168 2168
 			'category' => $this->_category,
@@ -2172,15 +2172,15 @@  discard block
 block discarded – undo
2172 2172
 			'disable' => '',
2173 2173
 			'disabled_message' => FALSE
2174 2174
 			);
2175
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2176
-		return EEH_Template::display_template($template, $template_args, TRUE );
2175
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2176
+		return EEH_Template::display_template($template, $template_args, TRUE);
2177 2177
 	}
2178 2178
 
2179 2179
 
2180 2180
 	protected function _delete_categories() {
2181
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2181
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2182 2182
 
2183
-		foreach ( $cat_ids as $cat_id ) {
2183
+		foreach ($cat_ids as $cat_id) {
2184 2184
 			$this->_delete_category($cat_id);
2185 2185
 		}
2186 2186
 
@@ -2188,7 +2188,7 @@  discard block
 block discarded – undo
2188 2188
 		$query_args = array(
2189 2189
 			'action' => 'category_list'
2190 2190
 			);
2191
-		$this->_redirect_after_action(0,'','',$query_args);
2191
+		$this->_redirect_after_action(0, '', '', $query_args);
2192 2192
 
2193 2193
 	}
2194 2194
 
@@ -2198,61 +2198,61 @@  discard block
 block discarded – undo
2198 2198
 
2199 2199
 	protected function _delete_category($cat_id) {
2200 2200
 		global $wpdb;
2201
-		$cat_id = absint( $cat_id );
2202
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2201
+		$cat_id = absint($cat_id);
2202
+		wp_delete_term($cat_id, 'espresso_event_categories');
2203 2203
 	}
2204 2204
 
2205 2205
 
2206 2206
 
2207 2207
 	protected function _insert_or_update_category($new_category) {
2208 2208
 
2209
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2209
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2210 2210
 		$success = 0; //we already have a success message so lets not send another.
2211 2211
 
2212
-		if ( $cat_id ) {
2212
+		if ($cat_id) {
2213 2213
 			$query_args = array(
2214 2214
 				'action'     => 'edit_category',
2215 2215
 				'EVT_CAT_ID' => $cat_id
2216 2216
 			);
2217 2217
 		} else {
2218
-			$query_args = array( 'action' => 'add_category' );
2218
+			$query_args = array('action' => 'add_category');
2219 2219
 		}
2220
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2220
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2221 2221
 
2222 2222
 	}
2223 2223
 
2224 2224
 
2225 2225
 
2226
-	private function _insert_category( $update = FALSE ) {
2226
+	private function _insert_category($update = FALSE) {
2227 2227
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2228
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2229
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2230
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2228
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2229
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2230
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2231 2231
 
2232
-		if ( empty( $category_name ) ) {
2233
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
2234
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2232
+		if (empty($category_name)) {
2233
+			$msg = __('You must add a name for the category.', 'event_espresso');
2234
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2235 2235
 			return false;
2236 2236
 		}
2237 2237
 
2238
-		$term_args=array(
2238
+		$term_args = array(
2239 2239
 			'name'=>$category_name,
2240 2240
 			'description'=>$category_desc,
2241 2241
 			'parent'=>$category_parent
2242 2242
 		);
2243 2243
 		//was the category_identifier input disabled?
2244
-		if(isset($this->_req_data['category_identifier'])){
2244
+		if (isset($this->_req_data['category_identifier'])) {
2245 2245
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2246 2246
 		}
2247
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2247
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2248 2248
 
2249
-		if ( !is_array( $insert_ids ) ) {
2250
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2251
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2249
+		if ( ! is_array($insert_ids)) {
2250
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
2251
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2252 2252
 		} else {
2253 2253
 			$cat_id = $insert_ids['term_id'];
2254
-			$msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name );
2255
-			EE_Error::add_success( $msg );
2254
+			$msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name);
2255
+			EE_Error::add_success($msg);
2256 2256
 		}
2257 2257
 
2258 2258
 		return $cat_id;
@@ -2261,32 +2261,32 @@  discard block
 block discarded – undo
2261 2261
 
2262 2262
 
2263 2263
 
2264
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2264
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2265 2265
 		global $wpdb;
2266 2266
 
2267 2267
 		//testing term stuff
2268
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2269
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2270
-		$limit = ($current_page-1)*$per_page;
2268
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2269
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2270
+		$limit = ($current_page - 1) * $per_page;
2271 2271
 
2272
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2272
+		$where = array('taxonomy' => 'espresso_event_categories');
2273 2273
 
2274
-		if ( isset( $this->_req_data['s'] ) ) {
2275
-			$sstr = '%' . $this->_req_data['s'] . '%';
2274
+		if (isset($this->_req_data['s'])) {
2275
+			$sstr = '%'.$this->_req_data['s'].'%';
2276 2276
 			$where['OR'] = array(
2277
-				'Term.name' => array( 'LIKE', $sstr),
2278
-				'description' => array( 'LIKE', $sstr )
2277
+				'Term.name' => array('LIKE', $sstr),
2278
+				'description' => array('LIKE', $sstr)
2279 2279
 				);
2280 2280
 		}
2281 2281
 
2282 2282
 		$query_params = array(
2283
-			$where ,
2284
-			'order_by' => array( $orderby => $order ),
2285
-			'limit' => $limit . ',' . $per_page,
2283
+			$where,
2284
+			'order_by' => array($orderby => $order),
2285
+			'limit' => $limit.','.$per_page,
2286 2286
 			'force_join' => array('Term')
2287 2287
 			);
2288 2288
 
2289
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2289
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2290 2290
 
2291 2291
 		return $categories;
2292 2292
 	}
Please login to merge, or discard this patch.
admin_pages/general_settings/General_Settings_Admin_Page.core.php 4 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	 *
546 546
 	 * 		@access 	public
547 547
 	 * 		@param 	string 		$CNT_ISO
548
-	 * 		@return 		mixed		string | array
548
+	 * 		@return 		string|null		string | array
549 549
 	 */
550 550
 	public function display_country_settings( $CNT_ISO = '' ) {
551 551
 
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 	 * 		delete_state
709 709
 	 *
710 710
 	 * 		@access 	public
711
-	 * 		@return 		boolean | void
711
+	 * 		@return 		false|null | void
712 712
 	 */
713 713
 	public function delete_state() {
714 714
 		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
@@ -938,10 +938,10 @@  discard block
 block discarded – undo
938 938
 	/**
939 939
 	 * generates a dropdown of all parent pages - copied from WP core
940 940
 	 *
941
-	 * @param unknown_type $default
942
-	 * @param unknown_type $parent
943
-	 * @param unknown_type $level
944
-	 * @return unknown
941
+	 * @param integer $default
942
+	 * @param integer $parent
943
+	 * @param integer $level
944
+	 * @return null|false
945 945
 	 */
946 946
 	public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) {
947 947
 		global $wpdb;
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 					'order' => 50
155 155
 					),
156 156
 				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
157
-               			'help_tabs' => array(
157
+			   			'help_tabs' => array(
158 158
 					'general_settings_critical_pages_help_tab' => array(
159 159
 						'title' => __('Critical Pages', 'event_espresso'),
160 160
 						'filename' => 'general_settings_critical_pages'
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 					'label' => __('Your Organization', 'event_espresso'),
169 169
 					'order' => 20
170 170
 				),
171
-                			'help_tabs' => array(
171
+							'help_tabs' => array(
172 172
 					'general_settings_your_organization_help_tab' => array(
173 173
 						'title' => __('Your Organization', 'event_espresso'),
174 174
 						'filename' => 'general_settings_your_organization'
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 					'order' => 60
185 185
 					),
186 186
 				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
187
-                			'help_tabs' => array(
187
+							'help_tabs' => array(
188 188
 					'general_settings_admin_options_help_tab' => array(
189 189
 						'title' => __('Admin Options', 'event_espresso'),
190 190
 						'filename' => 'general_settings_admin_options'
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 					'label' => __('Countries', 'event_espresso'),
199 199
 					'order' => 70
200 200
 					),
201
-                'help_tabs' => array(
201
+				'help_tabs' => array(
202 202
 					'general_settings_countries_help_tab' => array(
203 203
 						'title' => __('Countries', 'event_espresso'),
204 204
 						'filename' => 'general_settings_countries'
Please login to merge, or discard this patch.
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -419,8 +420,9 @@  discard block
 block discarded – undo
419 420
 	}
420 421
 
421 422
 	protected function _update_your_organization_settings() {
422
-		if ( is_main_site() )
423
-			EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;
423
+		if ( is_main_site() ) {
424
+					EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;
425
+		}
424 426
 		EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name;
425 427
 		EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1;
426 428
 		EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2;
@@ -950,10 +952,11 @@  discard block
 block discarded – undo
950 952
 		if ( $items ) {
951 953
 			foreach ( $items as $item ) {
952 954
 				$pad = str_repeat( '&nbsp;', $level * 3 );
953
-				if ( $item->ID == $default)
954
-					$current = ' selected="selected"';
955
-				else
956
-					$current = '';
955
+				if ( $item->ID == $default) {
956
+									$current = ' selected="selected"';
957
+				} else {
958
+									$current = '';
959
+				}
957 960
 
958 961
 				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
959 962
 				parent_dropdown( $default, $item->ID, $level +1 );
Please login to merge, or discard this patch.
Spacing   +284 added lines, -285 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
 /**
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
 
42 42
 
43
-	public function __construct( $routing = TRUE ) {
44
-		parent::__construct( $routing );
43
+	public function __construct($routing = TRUE) {
44
+		parent::__construct($routing);
45 45
 	}
46 46
 
47 47
 
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 
58 58
 
59 59
 	protected function _ajax_hooks() {
60
-		add_action('wp_ajax_espresso_display_country_settings', array( $this, 'display_country_settings'));
61
-		add_action('wp_ajax_espresso_display_country_states', array( $this, 'display_country_states'));
62
-		add_action('wp_ajax_espresso_delete_state', array( $this, 'delete_state'), 10, 3 );
63
-		add_action('wp_ajax_espresso_add_new_state', array( $this, 'add_new_state'));
60
+		add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
61
+		add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
62
+		add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
63
+		add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
64 64
 	}
65 65
 
66 66
 
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
 					'label' => __('Critical Pages', 'event_espresso'),
154 154
 					'order' => 50
155 155
 					),
156
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
156
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
157 157
                			'help_tabs' => array(
158 158
 					'general_settings_critical_pages_help_tab' => array(
159 159
 						'title' => __('Critical Pages', 'event_espresso'),
160 160
 						'filename' => 'general_settings_critical_pages'
161 161
 						)
162 162
 					),
163
-				'help_tour' => array( 'Critical_Pages_Help_Tour' ),
163
+				'help_tour' => array('Critical_Pages_Help_Tour'),
164 164
 				'require_nonce' => FALSE
165 165
 				),
166 166
 			'default' => array(
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 						'filename' => 'general_settings_your_organization'
175 175
 						)
176 176
 					),
177
-				'help_tour' => array( 'Your_Organization_Help_Tour' ),
178
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
177
+				'help_tour' => array('Your_Organization_Help_Tour'),
178
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
179 179
 				'require_nonce' => FALSE
180 180
 				),
181 181
 			'admin_option_settings' => array(
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 					'label' => __('Admin Options', 'event_espresso'),
184 184
 					'order' => 60
185 185
 					),
186
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
186
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
187 187
                 			'help_tabs' => array(
188 188
 					'general_settings_admin_options_help_tab' => array(
189 189
 						'title' => __('Admin Options', 'event_espresso'),
190 190
 						'filename' => 'general_settings_admin_options'
191 191
 						)
192 192
 					),
193
-				'help_tour' => array( 'Admin_Options_Help_Tour' ),
193
+				'help_tour' => array('Admin_Options_Help_Tour'),
194 194
 				'require_nonce' => FALSE
195 195
 				),
196 196
 			'country_settings' => array(
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 						'filename' => 'general_settings_countries'
205 205
 						)
206 206
 					),
207
-				'help_tour' => array( 'Countries_Help_Tour' ),
207
+				'help_tour' => array('Countries_Help_Tour'),
208 208
 				'require_nonce' => FALSE
209 209
 				)
210 210
 			);
@@ -231,27 +231,27 @@  discard block
 block discarded – undo
231 231
 		//scripts
232 232
 		wp_enqueue_script('media-upload');
233 233
 		wp_enqueue_script('thickbox');
234
-		wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE );
235
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
236
-		wp_enqueue_script( 'organization_settings' );
237
-		wp_enqueue_style( 'organization-css' );
238
-		$confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso'));
239
-		wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete );
234
+		wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE);
235
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
236
+		wp_enqueue_script('organization_settings');
237
+		wp_enqueue_style('organization-css');
238
+		$confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso'));
239
+		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
240 240
 
241 241
 	}
242 242
 
243 243
 	public function load_scripts_styles_country_settings() {
244 244
 		//scripts
245
-		wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE );
246
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
247
-		wp_enqueue_script( 'gen_settings_countries' );
248
-		wp_enqueue_style( 'organization-css' );
249
-
250
-		EE_Registry::$i18n_js_strings['invalid_server_response'] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' );
251
-		EE_Registry::$i18n_js_strings['error_occurred'] = __(  'An error occurred! Please refresh the page and try again.', 'event_espresso' );
252
-		EE_Registry::$i18n_js_strings['confirm_delete_state'] = __(  'Are you sure you want to delete this State / Province?', 'event_espresso' );
253
-		$protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://';
254
-		EE_Registry::$i18n_js_strings['ajax_url'] = admin_url( 'admin-ajax.php?page=espresso_general_settings' , $protocol );
245
+		wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
246
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
247
+		wp_enqueue_script('gen_settings_countries');
248
+		wp_enqueue_style('organization-css');
249
+
250
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso');
251
+		EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso');
252
+		EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso');
253
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
254
+		EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol);
255 255
 	}
256 256
 
257 257
 
@@ -262,37 +262,37 @@  discard block
 block discarded – undo
262 262
 
263 263
 		// Check to make sure all of the main pages are setup properly,
264 264
 		// if not create the default pages and display an admin notice
265
-		EE_Registry::instance()->load_helper( 'Activation' );
265
+		EE_Registry::instance()->load_helper('Activation');
266 266
 		EEH_Activation::verify_default_pages_exist();
267 267
 
268 268
 		$this->_transient_garbage_collection();
269 269
 		$this->_template_args['values'] = $this->_yes_no_values;
270 270
 
271
-		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL;
272
-		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE;
271
+		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL;
272
+		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE;
273 273
 
274 274
 		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL;
275
-		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE;
275
+		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE;
276 276
 
277
-		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
278
-		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE;
277
+		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
278
+		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE;
279 279
 
280
-		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
281
-		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE;
280
+		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
281
+		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE;
282 282
 
283
-		$this->_set_add_edit_form_tags( 'update_espresso_page_settings' );
284
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
285
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE );
283
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
284
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
285
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE);
286 286
 		$this->display_admin_page_with_sidebar();
287 287
 
288 288
 	}
289 289
 
290 290
 	protected function _update_espresso_page_settings() {
291 291
 		// capture incoming request data
292
-		$reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id;
293
-		$txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id;
294
-		$thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id;
295
-		$cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id;
292
+		$reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id;
293
+		$txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id;
294
+		$thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id;
295
+		$cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id;
296 296
 		// pack critical_pages into an array
297 297
 		$critical_pages = array(
298 298
 			'reg_page_id' 				=> $reg_page_id,
@@ -300,17 +300,17 @@  discard block
 block discarded – undo
300 300
 			'thank_you_page_id' 	=> $thank_you_page_id,
301 301
 			'cancel_page_id' 		=> $cancel_page_id
302 302
 		);
303
-		foreach ( $critical_pages as $critical_page_name => $critical_page_id ) {
303
+		foreach ($critical_pages as $critical_page_name => $critical_page_id) {
304 304
 			// has the page changed ?
305
-			if ( EE_Registry::instance()->CFG->core->$critical_page_name != $critical_page_id ) {
305
+			if (EE_Registry::instance()->CFG->core->$critical_page_name != $critical_page_id) {
306 306
 				// grab post object for old page
307
-				$post = get_post( EE_Registry::instance()->CFG->core->$critical_page_name );
307
+				$post = get_post(EE_Registry::instance()->CFG->core->$critical_page_name);
308 308
 				// update post shortcodes for old page
309
-				EE_Admin::parse_post_content_on_save( $critical_page_id, $post );
309
+				EE_Admin::parse_post_content_on_save($critical_page_id, $post);
310 310
 				// grab post object for new page
311
-				$post = get_post( $critical_page_id );
311
+				$post = get_post($critical_page_id);
312 312
 				// update post shortcodes for new page
313
-				EE_Admin::parse_post_content_on_save( $critical_page_id, $post );
313
+				EE_Admin::parse_post_content_on_save($critical_page_id, $post);
314 314
 			}
315 315
 		}
316 316
 		// set page IDs
@@ -319,14 +319,14 @@  discard block
 block discarded – undo
319 319
 		EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id;
320 320
 		EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id;
321 321
 
322
-		EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data );
322
+		EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data);
323 323
 
324 324
 		$what = __('Critical Pages & Shortcodes', 'event_espresso');
325
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ );
325
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__);
326 326
 		$query_args = array(
327 327
 			'action' => 'critical_pages'
328 328
 			);
329
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
329
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
330 330
 
331 331
 	}
332 332
 
@@ -341,35 +341,35 @@  discard block
 block discarded – undo
341 341
 
342 342
 	protected function _your_organization_settings() {
343 343
 
344
-		$this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : '';
345
-		$this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : '';
346
-		$this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : '';
347
-		$this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : '';
348
-		$this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : '';
349
-		$this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : '';
350
-		$this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : '';
351
-		$this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : '';
352
-		$this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : '';
353
-		$this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$';
354
-		$this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE;
355
-		$this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : '';
356
-		$this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : '';
357
-		$this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : '';
358
-		$this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : '';
359
-		$this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : '';
360
-		$this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : '';
344
+		$this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : '';
345
+		$this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : '';
346
+		$this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : '';
347
+		$this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : '';
348
+		$this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : '';
349
+		$this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : '';
350
+		$this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : '';
351
+		$this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : '';
352
+		$this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : '';
353
+		$this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$';
354
+		$this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE;
355
+		$this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : '';
356
+		$this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : '';
357
+		$this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : '';
358
+		$this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : '';
359
+		$this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : '';
360
+		$this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : '';
361 361
 		//UXIP settings
362
-		$this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE;
362
+		$this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE;
363 363
 
364
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
365
-		$STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
364
+		EE_Registry::instance()->load_helper('Form_Fields');
365
+		$STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
366 366
 		$this->_template_args['states'] = new EE_Question_Form_Input(
367
-				EE_Question::new_instance ( array(
367
+				EE_Question::new_instance(array(
368 368
 					'QST_ID'=> 0,
369 369
 					'QST_display_text'=> __('State/Province', 'event_espresso'),
370 370
 					'QST_system'=>'admin-state'
371 371
 				)),
372
-				EE_Answer::new_instance ( array(
372
+				EE_Answer::new_instance(array(
373 373
 					'ANS_ID' => 0,
374 374
 					'ANS_value' => $STA_ID
375 375
 				)),
@@ -381,14 +381,14 @@  discard block
 block discarded – undo
381 381
 				)
382 382
 			);
383 383
 
384
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
384
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
385 385
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
386
-				EE_Question::new_instance ( array(
386
+				EE_Question::new_instance(array(
387 387
 					'QST_ID'=> 0,
388 388
 					'QST_display_text'=> __('Country', 'event_espresso'),
389 389
 					'QST_system'=>'admin-country'
390 390
 				)),
391
-				EE_Answer::new_instance ( array(
391
+				EE_Answer::new_instance(array(
392 392
 					'ANS_ID' => 0,
393 393
 					'ANS_value' => $CNT_ISO
394 394
 				)),
@@ -400,51 +400,51 @@  discard block
 block discarded – undo
400 400
 				)
401 401
 			);
402 402
 
403
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
404
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
403
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
404
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
405 405
 
406 406
 		//PUE verification stuff
407
-		$ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME );
408
-		$verify_fail = get_option( $ver_option_key );
409
-		$this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
407
+		$ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME);
408
+		$verify_fail = get_option($ver_option_key);
409
+		$this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
410 410
 
411
-		$this->_set_add_edit_form_tags( 'update_your_organization_settings' );
412
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
413
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE );
411
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
412
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
413
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE);
414 414
 
415 415
 		$this->display_admin_page_with_sidebar();
416 416
 	}
417 417
 
418 418
 	protected function _update_your_organization_settings() {
419
-		if ( is_main_site() )
420
-			EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;
421
-		EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name;
422
-		EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1;
423
-		EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2;
424
-		EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city;
425
-		EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID;
426
-		EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO;
427
-		EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip;
428
-		EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email;
429
-		EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat;
430
-		EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone;
431
-		EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url;
432
-		EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook;
433
-		EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter;
434
-		EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin;
435
-		EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest;
436
-		EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google;
437
-		EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram;
438
-		EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
439
-
440
-		EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO );
441
-
442
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG );
419
+		if (is_main_site())
420
+			EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key;
421
+		EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name;
422
+		EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1;
423
+		EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2;
424
+		EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city;
425
+		EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID;
426
+		EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO;
427
+		EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip;
428
+		EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email;
429
+		EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat;
430
+		EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone;
431
+		EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url;
432
+		EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook;
433
+		EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter;
434
+		EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin;
435
+		EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest;
436
+		EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google;
437
+		EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram;
438
+		EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
439
+
440
+		EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);
441
+
442
+		EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG);
443 443
 
444 444
 		$what = 'Your Organization Settings';
445
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
445
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
446 446
 
447
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) );
447
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default'));
448 448
 
449 449
 	}
450 450
 
@@ -455,36 +455,36 @@  discard block
 block discarded – undo
455 455
 	protected function _admin_option_settings() {
456 456
 
457 457
 		$this->_template_args['values'] = $this->_yes_no_values;
458
-		$this->_template_args['use_personnel_manager'] = isset( EE_Registry::instance()->CFG->admin->use_personnel_manager ) ? absint( EE_Registry::instance()->CFG->admin->use_personnel_manager ) : FALSE;
459
-		$this->_template_args['use_dashboard_widget'] = isset( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) ? absint( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) : TRUE;
460
-		$this->_template_args['events_in_dashboard'] = isset( EE_Registry::instance()->CFG->admin->events_in_dashboard ) ? absint( EE_Registry::instance()->CFG->admin->events_in_dashboard ) : 30;
461
-		$this->_template_args['use_event_timezones'] = isset( EE_Registry::instance()->CFG->admin->use_event_timezones ) ? absint( EE_Registry::instance()->CFG->admin->use_event_timezones ) : FALSE;
462
-		$this->_template_args['show_reg_footer'] = isset( EE_Registry::instance()->CFG->admin->show_reg_footer ) ? absint( EE_Registry::instance()->CFG->admin->show_reg_footer ) : TRUE;
463
-		$this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
464
-		$this->_template_args['help_tour_activation'] = isset( EE_Registry::instance()->CFG->admin->help_tour_activation ) ? absint( EE_Registry::instance()->CFG->admin->help_tour_activation ): 1;
465
-
466
-		$this->_set_add_edit_form_tags( 'update_admin_option_settings' );
467
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
458
+		$this->_template_args['use_personnel_manager'] = isset(EE_Registry::instance()->CFG->admin->use_personnel_manager) ? absint(EE_Registry::instance()->CFG->admin->use_personnel_manager) : FALSE;
459
+		$this->_template_args['use_dashboard_widget'] = isset(EE_Registry::instance()->CFG->admin->use_dashboard_widget) ? absint(EE_Registry::instance()->CFG->admin->use_dashboard_widget) : TRUE;
460
+		$this->_template_args['events_in_dashboard'] = isset(EE_Registry::instance()->CFG->admin->events_in_dashboard) ? absint(EE_Registry::instance()->CFG->admin->events_in_dashboard) : 30;
461
+		$this->_template_args['use_event_timezones'] = isset(EE_Registry::instance()->CFG->admin->use_event_timezones) ? absint(EE_Registry::instance()->CFG->admin->use_event_timezones) : FALSE;
462
+		$this->_template_args['show_reg_footer'] = isset(EE_Registry::instance()->CFG->admin->show_reg_footer) ? absint(EE_Registry::instance()->CFG->admin->show_reg_footer) : TRUE;
463
+		$this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
464
+		$this->_template_args['help_tour_activation'] = isset(EE_Registry::instance()->CFG->admin->help_tour_activation) ? absint(EE_Registry::instance()->CFG->admin->help_tour_activation) : 1;
465
+
466
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
467
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
468 468
 		$this->_template_args['template_args'] = $this->_template_args;
469
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE );
469
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE);
470 470
 		$this->display_admin_page_with_sidebar();
471 471
 	}
472 472
 
473 473
 	protected function _update_admin_option_settings() {
474
-		EE_Registry::instance()->CFG->admin->use_personnel_manager = isset( $this->_req_data['use_personnel_manager'] ) ? absint( $this->_req_data['use_personnel_manager'] ) : EE_Registry::instance()->CFG->admin->use_personnel_manager;
475
-		EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset( $this->_req_data['use_dashboard_widget'] ) ? absint( $this->_req_data['use_dashboard_widget'] ) : EE_Registry::instance()->CFG->admin->use_dashboard_widget;
476
-		EE_Registry::instance()->CFG->admin->events_in_dashboard = isset( $this->_req_data['events_in_dashboard'] ) ? absint( $this->_req_data['events_in_dashboard'] ) : EE_Registry::instance()->CFG->admin->events_in_dashboard;
477
-		EE_Registry::instance()->CFG->admin->use_event_timezones = isset( $this->_req_data['use_event_timezones'] ) ? absint( $this->_req_data['use_event_timezones'] ) : EE_Registry::instance()->CFG->admin->use_event_timezones;
478
-		EE_Registry::instance()->CFG->admin->show_reg_footer = isset( $this->_req_data['show_reg_footer'] ) ? absint( $this->_req_data['show_reg_footer'] ) : EE_Registry::instance()->CFG->admin->show_reg_footer;
479
-		EE_Registry::instance()->CFG->admin->affiliate_id = isset( $this->_req_data['affiliate_id'] ) ? sanitize_text_field( $this->_req_data['affiliate_id'] ) : EE_Registry::instance()->CFG->admin->affiliate_id;
480
-		EE_Registry::instance()->CFG->admin->help_tour_activation = isset( $this->_req_data['help_tour_activation'] ) ? absint( $this->_req_data['help_tour_activation'] ) : EE_Registry::instance()->CFG->admin->help_tour_activation;
474
+		EE_Registry::instance()->CFG->admin->use_personnel_manager = isset($this->_req_data['use_personnel_manager']) ? absint($this->_req_data['use_personnel_manager']) : EE_Registry::instance()->CFG->admin->use_personnel_manager;
475
+		EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset($this->_req_data['use_dashboard_widget']) ? absint($this->_req_data['use_dashboard_widget']) : EE_Registry::instance()->CFG->admin->use_dashboard_widget;
476
+		EE_Registry::instance()->CFG->admin->events_in_dashboard = isset($this->_req_data['events_in_dashboard']) ? absint($this->_req_data['events_in_dashboard']) : EE_Registry::instance()->CFG->admin->events_in_dashboard;
477
+		EE_Registry::instance()->CFG->admin->use_event_timezones = isset($this->_req_data['use_event_timezones']) ? absint($this->_req_data['use_event_timezones']) : EE_Registry::instance()->CFG->admin->use_event_timezones;
478
+		EE_Registry::instance()->CFG->admin->show_reg_footer = isset($this->_req_data['show_reg_footer']) ? absint($this->_req_data['show_reg_footer']) : EE_Registry::instance()->CFG->admin->show_reg_footer;
479
+		EE_Registry::instance()->CFG->admin->affiliate_id = isset($this->_req_data['affiliate_id']) ? sanitize_text_field($this->_req_data['affiliate_id']) : EE_Registry::instance()->CFG->admin->affiliate_id;
480
+		EE_Registry::instance()->CFG->admin->help_tour_activation = isset($this->_req_data['help_tour_activation']) ? absint($this->_req_data['help_tour_activation']) : EE_Registry::instance()->CFG->admin->help_tour_activation;
481 481
 
482
-		EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin );
482
+		EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin);
483 483
 
484 484
 		$what = 'Admin Options';
485
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ );
486
-		$success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success );
487
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) );
485
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__);
486
+		$success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success);
487
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings'));
488 488
 
489 489
 	}
490 490
 
@@ -497,21 +497,21 @@  discard block
 block discarded – undo
497 497
 
498 498
 	protected function _country_settings() {
499 499
 
500
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
501
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
500
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
501
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
502 502
 
503 503
 		//load field generator helper
504
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
504
+		EE_Registry::instance()->load_helper('Form_Fields');
505 505
 
506 506
 		$this->_template_args['values'] = $this->_yes_no_values;
507 507
 
508 508
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
509
-				EE_Question::new_instance ( array(
509
+				EE_Question::new_instance(array(
510 510
 					'QST_ID'=> 0,
511 511
 					'QST_display_text'=> __('Select Country', 'event_espresso'),
512 512
 					'QST_system'=>'admin-country'
513 513
 				)),
514
-				EE_Answer::new_instance ( array(
514
+				EE_Answer::new_instance(array(
515 515
 					'ANS_ID' => 0,
516 516
 					'ANS_value' => $CNT_ISO
517 517
 				)),
@@ -524,14 +524,14 @@  discard block
 block discarded – undo
524 524
 			);
525 525
 //		EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
526 526
 
527
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
528
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
527
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
528
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
529 529
 		$this->_template_args['country_details_settings'] = $this->display_country_settings();
530 530
 		$this->_template_args['country_states_settings'] = $this->display_country_states();
531 531
 
532
-		$this->_set_add_edit_form_tags( 'update_country_settings' );
533
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
534
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE );
532
+		$this->_set_add_edit_form_tags('update_country_settings');
533
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
534
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE);
535 535
 		$this->display_admin_page_with_no_sidebar();
536 536
 	}
537 537
 
@@ -544,44 +544,44 @@  discard block
 block discarded – undo
544 544
 	 * 		@param 	string 		$CNT_ISO
545 545
 	 * 		@return 		mixed		string | array
546 546
 	 */
547
-	public function display_country_settings( $CNT_ISO = '' ) {
547
+	public function display_country_settings($CNT_ISO = '') {
548 548
 
549
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
550
-		if ( ! $CNT_ISO ) {
549
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
550
+		if ( ! $CNT_ISO) {
551 551
 			return '';
552 552
 		}
553 553
 
554 554
 		// for ajax
555
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
556
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
557
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
558
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
559
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
560
-		$country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );
555
+		EE_Registry::instance()->load_helper('Form_Fields');
556
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
557
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
558
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
559
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
560
+		$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
561 561
 		//EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
562 562
 		$country_input_types = array(
563
-			'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  ),
564
-			'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
565
-			'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
566
-			'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
567
-			'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ),
568
-			'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
569
-			'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
570
-			'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
571
-			'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ),
572
-			'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ),
573
-			'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))),
574
-			'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ),
575
-			'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ),
576
-			'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
577
-			'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  )
563
+			'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
564
+			'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
565
+			'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
566
+			'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
567
+			'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'),
568
+			'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
569
+			'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
570
+			'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
571
+			'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE),
572
+			'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
573
+			'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))),
574
+			'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE),
575
+			'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE),
576
+			'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
577
+			'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE)
578 578
 		);
579
-		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types );
580
-		$country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE );
579
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types);
580
+		$country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE);
581 581
 
582
-		if ( defined( 'DOING_AJAX' )) {
583
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
584
-			echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
582
+		if (defined('DOING_AJAX')) {
583
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
584
+			echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
585 585
 			die();
586 586
 		} else {
587 587
 			return $country_details_settings;
@@ -599,50 +599,50 @@  discard block
 block discarded – undo
599 599
 	 * 		@param 	string 		$CNT_ISO
600 600
 	 * 		@return 		string
601 601
 	 */
602
-	public function display_country_states( $CNT_ISO = '' ) {
602
+	public function display_country_states($CNT_ISO = '') {
603 603
 
604
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO;
604
+		$CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
605 605
 
606
-		if ( ! $CNT_ISO ) {
606
+		if ( ! $CNT_ISO) {
607 607
 			return '';
608 608
 		}
609 609
 		// for ajax
610
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
611
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
612
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
613
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 );
614
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 );
615
-		$states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO ));
610
+		EE_Registry::instance()->load_helper('Form_Fields');
611
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
612
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
613
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
614
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
615
+		$states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
616 616
 
617 617
 //			echo '<h4>$CNT_ISO : ' . $CNT_ISO . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
618 618
 //			global $wpdb;
619 619
 //			echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
620 620
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
621
-		if ( $states ) {
622
-			foreach ( $states as $STA_ID => $state ) {
623
-				if ( $state instanceof EE_State ) {
621
+		if ($states) {
622
+			foreach ($states as $STA_ID => $state) {
623
+				if ($state instanceof EE_State) {
624 624
 					//STA_abbrev 	STA_name 	STA_active
625 625
 					$state_input_types = array(
626
-						'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ),
627
-						'STA_name'   => array( 'type'       => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ),
628
-						'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true )
626
+						'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'),
627
+						'STA_name'   => array('type'       => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'),
628
+						'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true)
629 629
 					);
630
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types );
631
-					$query_args = array( 'action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() );
632
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL );
630
+					$this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types);
631
+					$query_args = array('action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev());
632
+					$this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL);
633 633
 				}
634 634
 			}
635 635
 		} else {
636 636
 			$this->_template_args['states'] = FALSE;
637 637
 		}
638 638
 //		EEH_Debug_Tools::printr( $this->_template_args['states'], 'states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
639
-		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ),  GEN_SET_ADMIN_URL );
639
+		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL);
640 640
 
641
-		$state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE );
641
+		$state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE);
642 642
 
643
-		if ( defined( 'DOING_AJAX' )) {
644
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
645
-			echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
643
+		if (defined('DOING_AJAX')) {
644
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
645
+			echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
646 646
 			die();
647 647
 		} else {
648 648
 			return $state_details_settings;
@@ -663,39 +663,38 @@  discard block
 block discarded – undo
663 663
 
664 664
 		$success = TRUE;
665 665
 
666
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
667
-		if ( ! $CNT_ISO ) {
668
-			EE_Error::add_error( __( 'An error occurred. No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
666
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
667
+		if ( ! $CNT_ISO) {
668
+			EE_Error::add_error(__('An error occurred. No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
669 669
 			$success = FALSE;
670 670
 		}
671
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
672
-		if ( ! $STA_abbrev ) {
673
-			EE_Error::add_error( __( 'An error occurred. No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
671
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
672
+		if ( ! $STA_abbrev) {
673
+			EE_Error::add_error(__('An error occurred. No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
674 674
 			$success = FALSE;
675 675
 		}
676
-		$STA_name = isset( $this->_req_data['STA_name'] ) ?  sanitize_text_field( $this->_req_data['STA_name'] ) :
677
-			FALSE;
678
-		if ( ! $STA_name ) {
679
-			EE_Error::add_error( __( 'An error occurred. No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
676
+		$STA_name = isset($this->_req_data['STA_name']) ?  sanitize_text_field($this->_req_data['STA_name']) : FALSE;
677
+		if ( ! $STA_name) {
678
+			EE_Error::add_error(__('An error occurred. No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
680 679
 			$success = FALSE;
681 680
 		}
682 681
 
683
-		if ( $success ) {
682
+		if ($success) {
684 683
 			$cols_n_values = array(
685 684
 				'CNT_ISO' => $CNT_ISO,
686 685
 				'STA_abbrev' => $STA_abbrev,
687 686
 				'STA_name' => $STA_name,
688 687
 				'STA_active' => TRUE
689 688
 			);
690
-			$success = EEM_State::instance()->insert ( $cols_n_values );
689
+			$success = EEM_State::instance()->insert($cols_n_values);
691 690
 		}
692 691
 
693
-		if ( defined( 'DOING_AJAX' )) {
694
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
695
-			echo json_encode( array( 'return_data' => $CNT_ISO, 'success' => __( 'The State was added successfully.', 'event_espresso' ), 'errors' => $notices['errors'] ));
692
+		if (defined('DOING_AJAX')) {
693
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
694
+			echo json_encode(array('return_data' => $CNT_ISO, 'success' => __('The State was added successfully.', 'event_espresso'), 'errors' => $notices['errors']));
696 695
 			die();
697 696
 		} else {
698
-			$this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) );
697
+			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
699 698
 		}
700 699
 	}
701 700
 
@@ -708,25 +707,25 @@  discard block
 block discarded – undo
708 707
 	 * 		@return 		boolean | void
709 708
 	 */
710 709
 	public function delete_state() {
711
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
712
-		$STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE;
713
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
714
-		if ( ! $STA_ID ) {
715
-			EE_Error::add_error( __( 'An error occurred. No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
710
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
711
+		$STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE;
712
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
713
+		if ( ! $STA_ID) {
714
+			EE_Error::add_error(__('An error occurred. No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
716 715
 			return FALSE;
717 716
 		}
718
-		$success = EEM_State::instance()->delete_by_ID( $STA_ID );
719
-		if ( $success !== FALSE ) {
720
-			do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev ));
721
-			EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' ));
717
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
718
+		if ($success !== FALSE) {
719
+			do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev));
720
+			EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
722 721
 		}
723
-		if ( defined( 'DOING_AJAX' )) {
724
-			$notices = EE_Error::get_notices( FALSE, FALSE );
722
+		if (defined('DOING_AJAX')) {
723
+			$notices = EE_Error::get_notices(FALSE, FALSE);
725 724
 			$notices['return_data'] = TRUE;
726
-			echo json_encode( $notices );
725
+			echo json_encode($notices);
727 726
 			die();
728 727
 		} else {
729
-			$this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) );
728
+			$this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings'));
730 729
 		}
731 730
 	}
732 731
 
@@ -742,63 +741,63 @@  discard block
 block discarded – undo
742 741
 	protected function _update_country_settings() {
743 742
 //		EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
744 743
 		// grab the country ISO code
745
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE;
746
-		if ( ! $CNT_ISO ) {
747
-			EE_Error::add_error( __( 'An error occurred. No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
744
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE;
745
+		if ( ! $CNT_ISO) {
746
+			EE_Error::add_error(__('An error occurred. No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
748 747
 			return;
749 748
 		}
750 749
 		$cols_n_values = array();
751
-		$cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE;
752
-		$cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL;
753
-		$cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL;
754
-		$cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD';
755
-		$cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar';
756
-		$cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars';
757
-		$cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$';
758
-		$cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE;
759
-		$cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2;
760
-		$cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.';
761
-		$cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ',';
762
-		$cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL;
763
-		$cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE;
764
-		$cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE;
750
+		$cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE;
751
+		$cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL;
752
+		$cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL;
753
+		$cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD';
754
+		$cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar';
755
+		$cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars';
756
+		$cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$';
757
+		$cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE;
758
+		$cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2;
759
+		$cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.';
760
+		$cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ',';
761
+		$cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL;
762
+		$cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE;
763
+		$cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE;
765 764
 		// allow filtering of country data
766
-		$cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values );
765
+		$cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values);
767 766
 		//EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
768 767
 		// where values
769
-		$where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO ));
768
+		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
770 769
 		// run the update
771
-		$success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values );
770
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
772 771
 //		global $wpdb;
773 772
 //		echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
774 773
 //		echo '<h4>$success : ' . $success . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
775
-		if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) {
774
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) {
776 775
 			// allow filtering of states data
777
-			$states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] );
776
+			$states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']);
778 777
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
779 778
 			// loop thru state data ( looks like : states[75][STA_name] )
780
-			foreach( $states as $STA_ID => $state ) {
779
+			foreach ($states as $STA_ID => $state) {
781 780
 				$cols_n_values = array(
782 781
 					'CNT_ISO' 		=> $CNT_ISO,
783
-					'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ),
784
-					'STA_name' 	=> sanitize_text_field( $state['STA_name'] ),
785
-					'STA_active' 	=> (bool)absint( $state['STA_active'] )
782
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
783
+					'STA_name' 	=> sanitize_text_field($state['STA_name']),
784
+					'STA_active' 	=> (bool) absint($state['STA_active'])
786 785
 				);
787 786
 				// where values
788
-				$where_cols_n_values = array( array( 'STA_ID' => $STA_ID ));
787
+				$where_cols_n_values = array(array('STA_ID' => $STA_ID));
789 788
 				// run the update
790
-				$success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values );
791
-				if ( $success !== FALSE ) {
792
-					do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values );
789
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
790
+				if ($success !== FALSE) {
791
+					do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values);
793 792
 				}
794 793
 			}
795 794
 		}
796 795
 		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
797
-		if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) {
798
-			EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO );
796
+		if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) {
797
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
799 798
 			EE_Registry::instance()->CFG->update_espresso_config();
800 799
 		}
801
-		$this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO ));
800
+		$this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO));
802 801
 	}
803 802
 
804 803
 
@@ -812,11 +811,11 @@  discard block
 block discarded – undo
812 811
 	 * 		@param 		string 		$label
813 812
 	 * 		@return 		string
814 813
 	 */
815
-	public function country_form_field_label_wrap( $label, $required_text ) {
814
+	public function country_form_field_label_wrap($label, $required_text) {
816 815
 		return '
817 816
 			<tr>
818 817
 				<th>
819
-					' . $label  . '
818
+					' . $label.'
820 819
 				</th>';
821 820
 	}
822 821
 
@@ -830,10 +829,10 @@  discard block
 block discarded – undo
830 829
 	 * 		@param 		string 		$label
831 830
 	 * 		@return 		string
832 831
 	 */
833
-	public function country_form_field_input__wrap( $input, $label ) {
832
+	public function country_form_field_input__wrap($input, $label) {
834 833
 		return '
835 834
 				<td class="general-settings-country-input-td">
836
-					' . $input . '
835
+					' . $input.'
837 836
 				</td>
838 837
 			</tr>';
839 838
 	}
@@ -849,7 +848,7 @@  discard block
 block discarded – undo
849 848
 	 * 		@param 		string 		$required_text
850 849
 	 * 		@return 		string
851 850
 	 */
852
-	public function state_form_field_label_wrap( $label, $required_text  ) {
851
+	public function state_form_field_label_wrap($label, $required_text) {
853 852
 		return $required_text;
854 853
 	}
855 854
 
@@ -863,10 +862,10 @@  discard block
 block discarded – undo
863 862
 	 * 		@param 		string 		$label
864 863
 	 * 		@return 		string
865 864
 	 */
866
-	public function state_form_field_input__wrap( $input, $label ) {
865
+	public function state_form_field_input__wrap($input, $label) {
867 866
 		return '
868 867
 				<td class="general-settings-country-state-input-td">
869
-					' . $input . '
868
+					' . $input.'
870 869
 				</td>';
871 870
 
872 871
 	}
@@ -889,10 +888,10 @@  discard block
 block discarded – undo
889 888
 	 * @param int $ee_page_id
890 889
 	 * @return string
891 890
 	 */
892
-	public static function edit_view_links( $ee_page_id ) {
893
-		$links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ),  admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>';
891
+	public static function edit_view_links($ee_page_id) {
892
+		$links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>';
894 893
 		$links .= ' &nbsp;|&nbsp; ';
895
-		$links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>';
894
+		$links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>';
896 895
 		return $links;
897 896
 	}
898 897
 
@@ -905,27 +904,27 @@  discard block
 block discarded – undo
905 904
 	 * @param WP page object $ee_page
906 905
 	 * @return string
907 906
 	 */
908
-	public static function page_and_shortcode_status( $ee_page, $shortcode ) {
907
+	public static function page_and_shortcode_status($ee_page, $shortcode) {
909 908
 
910 909
 		// page status
911
-		if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') {
910
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
912 911
 			$pg_colour = 'green';
913
-			$pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), '&nbsp;' , '&nbsp;' );
912
+			$pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
914 913
 		 } else {
915 914
 			$pg_colour = 'red';
916
-			$pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;'  );
915
+			$pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
917 916
 		}
918 917
 
919 918
 		// shortcode status
920
-		if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) {
919
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) {
921 920
 			$sc_colour = 'green';
922
-			$sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), '&nbsp;' );
921
+			$sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
923 922
 		 } else {
924 923
 			$sc_colour = 'red';
925
-			$sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), '&nbsp;' );
924
+			$sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
926 925
 		}
927 926
 
928
-		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
927
+		return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>';
929 928
 
930 929
 	}
931 930
 
@@ -940,20 +939,20 @@  discard block
 block discarded – undo
940 939
 	 * @param unknown_type $level
941 940
 	 * @return unknown
942 941
 	 */
943
-	public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) {
942
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) {
944 943
 		global $wpdb;
945
-		$items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) );
944
+		$items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent));
946 945
 
947
-		if ( $items ) {
948
-			foreach ( $items as $item ) {
949
-				$pad = str_repeat( '&nbsp;', $level * 3 );
950
-				if ( $item->ID == $default)
946
+		if ($items) {
947
+			foreach ($items as $item) {
948
+				$pad = str_repeat('&nbsp;', $level * 3);
949
+				if ($item->ID == $default)
951 950
 					$current = ' selected="selected"';
952 951
 				else
953 952
 					$current = '';
954 953
 
955
-				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
956
-				parent_dropdown( $default, $item->ID, $level +1 );
954
+				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>";
955
+				parent_dropdown($default, $item->ID, $level + 1);
957 956
 			}
958 957
 		} else {
959 958
 			return false;
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Admin_Page.core.php 4 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
 	 * Retrieve and set the message preview for display.
1357 1357
 	 *
1358 1358
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1359
-	 * @return void
1359
+	 * @return string|null
1360 1360
 	 */
1361 1361
 	public function _preview_message( $send = FALSE ) {
1362 1362
 		//first make sure we've got the necessary parameters
@@ -1673,7 +1673,7 @@  discard block
 block discarded – undo
1673 1673
 	 * sets up a context switcher for edit forms
1674 1674
 	 *
1675 1675
 	 * @access  protected
1676
-	 * @param  EE_Message_Template_Group $template_object the template group object being displayed on the form
1676
+	 * @param  EE_Message_Template_Group $template_group_object the template group object being displayed on the form
1677 1677
 	 * @param array $args various things the context switcher needs.
1678 1678
 	 * @return void
1679 1679
 	 */
@@ -2077,7 +2077,7 @@  discard block
 block discarded – undo
2077 2077
 	 * helper for permanently deleting a mtP group and all related message_templates
2078 2078
 	 * @param  int    $GRP_ID The group being deleted
2079 2079
 	 * @param  bool $include_group whether to delete the Message Template Group as well.
2080
-	 * @return success        boolean to indicate the success of the deletes or not.
2080
+	 * @return integer        boolean to indicate the success of the deletes or not.
2081 2081
 	 */
2082 2082
 	private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) {
2083 2083
 		$success = 1;
@@ -2557,8 +2557,8 @@  discard block
 block discarded – undo
2557 2557
 	 *
2558 2558
 	 * @param  string  $messenger What messenger we're toggling
2559 2559
 	 * @param  boolean $deactivate if true then we deactivate
2560
-	 * @param  mixed   $message_type if present what message type we're toggling
2561
-	 * @return void
2560
+	 * @param  null|string   $message_type if present what message type we're toggling
2561
+	 * @return boolean
2562 2562
 	 */
2563 2563
 	protected function _activate_messenger($messenger, $deactivate = FALSE, $message_type = FALSE) {
2564 2564
 		global $espresso_wp_user;
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 
191 191
 	/**
192 192
 	 * 		an array for storing key => value pairs of request actions and their corresponding methods
193
-	*		@access protected
194
-	*		@return void
195
-	*/
193
+	 *		@access protected
194
+	 *		@return void
195
+	 */
196 196
 	protected function _set_page_routes() {
197 197
 		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
198 198
 		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
@@ -379,18 +379,18 @@  discard block
 block discarded – undo
379 379
 							'title' => __('Message Template Editor', 'event_espresso'),
380 380
 							'callback' => 'edit_message_template_help_tab'
381 381
 							),
382
-                        'message_templates_help_tab' => array(
383
-                            'title' => __('Message Templates', 'event_espresso'),
384
-                            'filename' => 'messages_templates'
385
-                            ),
382
+						'message_templates_help_tab' => array(
383
+							'title' => __('Message Templates', 'event_espresso'),
384
+							'filename' => 'messages_templates'
385
+							),
386 386
 						'message_template_shortcodes' => array(
387 387
 							'title' => __('Message Shortcodes', 'event_espresso'),
388 388
 							'callback' => 'message_template_shortcodes_help_tab'
389 389
 							),
390
-                        'message_preview_help_tab' => array(
391
-                            'title' => __('Message Preview', 'event_espresso'),
392
-                            'filename' => 'messages_preview'
393
-                            ),
390
+						'message_preview_help_tab' => array(
391
+							'title' => __('Message Preview', 'event_espresso'),
392
+							'filename' => 'messages_preview'
393
+							),
394 394
 					),
395 395
 				'require_nonce' => FALSE
396 396
 				),
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 					'order' => 20
416 416
 					),
417 417
 				'metaboxes' => array('_messages_settings_metaboxes'),
418
-                'help_tabs' => array(
418
+				'help_tabs' => array(
419 419
 						'messages_settings_help_tab' => array(
420 420
 							'title' => __('Messages Settings', 'event_espresso'),
421 421
 							'filename' => 'messages_settings'
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 							'title' => __('Activating / Deactivating Messengers', 'event_espresso'),
429 429
 							'filename' => 'messages_settings_messengers'
430 430
 							),
431
-                    ),
431
+					),
432 432
 				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
433 433
 				'require_nonce' => FALSE
434 434
 				)
@@ -2106,9 +2106,9 @@  discard block
 block discarded – undo
2106 2106
 
2107 2107
 	/**
2108 2108
 	 * 	_learn_more_about_message_templates_link
2109
-	*	@access protected
2110
-	*	@return string
2111
-	*/
2109
+	 *	@access protected
2110
+	 *	@return string
2111
+	 */
2112 2112
 	protected function _learn_more_about_message_templates_link() {
2113 2113
 		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2114 2114
 	}
Please login to merge, or discard this patch.
Braces   +54 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION') ) {
2 2
 	exit('NO direct script access allowed');
3
+}
3 4
 
4 5
 /**
5 6
  * Event Espresso
@@ -123,8 +124,9 @@  discard block
 block discarded – undo
123 124
 			$ref = str_replace( ' ', '_', $ref );
124 125
 			$classname = 'EE_' . $ref . '_messenger';
125 126
 			require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );
126
-			if ( !class_exists($classname) )
127
-				throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
127
+			if ( !class_exists($classname) ) {
128
+							throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
129
+			}
128 130
 
129 131
 			$a = new ReflectionClass( $classname );
130 132
 			$this->_active_messengers[$messenger]['obj'] = $a->newInstance();
@@ -141,14 +143,17 @@  discard block
 block discarded – undo
141 143
 	 * @return void
142 144
 	 */
143 145
 	protected function _load_active_message_type_objects() {
144
-		if ( empty($this->_active_message_types) ) return;
146
+		if ( empty($this->_active_message_types) ) {
147
+			return;
148
+		}
145 149
 		foreach ( $this->_active_message_types as $message_type ) {
146 150
 			$ref = ucwords( str_replace( '_' , ' ', $message_type) );
147 151
 			$ref = str_replace( ' ', '_', $ref );
148 152
 			$classname = 'EE_' . $ref . '_message_type';
149 153
 
150
-			if ( !class_exists($classname) )
151
-				throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
154
+			if ( !class_exists($classname) ) {
155
+							throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
156
+			}
152 157
 
153 158
 			$a = new ReflectionClass( $classname );
154 159
 			$this->_active_message_types[$message_type]['obj'] = $a->newInstance();
@@ -781,12 +786,14 @@  discard block
 block discarded – undo
781 786
 		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
782 787
 
783 788
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
784
-		if ( empty( $message_type ) || empty( $messenger )  )
785
-			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
789
+		if ( empty( $message_type ) || empty( $messenger )  ) {
790
+					throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
791
+		}
786 792
 
787 793
 		//we need the GRP_ID for the template being used as the base for the new template
788
-		if ( empty( $GRP_ID ) )
789
-			throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );
794
+		if ( empty( $GRP_ID ) ) {
795
+					throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );
796
+		}
790 797
 
791 798
 		//let's just make sure the template gets generated!
792 799
 
@@ -902,10 +909,13 @@  discard block
 block discarded – undo
902 909
 							$continue = FALSE;
903 910
 							if ( isset( $extra_array['shortcodes_required'] ) ) {
904 911
 								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
905
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
906
-										$continue = TRUE;
912
+									if ( !array_key_exists( $shortcode, $this->_shortcodes ) ) {
913
+																			$continue = TRUE;
914
+									}
915
+								}
916
+								if ( $continue ) {
917
+									continue;
907 918
 								}
908
-								if ( $continue ) continue;
909 919
 							}
910 920
 
911 921
 							$field_id = $reference_field . '-' . $extra_field . '-content';
@@ -1610,7 +1620,9 @@  discard block
 block discarded – undo
1610 1620
 	protected function _set_shortcodes() {
1611 1621
 
1612 1622
 		//no need to run this if the property is already set
1613
-		if ( !empty($this->_shortcodes ) ) return;
1623
+		if ( !empty($this->_shortcodes ) ) {
1624
+			return;
1625
+		}
1614 1626
 
1615 1627
 		$this->_shortcodes = $this->_get_shortcodes();
1616 1628
 	}
@@ -1647,8 +1659,10 @@  discard block
 block discarded – undo
1647 1659
 	 */
1648 1660
 	protected function _set_message_template_group() {
1649 1661
 
1650
-		if ( !empty( $this->_message_template_group ) )
1651
-			return; //get out if this is already set.
1662
+		if ( !empty( $this->_message_template_group ) ) {
1663
+					return;
1664
+		}
1665
+		//get out if this is already set.
1652 1666
 
1653 1667
 		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;
1654 1668
 		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
@@ -1656,10 +1670,11 @@  discard block
 block discarded – undo
1656 1670
 		//let's get the message templates
1657 1671
 		$MTP = EEM_Message_Template_Group::instance();
1658 1672
 
1659
-		if ( empty($GRP_ID) )
1660
-			$this->_message_template_group = $MTP->create_default_object();
1661
-		else
1662
-			$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1673
+		if ( empty($GRP_ID) ) {
1674
+					$this->_message_template_group = $MTP->create_default_object();
1675
+		} else {
1676
+					$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1677
+		}
1663 1678
 
1664 1679
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1665 1680
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1686,7 +1701,9 @@  discard block
 block discarded – undo
1686 1701
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
1687 1702
 				<?php
1688 1703
 					foreach ( $args as $name => $value ) {
1689
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;
1704
+						if ( $name == 'context' || empty($value) || $name == 'extra' ) {
1705
+							continue;
1706
+						}
1690 1707
 						?>
1691 1708
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
1692 1709
 						<?php
@@ -1819,8 +1836,9 @@  discard block
 block discarded – undo
1819 1836
 
1820 1837
 					//setup notices
1821 1838
 					foreach ( $validates as $field => $error ) {
1822
-						if ( isset($error['msg'] ) )
1823
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1839
+						if ( isset($error['msg'] ) ) {
1840
+													EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1841
+						}
1824 1842
 					}
1825 1843
 
1826 1844
 				} else {
@@ -1966,8 +1984,9 @@  discard block
 block discarded – undo
1966 1984
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) {
1967 1985
 
1968 1986
 		//if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.
1969
-		if ( empty( $message_types ) )
1970
-			return true;
1987
+		if ( empty( $message_types ) ) {
1988
+					return true;
1989
+		}
1971 1990
 
1972 1991
 		EE_Registry::instance()->load_helper( 'MSG_Template' );
1973 1992
 
@@ -2087,8 +2106,9 @@  discard block
 block discarded – undo
2087 2106
 		//then delete permanently all the related Message Templates
2088 2107
 		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2089 2108
 
2090
-		if ( $deleted === 0 )
2091
-			$success = 0;
2109
+		if ( $deleted === 0 ) {
2110
+					$success = 0;
2111
+		}
2092 2112
 
2093 2113
 		//now delete permanently this particular group
2094 2114
 
@@ -2150,8 +2170,9 @@  discard block
 block discarded – undo
2150 2170
 	 */
2151 2171
 	protected function _set_m_mt_settings() {
2152 2172
 		//first if this is already set then lets get out no need to regenerate data.
2153
-		if ( !empty($this->_m_mt_settings) )
2154
-			return;
2173
+		if ( !empty($this->_m_mt_settings) ) {
2174
+					return;
2175
+		}
2155 2176
 
2156 2177
 		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2157 2178
 
@@ -2743,8 +2764,9 @@  discard block
 block discarded – undo
2743 2764
 					case 'message_types' :
2744 2765
 						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) {
2745 2766
 							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) {
2746
-								if ( isset( $settings['message_types'][$mt] ) )
2747
-									$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();
2767
+								if ( isset( $settings['message_types'][$mt] ) ) {
2768
+																	$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();
2769
+								}
2748 2770
 							}
2749 2771
 						} else {
2750 2772
 							foreach ( $value as $mt => $v ) {
@@ -2761,9 +2783,7 @@  discard block
 block discarded – undo
2761 2783
 				}
2762 2784
 			}
2763 2785
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2764
-		}
2765
-
2766
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2786
+		} else if ( $this->_req_data['type'] == 'message_type' ) {
2767 2787
 			$settings = $this->_req_data['message_type_settings'];
2768 2788
 			$messenger = $settings['messenger'];
2769 2789
 			$message_type = $settings['message_type'];
Please login to merge, or discard this patch.
Spacing   +504 added lines, -504 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('NO direct script access allowed');
3 3
 
4 4
 /**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @access public
74 74
 	 * @return void
75 75
 	 */
76
-	public function __construct( $routing = TRUE ) {
76
+	public function __construct($routing = TRUE) {
77 77
 		//make sure MSG Template helper is loaded.
78 78
 		EE_Registry::instance()->load_helper('MSG_Template');
79 79
 		//make sure messages autoloader is running
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 		$this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array();
96 96
 
97
-		$this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : NULL;
97
+		$this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : NULL;
98 98
 
99
-		EE_Registry::instance()->load_lib( 'messages' );
99
+		EE_Registry::instance()->load_lib('messages');
100 100
 		//we're also going to set the active messengers and active message types in here.
101 101
 		$this->_active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
102
-		$this->_active_messengers = !empty($this->_active_messengers) ?  $this->_active_messengers : array();
103
-		$this->_active_message_types = !empty($this->_active_messenger) && !empty($this->_active_messengers[$this->_active_messenger]) && ! empty(  $this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types'] ) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger . '-message_types']) : array();
102
+		$this->_active_messengers = ! empty($this->_active_messengers) ? $this->_active_messengers : array();
103
+		$this->_active_message_types = ! empty($this->_active_messenger) && ! empty($this->_active_messengers[$this->_active_messenger]) && ! empty($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) ? array_keys($this->_active_messengers[$this->_active_messenger]['settings'][$this->_active_messenger.'-message_types']) : array();
104 104
 
105 105
 
106 106
 		//what about saving the objects in the active_messengers and active_message_types?
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	 * @return void
119 119
 	 */
120 120
 	protected function _load_active_messenger_objects() {
121
-		foreach ( $this->_active_messengers as $messenger => $values ) {
122
-			$ref = ucwords( str_replace( '_' , ' ', $messenger) );
123
-			$ref = str_replace( ' ', '_', $ref );
124
-			$classname = 'EE_' . $ref . '_messenger';
125
-			require_once( EE_LIBRARIES . 'messages'. DS .'messenger' . DS . $classname . '.class.php' );
126
-			if ( !class_exists($classname) )
127
-				throw new EE_Error( sprintf( __('There is no messenger for the given classname (%s)', 'event_espresso'), $classname ) );
128
-
129
-			$a = new ReflectionClass( $classname );
121
+		foreach ($this->_active_messengers as $messenger => $values) {
122
+			$ref = ucwords(str_replace('_', ' ', $messenger));
123
+			$ref = str_replace(' ', '_', $ref);
124
+			$classname = 'EE_'.$ref.'_messenger';
125
+			require_once(EE_LIBRARIES.'messages'.DS.'messenger'.DS.$classname.'.class.php');
126
+			if ( ! class_exists($classname))
127
+				throw new EE_Error(sprintf(__('There is no messenger for the given classname (%s)', 'event_espresso'), $classname));
128
+
129
+			$a = new ReflectionClass($classname);
130 130
 			$this->_active_messengers[$messenger]['obj'] = $a->newInstance();
131 131
 		}
132 132
 	}
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
 	 * @return void
142 142
 	 */
143 143
 	protected function _load_active_message_type_objects() {
144
-		if ( empty($this->_active_message_types) ) return;
145
-		foreach ( $this->_active_message_types as $message_type ) {
146
-			$ref = ucwords( str_replace( '_' , ' ', $message_type) );
147
-			$ref = str_replace( ' ', '_', $ref );
148
-			$classname = 'EE_' . $ref . '_message_type';
144
+		if (empty($this->_active_message_types)) return;
145
+		foreach ($this->_active_message_types as $message_type) {
146
+			$ref = ucwords(str_replace('_', ' ', $message_type));
147
+			$ref = str_replace(' ', '_', $ref);
148
+			$classname = 'EE_'.$ref.'_message_type';
149 149
 
150
-			if ( !class_exists($classname) )
151
-				throw new EE_Error( sprintf( __('There is no message type for the given classname (%s)', 'event_espresso'), $classname ) );
150
+			if ( ! class_exists($classname))
151
+				throw new EE_Error(sprintf(__('There is no message type for the given classname (%s)', 'event_espresso'), $classname));
152 152
 
153
-			$a = new ReflectionClass( $classname );
153
+			$a = new ReflectionClass($classname);
154 154
 			$this->_active_message_types[$message_type]['obj'] = $a->newInstance();
155 155
 		}
156 156
 	}
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 
159 159
 
160 160
 	protected function _ajax_hooks() {
161
-		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) );
162
-		add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') );
163
-		add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') );
164
-		add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) );
165
-		add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) );
161
+		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle'));
162
+		add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle'));
163
+		add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings'));
164
+		add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form'));
165
+		add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack'));
166 166
 	}
167 167
 
168 168
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	*		@return void
195 195
 	*/
196 196
 	protected function _set_page_routes() {
197
-		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
198
-		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $grp_id;
197
+		$grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
198
+		$grp_id = empty($grp_id) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $grp_id;
199 199
 
200 200
 		$this->_page_routes = array(
201 201
 				'default'=> array(
@@ -231,35 +231,35 @@  discard block
 block discarded – undo
231 231
 				'insert_message_template' => array(
232 232
 					'func' => '_insert_or_update_message_template',
233 233
 					'capability' => 'ee_edit_messages',
234
-					'args' => array( 'new_template' => TRUE ),
234
+					'args' => array('new_template' => TRUE),
235 235
 					'noheader' => TRUE
236 236
 					 ),
237 237
 				'update_message_template' => array(
238 238
 					'func' => '_insert_or_update_message_template',
239 239
 					'capability' => 'ee_edit_message',
240 240
 					'obj_id' => $grp_id,
241
-					'args' => array( 'new_template' => FALSE ),
241
+					'args' => array('new_template' => FALSE),
242 242
 					'noheader' => TRUE
243 243
 					),
244 244
 				'trash_message_template' => array(
245 245
 					'func' => '_trash_or_restore_message_template',
246 246
 					'capability' => 'ee_delete_message',
247 247
 					'obj_id' => $grp_id,
248
-					'args' => array( 'trash' => TRUE, 'all' => TRUE ),
248
+					'args' => array('trash' => TRUE, 'all' => TRUE),
249 249
 					'noheader' => TRUE
250 250
 					),
251 251
 				'trash_message_template_context' => array(
252 252
 					'func' => '_trash_or_restore_message_template',
253 253
 					'capability' => 'ee_delete_message',
254 254
 					'obj_id' => $grp_id,
255
-					'args' => array( 'trash' => TRUE ),
255
+					'args' => array('trash' => TRUE),
256 256
 					'noheader' => TRUE
257 257
 					),
258 258
 				'restore_message_template' => array(
259 259
 					'func' => '_trash_or_restore_message_template',
260 260
 					'capability' => 'ee_delete_message',
261 261
 					'obj_id' => $grp_id,
262
-					'args' => array( 'trash' => FALSE, 'all' => TRUE ),
262
+					'args' => array('trash' => FALSE, 'all' => TRUE),
263 263
 					'noheader' => TRUE
264 264
 					),
265 265
 				'restore_message_template_context' => array(
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 						'filename' => 'messages_overview_other',
339 339
 					),
340 340
 				),
341
-				'help_tour' => array( 'Messages_Overview_Help_Tour' ),
341
+				'help_tour' => array('Messages_Overview_Help_Tour'),
342 342
 				'require_nonce' => FALSE
343 343
 				),
344 344
 			'custom_mtps' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 					),
374 374
 				'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'),
375 375
 				'has_metaboxes' => TRUE,
376
-				'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ),
376
+				'help_tour' => array('Message_Templates_Edit_Help_Tour'),
377 377
 				'help_tabs' => array(
378 378
 						'edit_message_template' => array(
379 379
 							'title' => __('Message Template Editor', 'event_espresso'),
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 							'filename' => 'messages_settings_messengers'
430 430
 							),
431 431
                     ),
432
-				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
432
+				'help_tour' => array('Messages_Settings_Help_Tour'),
433 433
 				'require_nonce' => FALSE
434 434
 				)
435 435
 			/*'reports' => array(
@@ -478,43 +478,43 @@  discard block
 block discarded – undo
478 478
 
479 479
 
480 480
 	public function messages_help_tab() {
481
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php';
482
-		EEH_Template::display_template( $templatepath, array());
481
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php';
482
+		EEH_Template::display_template($templatepath, array());
483 483
 	}
484 484
 
485 485
 
486 486
 	public function messengers_help_tab() {
487
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php';
488
-		EEH_Template::display_template( $templatepath, array());
487
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php';
488
+		EEH_Template::display_template($templatepath, array());
489 489
 	}
490 490
 
491 491
 
492 492
 	public function message_types_help_tab() {
493
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php';
494
-		EEH_Template::display_template( $templatepath, array());
493
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php';
494
+		EEH_Template::display_template($templatepath, array());
495 495
 	}
496 496
 
497 497
 
498 498
 	public function messages_overview_help_tab() {
499
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php';
500
-		EEH_Template::display_template( $templatepath, array());
499
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php';
500
+		EEH_Template::display_template($templatepath, array());
501 501
 	}
502 502
 
503 503
 
504 504
 	public function message_templates_help_tab() {
505
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php';
506
-		EEH_Template::display_template( $templatepath, array());
505
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php';
506
+		EEH_Template::display_template($templatepath, array());
507 507
 	}
508 508
 
509 509
 
510 510
 	public function edit_message_template_help_tab() {
511
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php';
512
-		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />';
513
-		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />';
514
-		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />';
515
-		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />';
516
-		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />';
517
-		EEH_Template::display_template( $templatepath, $args);
511
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php';
512
+		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />';
513
+		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />';
514
+		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />';
515
+		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />';
516
+		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />';
517
+		EEH_Template::display_template($templatepath, $args);
518 518
 	}
519 519
 
520 520
 
@@ -522,25 +522,25 @@  discard block
 block discarded – undo
522 522
 	public function message_template_shortcodes_help_tab() {
523 523
 		$this->_set_shortcodes();
524 524
 		$args['shortcodes'] = $this->_shortcodes;
525
-		$template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php';
526
-		EEH_Template::display_template( $template_path, $args );
525
+		$template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php';
526
+		EEH_Template::display_template($template_path, $args);
527 527
 	}
528 528
 
529 529
 
530 530
 
531 531
 	public function preview_message_help_tab() {
532
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php';
533
-		EEH_Template::display_template( $templatepath, array());
532
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php';
533
+		EEH_Template::display_template($templatepath, array());
534 534
 	}
535 535
 
536 536
 
537 537
 	public function settings_help_tab() {
538
-		$templatepath = EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php';
539
-		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />';
540
-		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />';
538
+		$templatepath = EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php';
539
+		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />';
540
+		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />';
541 541
 		$args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>';
542 542
 		$args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>';
543
-		EEH_Template::display_template( $templatepath, $args);
543
+		EEH_Template::display_template($templatepath, $args);
544 544
 	}
545 545
 
546 546
 
@@ -548,24 +548,24 @@  discard block
 block discarded – undo
548 548
 
549 549
 
550 550
 	public function load_scripts_styles() {
551
-		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION );
551
+		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION);
552 552
 		wp_enqueue_style('espresso_ee_msg');
553 553
 
554
-		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE );
554
+		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
555 555
 	}
556 556
 
557 557
 
558 558
 
559 559
 
560 560
 
561
-	public function wp_editor_css( $mce_css ) {
561
+	public function wp_editor_css($mce_css) {
562 562
 		//if we're on the edit_message_template route
563
-		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) {
563
+		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) {
564 564
 			$message_type_name = $this->_active_message_type_name;
565 565
 
566 566
 			//we're going to REPLACE the existing mce css
567 567
 			//we need to get the css file location from the active messenger
568
-			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation );
568
+			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'wpeditor', $this->_variation);
569 569
 		}
570 570
 
571 571
 		return $mce_css;
@@ -577,39 +577,39 @@  discard block
 block discarded – undo
577 577
 	public function load_scripts_styles_edit_message_template() {
578 578
 		;
579 579
 		$this->_set_shortcodes();
580
-		EE_Registry::$i18n_js_strings['confirm_default_reset'] = sprintf( __('Are you sure you want to reset the %s %s message templates?  Remember continuing will reset the templates for all contexts in this messenger and message type group.', 'event_espresso'), $this->_message_template_group->messenger_obj()->label['singular'], $this->_message_template_group->message_type_obj()->label['singular'] );
581
-		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' );
580
+		EE_Registry::$i18n_js_strings['confirm_default_reset'] = sprintf(__('Are you sure you want to reset the %s %s message templates?  Remember continuing will reset the templates for all contexts in this messenger and message type group.', 'event_espresso'), $this->_message_template_group->messenger_obj()->label['singular'], $this->_message_template_group->message_type_obj()->label['singular']);
581
+		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso');
582 582
 
583 583
 
584
-		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION );
584
+		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION);
585 585
 
586 586
 		wp_enqueue_script('ee_admin_js');
587 587
 		wp_enqueue_script('ee_msgs_edit_js');
588 588
 
589 589
 		//add in special css for tiny_mce
590
-		add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );
590
+		add_filter('mce_css', array($this, 'wp_editor_css'));
591 591
 	}
592 592
 
593 593
 
594 594
 
595 595
 	public function load_scripts_styles_display_preview_message() {
596 596
 		$this->_set_message_template_group();
597
-		if ( isset( $this->_req_data['messenger'] ) ) {
597
+		if (isset($this->_req_data['messenger'])) {
598 598
 			$this->_active_messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
599 599
 		}
600 600
 
601
-		$message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';
601
+		$message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';
602 602
 
603 603
 
604
-		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation ) );
604
+		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, TRUE, 'preview', $this->_variation));
605 605
 	}
606 606
 
607 607
 
608 608
 
609 609
 	public function load_scripts_styles_settings() {
610
-		wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );
611
-		wp_enqueue_style( 'ee-text-links' );
612
-		wp_enqueue_style( 'ee-message-settings' );
610
+		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION);
611
+		wp_enqueue_style('ee-text-links');
612
+		wp_enqueue_style('ee-message-settings');
613 613
 
614 614
 		wp_enqueue_script('ee-messages-settings');
615 615
 	}
@@ -645,9 +645,9 @@  discard block
 block discarded – undo
645 645
 
646 646
 	protected function _custom_mtps_preview() {
647 647
 		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso');
648
-		$this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />';
648
+		$this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />';
649 649
 		$this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso.  With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>';
650
-		$this->display_admin_caf_preview_page( 'custom_message_types', FALSE );
650
+		$this->display_admin_caf_preview_page('custom_message_types', FALSE);
651 651
 	}
652 652
 
653 653
 
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 	 * @param bool $global whether to return just global (true) or custom templates (false)
670 670
 	 * @return array|WP_Error object
671 671
 	 */
672
-	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE ) {
672
+	public function get_message_templates($perpage = 10, $type = 'in_use', $count = FALSE, $all = FALSE, $global = TRUE) {
673 673
 		global $espresso_wp_user;
674 674
 		// start with an empty array
675 675
 		$message_templates = array();
@@ -679,24 +679,24 @@  discard block
 block discarded – undo
679 679
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];
680 680
 		$orderby = $this->_req_data['orderby'];
681 681
 
682
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';
682
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
683 683
 
684
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
685
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;
684
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
685
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;
686 686
 
687
-		$offset = ($current_page-1)*$per_page;
688
-		$limit = $all ? NULL : array( $offset, $per_page );
687
+		$offset = ($current_page - 1) * $per_page;
688
+		$limit = $all ? NULL : array($offset, $per_page);
689 689
 
690 690
 
691 691
 		//options will match what is in the _views array property
692
-		switch( $type ) {
692
+		switch ($type) {
693 693
 
694 694
 			case 'in_use':
695
-				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE );
695
+				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, TRUE);
696 696
 				break;
697 697
 
698 698
 			default:
699
-				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );
699
+				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);
700 700
 
701 701
 		}
702 702
 
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 		$imts = $installed_objects['message_types'];
733 733
 		$installed = array();
734 734
 
735
-		foreach ( $imts as $message_type ) {
735
+		foreach ($imts as $message_type) {
736 736
 			$installed[$message_type->name]['obj'] = $message_type;
737 737
 		}
738 738
 
@@ -764,24 +764,24 @@  discard block
 block discarded – undo
764 764
 	 * @access  protected
765 765
 	 * @return void
766 766
 	 */
767
-	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) {
767
+	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') {
768 768
 		//set values override any request data
769
-		$message_type = !empty( $message_type ) ? $message_type : '';
770
-		$message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;
769
+		$message_type = ! empty($message_type) ? $message_type : '';
770
+		$message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;
771 771
 
772
-		$messenger = !empty( $messenger ) ? $messenger : '';
773
-		$messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;
772
+		$messenger = ! empty($messenger) ? $messenger : '';
773
+		$messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;
774 774
 
775
-		$GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';
776
-		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
775
+		$GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';
776
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;
777 777
 
778 778
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
779
-		if ( empty( $message_type ) || empty( $messenger )  )
779
+		if (empty($message_type) || empty($messenger))
780 780
 			throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));
781 781
 
782 782
 		//we need the GRP_ID for the template being used as the base for the new template
783
-		if ( empty( $GRP_ID ) )
784
-			throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );
783
+		if (empty($GRP_ID))
784
+			throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso'));
785 785
 
786 786
 		//let's just make sure the template gets generated!
787 787
 
@@ -800,8 +800,8 @@  discard block
 block discarded – undo
800 800
 	 * @param string $messenger    messenger slug
801 801
 	 * @param int      $GRP_ID         GRP_ID for the related message template group this new template will be based off of.
802 802
 	 */
803
-	public function add_message_template( $message_type, $messenger, $GRP_ID ) {
804
-		$this->_add_message_template( $message_type, $messenger, $GRP_ID );
803
+	public function add_message_template($message_type, $messenger, $GRP_ID) {
804
+		$this->_add_message_template($message_type, $messenger, $GRP_ID);
805 805
 	}
806 806
 
807 807
 
@@ -812,36 +812,36 @@  discard block
 block discarded – undo
812 812
 	 * @return void
813 813
 	 */
814 814
 	protected function _edit_message_template() {
815
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');
815
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
816 816
 
817 817
 		//we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.
818
-		add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );
818
+		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2);
819 819
 
820
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
820
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
821 821
 
822 822
 		$this->_set_shortcodes(); //this also sets the _message_template property.
823 823
 		$message_template_group = $this->_message_template_group;
824 824
 		$c_label = $message_template_group->context_label();
825 825
 		$c_config = $message_template_group->contexts_config();
826 826
 
827
-		reset( $c_config );
828
-		$context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) ? strtolower($this->_req_data['context']) : key($c_config);
827
+		reset($c_config);
828
+		$context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) ? strtolower($this->_req_data['context']) : key($c_config);
829 829
 
830 830
 
831
-		if ( empty($GRP_ID) ) {
831
+		if (empty($GRP_ID)) {
832 832
 			$action = 'insert_message_template';
833 833
 			$button_both = FALSE;
834
-			$button_text = array( __( 'Save','event_espresso') );
834
+			$button_text = array(__('Save', 'event_espresso'));
835 835
 			$button_actions = array('something_different');
836 836
 			$referrer = FALSE;
837
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
837
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
838 838
 		} else {
839 839
 			$action = 'update_message_template';
840 840
 			$button_both = TRUE;
841 841
 			$button_text = array();
842 842
 			$button_actions = array();
843 843
 			$referrer = $this->_admin_base_url;
844
-			$edit_message_template_form_url = add_query_arg( array( 'action' => $action, 'noheader' => TRUE ), EE_MSG_ADMIN_URL );
844
+			$edit_message_template_form_url = add_query_arg(array('action' => $action, 'noheader' => TRUE), EE_MSG_ADMIN_URL);
845 845
 		}
846 846
 
847 847
 		//set active messenger for this view
@@ -851,13 +851,13 @@  discard block
 block discarded – undo
851 851
 
852 852
 		//Do we have any validation errors?
853 853
 		$validators = $this->_get_transient();
854
-		$v_fields = !empty($validators) ? array_keys($validators) : array();
854
+		$v_fields = ! empty($validators) ? array_keys($validators) : array();
855 855
 
856 856
 
857 857
 		//we need to assemble the title from Various details
858
-		$context_label = sprintf( __('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label'] ));
858
+		$context_label = sprintf(__('(%s %s)', 'event_espresso'), $c_config[$context]['label'], ucwords($c_label['label']));
859 859
 
860
-		$title = sprintf( __(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label );
860
+		$title = sprintf(__(' %s %s Template %s', 'event_espresso'), ucwords($message_template_group->messenger_obj()->label['singular']), ucwords($message_template_group->message_type_obj()->label['singular']), $context_label);
861 861
 
862 862
 		$this->_template_args['GRP_ID'] = $GRP_ID;
863 863
 		$this->_template_args['message_template'] = $message_template_group;
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
 		$MSG = new EE_messages();
869 869
 		$template_field_structure = $MSG->get_fields($message_template_group->messenger(), $message_template_group->message_type());
870 870
 
871
-		if ( !$template_field_structure ) {
871
+		if ( ! $template_field_structure) {
872 872
 			$template_field_structure = FALSE;
873 873
 			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso');
874 874
 		}
@@ -878,38 +878,38 @@  discard block
 block discarded – undo
878 878
 
879 879
 
880 880
 		//if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array.
881
-		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) {
882
-			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) {
883
-				unset( $template_field_structure[$context][$reference_field] );
881
+		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) {
882
+			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) {
883
+				unset($template_field_structure[$context][$reference_field]);
884 884
 			}
885 885
 		}
886 886
 
887 887
 		//let's loop through the template_field_structure and actually assemble the input fields!
888
-		if ( !empty($template_field_structure) ) {
889
-			$id_prefix= 'ee-msg-edit-template-fields-';
890
-			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) {
888
+		if ( ! empty($template_field_structure)) {
889
+			$id_prefix = 'ee-msg-edit-template-fields-';
890
+			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) {
891 891
 				//if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them.
892
-				if ( $template_field == 'extra' ) {
892
+				if ($template_field == 'extra') {
893 893
 					$this->_template_args['is_extra_fields'] = TRUE;
894
-					foreach ( $field_setup_array as $reference_field => $new_fields_array ) {
895
-						foreach ( $new_fields_array as $extra_field =>  $extra_array ) {
894
+					foreach ($field_setup_array as $reference_field => $new_fields_array) {
895
+						foreach ($new_fields_array as $extra_field =>  $extra_array) {
896 896
 							//let's verify if we need this extra field via the shortcodes parameter.
897 897
 							$continue = FALSE;
898
-							if ( isset( $extra_array['shortcodes_required'] ) ) {
899
-								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
900
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
898
+							if (isset($extra_array['shortcodes_required'])) {
899
+								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) {
900
+									if ( ! array_key_exists($shortcode, $this->_shortcodes))
901 901
 										$continue = TRUE;
902 902
 								}
903
-								if ( $continue ) continue;
903
+								if ($continue) continue;
904 904
 							}
905 905
 
906
-							$field_id = $reference_field . '-' . $extra_field . '-content';
906
+							$field_id = $reference_field.'-'.$extra_field.'-content';
907 907
 							$template_form_fields[$field_id] = $extra_array;
908
-							$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';
909
-							$css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';
910
-							$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array($extra_field, $v_fields) && ( is_array($validators[$extra_field] ) && isset( $validators[$extra_field]['msg'] ) ) ? 'validate-error ' . $css_class : $css_class;
908
+							$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';
909
+							$css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';
910
+							$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($extra_field, $v_fields) && (is_array($validators[$extra_field]) && isset($validators[$extra_field]['msg'])) ? 'validate-error '.$css_class : $css_class;
911 911
 							$content = $message_templates[$context][$reference_field]->get('MTP_content');
912
-							$template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) : '';
912
+							$template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) : '';
913 913
 
914 914
 							//do we have a validation error?  if we do then let's use that value instead
915 915
 							$template_form_fields[$field_id]['value'] = isset($validators[$extra_field]) ? $validators[$extra_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -917,30 +917,30 @@  discard block
 block discarded – undo
917 917
 
918 918
 							$template_form_fields[$field_id]['db-col'] = 'MTP_content';
919 919
 
920
-							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) {
920
+							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') {
921 921
 								//we want to decode the entities
922
-								$template_form_fields[$field_id]['value'] = stripslashes( html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") );
922
+								$template_form_fields[$field_id]['value'] = stripslashes(html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8"));
923 923
 
924 924
 							}/**/
925 925
 						}
926
-						$templatefield_MTP_id = $reference_field . '-MTP_ID';
927
-						$templatefield_templatename_id = $reference_field . '-name';
926
+						$templatefield_MTP_id = $reference_field.'-MTP_ID';
927
+						$templatefield_templatename_id = $reference_field.'-name';
928 928
 
929 929
 						$template_form_fields[$templatefield_MTP_id] = array(
930
-							'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',
930
+							'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',
931 931
 							'label' => NULL,
932 932
 							'input' => 'hidden',
933 933
 							'type' => 'int',
934 934
 							'required' => FALSE,
935 935
 							'validation' => FALSE,
936
-							'value' => !empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
936
+							'value' => ! empty($message_templates) ? $message_templates[$context][$reference_field]->ID() : '',
937 937
 							'css_class' => '',
938 938
 							'format' => '%d',
939 939
 							'db-col' => 'MTP_ID'
940 940
 						);
941 941
 
942 942
 						$template_form_fields[$templatefield_templatename_id] = array(
943
-							'name' => 'MTP_template_fields[' . $reference_field . '][name]',
943
+							'name' => 'MTP_template_fields['.$reference_field.'][name]',
944 944
 							'label' => NULL,
945 945
 							'input' => 'hidden',
946 946
 							'type' => 'string',
@@ -954,10 +954,10 @@  discard block
 block discarded – undo
954 954
 					}
955 955
 					continue; //skip the next stuff, we got the necessary fields here for this dataset.
956 956
 				} else {
957
-					$field_id = $template_field . '-content';
957
+					$field_id = $template_field.'-content';
958 958
 					$template_form_fields[$field_id] = $field_setup_array;
959
-					$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';
960
-					$template_form_fields[$field_id]['value'] = !empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ?$message_templates[$context][$template_field]->get('MTP_content') : '';
959
+					$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';
960
+					$template_form_fields[$field_id]['value'] = ! empty($message_templates) && is_array($message_templates[$context]) && isset($message_templates[$context][$template_field]) ? $message_templates[$context][$template_field]->get('MTP_content') : '';
961 961
 
962 962
 					//do we have a validator error for this field?  if we do then we'll use that value instead
963 963
 					$template_form_fields[$field_id]['value'] = isset($validators[$template_field]) ? $validators[$template_field]['value'] : $template_form_fields[$field_id]['value'];
@@ -965,9 +965,9 @@  discard block
 block discarded – undo
965 965
 
966 966
 					$template_form_fields[$field_id]['db-col'] = 'MTP_content';
967 967
 					$css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';
968
-					$template_form_fields[$field_id]['css_class'] = !empty( $v_fields ) && in_array( $template_field, $v_fields ) && isset( $validators[$template_field]['msg'] ) ? 'validate-error ' . $css_class : $css_class;
968
+					$template_form_fields[$field_id]['css_class'] = ! empty($v_fields) && in_array($template_field, $v_fields) && isset($validators[$template_field]['msg']) ? 'validate-error '.$css_class : $css_class;
969 969
 
970
-					if ( isset( $field_setup_array['input'] ) && $field_setup_array['input'] == 'wp_editor' ) {
970
+					if (isset($field_setup_array['input']) && $field_setup_array['input'] == 'wp_editor') {
971 971
 						//we want to decode the entities
972 972
 						$template_form_fields[$field_id]['value'] = $template_form_fields[$field_id]['value'];
973 973
 					}/**/
@@ -975,25 +975,25 @@  discard block
 block discarded – undo
975 975
 
976 976
 				//k took care of content field(s) now let's take care of others.
977 977
 
978
-				$templatefield_MTP_id = $template_field . '-MTP_ID';
979
-				$templatefield_field_templatename_id = $template_field . '-name';
978
+				$templatefield_MTP_id = $template_field.'-MTP_ID';
979
+				$templatefield_field_templatename_id = $template_field.'-name';
980 980
 
981 981
 				//foreach template field there are actually two form fields created
982 982
 				$template_form_fields[$templatefield_MTP_id] = array(
983
-					'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',
983
+					'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',
984 984
 					'label' => NULL,
985 985
 					'input' => 'hidden',
986 986
 					'type' => 'int',
987 987
 					'required' => FALSE,
988 988
 					'validation' => TRUE,
989
-					'value' => !empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
989
+					'value' => ! empty($message_templates) ? $message_templates[$context][$template_field]->ID() : '',
990 990
 					'css_class' => '',
991 991
 					'format' => '%d',
992 992
 					'db-col' => 'MTP_ID'
993 993
 				);
994 994
 
995 995
 				$template_form_fields[$templatefield_field_templatename_id] = array(
996
-					'name' => 'MTP_template_fields[' . $template_field . '][name]',
996
+					'name' => 'MTP_template_fields['.$template_field.'][name]',
997 997
 					'label' => NULL,
998 998
 					'input' => 'hidden',
999 999
 					'type' => 'string',
@@ -1137,15 +1137,15 @@  discard block
 block discarded – undo
1137 1137
 				'value' => $GRP_ID
1138 1138
 				);
1139 1139
 			$sidebar_form_fields['ee-msg-evt-nonce'] = array(
1140
-				'name' => $action . '_nonce',
1140
+				'name' => $action.'_nonce',
1141 1141
 				'input' => 'hidden',
1142 1142
 				'type' => 'string',
1143
-				'value' => wp_create_nonce( $action . '_nonce')
1143
+				'value' => wp_create_nonce($action.'_nonce')
1144 1144
 				);
1145 1145
 
1146 1146
 			$sidebar_array = array('ee-msg-is-global', 'ee-msg-is-override', 'ee-msg-deleted', 'ee-msg-is-active');
1147 1147
 
1148
-			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) {
1148
+			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) {
1149 1149
 				$sidebar_form_fields['ee-msg-template-switch'] = array(
1150 1150
 					'name' => 'template_switch',
1151 1151
 					'input' => 'hidden',
@@ -1156,19 +1156,19 @@  discard block
 block discarded – undo
1156 1156
 
1157 1157
 			//send to field generator
1158 1158
 
1159
-			$template_fields = $this->_generate_admin_form_fields( $template_form_fields );
1160
-			$sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );
1159
+			$template_fields = $this->_generate_admin_form_fields($template_form_fields);
1160
+			$sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);
1161 1161
 
1162 1162
 
1163 1163
 		} //end if ( !empty($template_field_structure) )
1164 1164
 
1165 1165
 		//set extra content for publish box
1166 1166
 		$this->_template_args['publish_box_extra_content'] = $sidebar_fields;
1167
-		$this->_set_publish_post_box_vars( 'id', $GRP_ID );
1167
+		$this->_set_publish_post_box_vars('id', $GRP_ID);
1168 1168
 
1169 1169
 		//add preview button
1170
-		$preview_url = parent::add_query_args_and_nonce( array( 'message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context,'GRP_ID' => $GRP_ID, 'action' => 'preview_message' ), $this->_admin_base_url );
1171
-		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>';
1170
+		$preview_url = parent::add_query_args_and_nonce(array('message_type' => $message_template_group->message_type(), 'messenger' => $message_template_group->messenger(), 'context' => $context, 'GRP_ID' => $GRP_ID, 'action' => 'preview_message'), $this->_admin_base_url);
1171
+		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>';
1172 1172
 
1173 1173
 
1174 1174
 		//setup context switcher
@@ -1194,16 +1194,16 @@  discard block
 block discarded – undo
1194 1194
 		$this->_template_args['before_admin_page_content'] .= $this->_add_form_element_before();
1195 1195
 		$this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();
1196 1196
 
1197
-		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php';
1197
+		$this->_template_path = $this->_template_args['GRP_ID'] ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php';
1198 1198
 
1199 1199
 		//send along EE_Message_Template_Group object for further template use.
1200 1200
 		$this->_template_args['MTP'] = $message_template_group;
1201 1201
 
1202
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, TRUE );
1202
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
1203 1203
 
1204 1204
 
1205 1205
 		//finally, let's set the admin_page title
1206
-		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title );
1206
+		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title);
1207 1207
 
1208 1208
 
1209 1209
 		//we need to take care of setting the shortcodes property for use elsewhere.
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 	}
1217 1217
 
1218 1218
 
1219
-	public function filter_tinymce_init( $mceInit, $editor_id ) {
1219
+	public function filter_tinymce_init($mceInit, $editor_id) {
1220 1220
 		return $mceInit;
1221 1221
 	}
1222 1222
 
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 	}
1228 1228
 
1229 1229
 	public function _add_form_element_before() {
1230
-		return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';
1230
+		return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';
1231 1231
 	}
1232 1232
 
1233 1233
 	public function _add_form_element_after() {
@@ -1245,32 +1245,32 @@  discard block
 block discarded – undo
1245 1245
 	 * @return json json object
1246 1246
 	 */
1247 1247
 	public function switch_template_pack() {
1248
-		$GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1249
-		$template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';
1248
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1249
+		$template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';
1250 1250
 
1251 1251
 		//verify we have needed values.
1252
-		if ( empty( $GRP_ID ) || empty( $template_pack ) ) {
1252
+		if (empty($GRP_ID) || empty($template_pack)) {
1253 1253
 			$this->_template_args['error'] = TRUE;
1254
-			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
1254
+			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1255 1255
 		} else {
1256 1256
 			//get template, set the new template_pack and then reset to default
1257
-			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1257
+			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1258 1258
 
1259
-			$mtpg->set_template_pack_name( $template_pack );
1259
+			$mtpg->set_template_pack_name($template_pack);
1260 1260
 			$this->_req_data['msgr'] = $mtpg->messenger();
1261 1261
 			$this->_req_data['mt'] = $mtpg->message_type();
1262 1262
 
1263 1263
 			$query_args = $this->_reset_to_default_template();
1264 1264
 
1265
-			if ( empty( $query_args['id'] ) ) {
1266
-				EE_Error::add_error( __('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1265
+			if (empty($query_args['id'])) {
1266
+				EE_Error::add_error(__('Something went wrong with switching the template pack. Please try again or contact EE support', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1267 1267
 				$this->_template_args['error'] = TRUE;
1268 1268
 			} else {
1269
-				$template_label =$mtpg->get_template_pack()->label;
1269
+				$template_label = $mtpg->get_template_pack()->label;
1270 1270
 				$template_pack_labels = $mtpg->messenger_obj()->get_supports_labels();
1271
-				EE_Error::add_success( sprintf( __('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack ) );
1271
+				EE_Error::add_success(sprintf(__('This message template has been successfully switched to use the %s %s.  Please wait while the page reloads with your new template.', 'event_espresso'), $template_label, $template_pack_labels->template_pack));
1272 1272
 				//generate the redirect url for js.
1273
-				$url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1273
+				$url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1274 1274
 				$this->_template_args['data']['redirect_url'] = $url;
1275 1275
 				$this->_template_args['success'] = true;
1276 1276
 			}
@@ -1291,56 +1291,56 @@  discard block
 block discarded – undo
1291 1291
 	protected function _reset_to_default_template() {
1292 1292
 		$success = TRUE;
1293 1293
 		$templates = array();
1294
-		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1294
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1295 1295
 		//we need to make sure we've got the info we need.
1296
-		if ( !isset( $this->_req_data['msgr'] ) && !isset( $this->_req_data['mt'] ) && !isset( $this->_req_data['GRP_ID'] ) ) {
1297
-			EE_Error::add_error( __('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1296
+		if ( ! isset($this->_req_data['msgr']) && ! isset($this->_req_data['mt']) && ! isset($this->_req_data['GRP_ID'])) {
1297
+			EE_Error::add_error(__('In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1298 1298
 			$success = FALSE;
1299 1299
 		}
1300 1300
 
1301 1301
 		//all templates will be reset to whatever the defaults are for the global template matching the messenger and message type.
1302
-		$success = !empty( $GRP_ID ) ? TRUE : FALSE;
1302
+		$success = ! empty($GRP_ID) ? TRUE : FALSE;
1303 1303
 
1304
-		if ( $success ) {
1304
+		if ($success) {
1305 1305
 
1306 1306
 			//let's first determine if the incoming template is a global template, if it isn't then we need to get the global template matching messenger and message type.
1307
-			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1307
+			$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1308 1308
 
1309 1309
 
1310 1310
 			//note this is ONLY deleteing the template fields (Message Template rows) NOT the message template group.
1311
-			$success = $this->_delete_mtp_permanently( $GRP_ID, FALSE );
1311
+			$success = $this->_delete_mtp_permanently($GRP_ID, FALSE);
1312 1312
 
1313
-			if ( $success ) {
1313
+			if ($success) {
1314 1314
 				//if successfully deleted, lets generate the new ones.  Note. We set GLOBAL to true, because resets on ANY template will use the related global template defaults for regeneration.  This means that if a custom template is reset it resets to whatever the related global template is.  HOWEVER, we DO keep the template pack and template variation set for the current custom template when resetting.
1315
-				$templates = $this->_generate_new_templates( $this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE );
1315
+				$templates = $this->_generate_new_templates($this->_req_data['msgr'], $this->_req_data['mt'], $GRP_ID, TRUE);
1316 1316
 			}
1317 1317
 
1318 1318
 		}
1319 1319
 
1320 1320
 		//any error messages?
1321
-		if ( !$success ) {
1322
-			EE_Error::add_error( __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1321
+		if ( ! $success) {
1322
+			EE_Error::add_error(__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1323 1323
 		}
1324 1324
 
1325 1325
 		//all good, let's add a success message!
1326
-		if ( $success && ! empty( $templates ) ) {
1326
+		if ($success && ! empty($templates)) {
1327 1327
 			$templates = $templates[0]; //the info for the template we generated is the first element in the returned array.
1328 1328
 			EE_Error::overwrite_success();
1329
-			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') );
1329
+			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso'));
1330 1330
 		}
1331 1331
 
1332 1332
 
1333 1333
 		$query_args = array(
1334
-			'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : NULL,
1335
-			'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : NULL,
1336
-			'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'default'
1334
+			'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : NULL,
1335
+			'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : NULL,
1336
+			'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'default'
1337 1337
 			);
1338 1338
 
1339 1339
 		//if called via ajax then we return query args otherwise redirect
1340
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1340
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1341 1341
 			return $query_args;
1342 1342
 		} else {
1343
-			$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1343
+			$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1344 1344
 		}
1345 1345
 
1346 1346
 	}
@@ -1353,20 +1353,20 @@  discard block
 block discarded – undo
1353 1353
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1354 1354
 	 * @return void
1355 1355
 	 */
1356
-	public function _preview_message( $send = FALSE ) {
1356
+	public function _preview_message($send = FALSE) {
1357 1357
 		//first make sure we've got the necessary parameters
1358
-		if ( !isset( $this->_req_data['message_type'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['GRP_ID'] ) ) {
1359
-			EE_Error::add_error( __('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1358
+		if ( ! isset($this->_req_data['message_type']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['GRP_ID'])) {
1359
+			EE_Error::add_error(__('Missing necessary parameters for displaying preview', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1360 1360
 		}
1361 1361
 
1362
-		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1362
+		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
1363 1363
 
1364 1364
 		$MSG = new EE_messages();
1365 1365
 
1366 1366
 		//get the preview!
1367
-		$preview = $MSG->preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );
1367
+		$preview = $MSG->preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
1368 1368
 
1369
-		if ( $send ) {
1369
+		if ($send) {
1370 1370
 			return $preview;
1371 1371
 		}
1372 1372
 
@@ -1376,16 +1376,16 @@  discard block
 block discarded – undo
1376 1376
 			'context' => $this->_req_data['context'],
1377 1377
 			'action' => 'edit_message_template'
1378 1378
 			);
1379
-		$go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1380
-		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
1379
+		$go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1380
+		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>';
1381 1381
 
1382 1382
 		//let's provide a helpful title for context
1383
-		$preview_title = sprintf( __('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']) );
1383
+		$preview_title = sprintf(__('Viewing Preview for %s %s Message Template', 'event_espresso'), ucwords($this->_active_messengers[$this->_req_data['messenger']]['obj']->label['singular']), ucwords($this->_active_message_types[$this->_req_data['message_type']]['obj']->label['singular']));
1384 1384
 
1385 1385
 
1386 1386
 		//setup display of preview.
1387 1387
 		$this->_admin_page_title = $preview_title;
1388
-		$this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);
1388
+		$this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);
1389 1389
 		$this->_template_args['data']['force_json'] = TRUE;
1390 1390
 	}
1391 1391
 
@@ -1413,9 +1413,9 @@  discard block
 block discarded – undo
1413 1413
 	 * @return void
1414 1414
 	 */
1415 1415
 	protected function _register_edit_meta_boxes() {
1416
-		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' );
1417
-		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1418
-		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1416
+		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default');
1417
+		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high');
1418
+		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high');
1419 1419
 	}
1420 1420
 
1421 1421
 
@@ -1436,10 +1436,10 @@  discard block
 block discarded – undo
1436 1436
 
1437 1437
 		$tp_select_values = array();
1438 1438
 
1439
-		foreach ( $template_packs as $tp ) {
1439
+		foreach ($template_packs as $tp) {
1440 1440
 			//only include template packs that support this messenger and message type!
1441 1441
 			$supports = $tp->get_supports();
1442
-			if ( ! isset( $supports[$this->_message_template_group->messenger()] ) || ! in_array( $this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()] ) ) {
1442
+			if ( ! isset($supports[$this->_message_template_group->messenger()]) || ! in_array($this->_message_template_group->message_type(), $supports[$this->_message_template_group->messenger()])) {
1443 1443
 				//not supported
1444 1444
 				continue;
1445 1445
 			}
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
 		}
1452 1452
 
1453 1453
 		//if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack.  This still allows for the odd template pack to override.
1454
-		if ( empty( $tp_select_values ) ) {
1454
+		if (empty($tp_select_values)) {
1455 1455
 			$tp_select_values[] = array(
1456 1456
 				'text' => __('Default', 'event_espresso'),
1457 1457
 				'id' => 'default'
@@ -1459,27 +1459,27 @@  discard block
 block discarded – undo
1459 1459
 		}
1460 1460
 
1461 1461
 		//setup variation select values for the currently selected template.
1462
-		$variations = $this->_message_template_group->get_template_pack()->get_variations( $this->_message_template_group->messenger(), $this->_message_template_group->message_type() );
1462
+		$variations = $this->_message_template_group->get_template_pack()->get_variations($this->_message_template_group->messenger(), $this->_message_template_group->message_type());
1463 1463
 		$variations_select_values = array();
1464
-		foreach ( $variations as $variation => $label ) {
1464
+		foreach ($variations as $variation => $label) {
1465 1465
 			$variations_select_values[] = array(
1466 1466
 				'text' => $label,
1467 1467
 				'id' => $variation
1468 1468
 				);
1469 1469
 		}
1470 1470
 
1471
-		$template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();
1471
+		$template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();
1472 1472
 
1473
-		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input( 'MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name() );
1474
-		$template_args['variations_selector'] = EEH_Form_Fields::select_input( 'MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation() );
1473
+		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input('MTP_template_pack', $tp_select_values, $this->_message_template_group->get_template_pack_name());
1474
+		$template_args['variations_selector'] = EEH_Form_Fields::select_input('MTP_template_variation', $variations_select_values, $this->_message_template_group->get_template_pack_variation());
1475 1475
 		$template_args['template_pack_label'] = $template_pack_labels->template_pack;
1476 1476
 		$template_args['template_variation_label'] = $template_pack_labels->template_variation;
1477 1477
 		$template_args['template_pack_description'] = $template_pack_labels->template_pack_description;
1478 1478
 		$template_args['template_variation_description'] = $template_pack_labels->template_variation_description;
1479 1479
 
1480
-		$template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';
1480
+		$template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';
1481 1481
 
1482
-		EEH_Template::display_template( $template, $template_args );
1482
+		EEH_Template::display_template($template, $template_args);
1483 1483
 	}
1484 1484
 
1485 1485
 
@@ -1500,52 +1500,52 @@  discard block
 block discarded – undo
1500 1500
 			'GRP_ID' => $this->_message_template_group->GRP_ID()
1501 1501
 			);
1502 1502
 
1503
-		$button = $this->get_action_link_or_button( 'reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button' );
1503
+		$button = $this->get_action_link_or_button('reset_to_default', 'reset', $extra_args, 'button-primary reset-default-button');
1504 1504
 
1505 1505
 
1506 1506
 		//test button
1507 1507
 		//first we need to see if there are any fields
1508 1508
 		$fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();
1509 1509
 
1510
-		if ( !empty( $fields ) ) {
1510
+		if ( ! empty($fields)) {
1511 1511
 			//yup there be fields
1512
-			foreach ( $fields as $field => $config ) {
1513
-				$field_id = $this->_message_template_group->messenger() . '_' . $field;
1512
+			foreach ($fields as $field => $config) {
1513
+				$field_id = $this->_message_template_group->messenger().'_'.$field;
1514 1514
 				$existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();
1515
-				$default = isset( $config['default'] ) ? $config['default'] : '';
1516
-				$default = isset( $config['value'] ) ? $config['value'] : $default;
1515
+				$default = isset($config['default']) ? $config['default'] : '';
1516
+				$default = isset($config['value']) ? $config['value'] : $default;
1517 1517
 
1518 1518
 				//if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults
1519 1519
 				$fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : '';
1520
-				$existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix;
1520
+				$existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix;
1521 1521
 
1522 1522
 				$template_form_fields[$field_id] = array(
1523
-					'name' => 'test_settings_fld[' . $field . ']',
1523
+					'name' => 'test_settings_fld['.$field.']',
1524 1524
 					'label' => $config['label'],
1525 1525
 					'input' => $config['input'],
1526 1526
 					'type' => $config['type'],
1527 1527
 					'required' => $config['required'],
1528 1528
 					'validation' => $config['validation'],
1529
-					'value' => isset( $existing[$field] ) ? $existing[$field] : $default,
1529
+					'value' => isset($existing[$field]) ? $existing[$field] : $default,
1530 1530
 					'css_class' => $config['css_class'],
1531
-					'options' => isset( $config['options'] ) ? $config['options'] : array(),
1531
+					'options' => isset($config['options']) ? $config['options'] : array(),
1532 1532
 					'default' => $default,
1533 1533
 					'format' => $config['format']
1534 1534
 					);
1535 1535
 			}
1536 1536
 		}
1537 1537
 
1538
-		$test_settings_fields = !empty( $template_form_fields) ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) : '';
1538
+		$test_settings_fields = ! empty($template_form_fields) ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') : '';
1539 1539
 
1540 1540
 		$test_settings_html = '';
1541 1541
 		//print out $test_settings_fields
1542
-		if ( !empty( $test_settings_fields ) ) {
1542
+		if ( ! empty($test_settings_fields)) {
1543 1543
 			echo $test_settings_fields;
1544
-			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" />';
1544
+			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" />';
1545 1545
 		}
1546 1546
 
1547 1547
 		//and button
1548
-		echo $test_settings_html . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>';
1548
+		echo $test_settings_html.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>';
1549 1549
 	}
1550 1550
 
1551 1551
 
@@ -1559,15 +1559,15 @@  discard block
 block discarded – undo
1559 1559
 		$shortcodes = $this->_get_shortcodes(array(), FALSE); //just make sure shortcodes property is set
1560 1560
 		$messenger = $this->_message_template_group->messenger_obj();
1561 1561
 		//now let's set the content depending on the status of the shortcodes array
1562
-		if ( empty( $shortcodes ) ) {
1563
-			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>';
1562
+		if (empty($shortcodes)) {
1563
+			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>';
1564 1564
 			echo $content;
1565 1565
 		} else {
1566 1566
 			$alt = 0;
1567 1567
 			?>
1568
-			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php _e('This is a list of shortcodes that have been organized by content areas where they can be used: ', 'event_espresso' ); ?></p>
1568
+			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php _e('This is a list of shortcodes that have been organized by content areas where they can be used: ', 'event_espresso'); ?></p>
1569 1569
 
1570
-			<?php foreach ( $shortcodes as $field => $allshortcodes ) : ?>
1570
+			<?php foreach ($shortcodes as $field => $allshortcodes) : ?>
1571 1571
 				<?php
1572 1572
 				//get the field label
1573 1573
 				$field_label = $messenger->get_field_label($field);
@@ -1577,8 +1577,8 @@  discard block
 block discarded – undo
1577 1577
 					<div class="ee-shortcode-table-scroll">
1578 1578
 						<table class="widefat ee-shortcode-table">
1579 1579
 							<tbody>
1580
-					<?php foreach ( $allshortcodes as $code => $label ) : ?>
1581
-						<?php $alt_class = !($alt%2) ? 'class="alternate"' : ''; ?>
1580
+					<?php foreach ($allshortcodes as $code => $label) : ?>
1581
+						<?php $alt_class = ! ($alt % 2) ? 'class="alternate"' : ''; ?>
1582 1582
 						<tr <?php echo $alt_class; ?>>
1583 1583
 							<td><?php echo $code; ?></td>
1584 1584
 						</tr>
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 	protected function _set_shortcodes() {
1606 1606
 
1607 1607
 		//no need to run this if the property is already set
1608
-		if ( !empty($this->_shortcodes ) ) return;
1608
+		if ( ! empty($this->_shortcodes)) return;
1609 1609
 
1610 1610
 		$this->_shortcodes = $this->_get_shortcodes();
1611 1611
 	}
@@ -1622,14 +1622,14 @@  discard block
 block discarded – undo
1622 1622
 	 * @param  boolean $merged Whether to merge all the shortcodes into one list of unique shortcodes
1623 1623
 	 * @return array          Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true just an array of shortcode/label pairs.
1624 1624
 	 */
1625
-	protected function _get_shortcodes( $fields = array(), $merged = TRUE ) {
1625
+	protected function _get_shortcodes($fields = array(), $merged = TRUE) {
1626 1626
 		$this->_set_message_template_group();
1627 1627
 
1628 1628
 		//we need the messenger and message template to retrieve the valid shortcodes array.
1629
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
1630
-		$context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );
1629
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
1630
+		$context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());
1631 1631
 
1632
-		return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();
1632
+		return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();
1633 1633
 	}
1634 1634
 
1635 1635
 
@@ -1642,19 +1642,19 @@  discard block
 block discarded – undo
1642 1642
 	 */
1643 1643
 	protected function _set_message_template_group() {
1644 1644
 
1645
-		if ( !empty( $this->_message_template_group ) )
1645
+		if ( ! empty($this->_message_template_group))
1646 1646
 			return; //get out if this is already set.
1647 1647
 
1648
-		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : FALSE;
1649
-		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
1648
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : FALSE;
1649
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;
1650 1650
 
1651 1651
 		//let's get the message templates
1652 1652
 		$MTP = EEM_Message_Template_Group::instance();
1653 1653
 
1654
-		if ( empty($GRP_ID) )
1654
+		if (empty($GRP_ID))
1655 1655
 			$this->_message_template_group = $MTP->create_default_object();
1656 1656
 		else
1657
-			$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );
1657
+			$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID);
1658 1658
 
1659 1659
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
1660 1660
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -1680,26 +1680,26 @@  discard block
 block discarded – undo
1680 1680
 		<div class="ee-msg-switcher-container">
1681 1681
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
1682 1682
 				<?php
1683
-					foreach ( $args as $name => $value ) {
1684
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) continue;
1683
+					foreach ($args as $name => $value) {
1684
+						if ($name == 'context' || empty($value) || $name == 'extra') continue;
1685 1685
 						?>
1686 1686
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
1687 1687
 						<?php
1688 1688
 					}
1689 1689
 					//setup nonce_url
1690
-					wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);
1690
+					wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);
1691 1691
 				?>
1692 1692
 				<select name="context">
1693 1693
 					<?php
1694 1694
 					$context_templates = $template_group_object->context_templates();
1695
-					if ( is_array($context_templates) ) :
1696
-							foreach ( $context_templates as $context => $template_fields ) :
1695
+					if (is_array($context_templates)) :
1696
+							foreach ($context_templates as $context => $template_fields) :
1697 1697
 								$checked = ($context == $args['context']) ? 'selected="selected"' : '';
1698 1698
 					?>
1699 1699
 					<option value="<?php echo $context; ?>" <?php echo $checked; ?>><?php echo $context_details[$context]['label']; ?></option>
1700 1700
 					<?php endforeach; endif; ?>
1701 1701
 				</select>
1702
-				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?>
1702
+				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?>
1703 1703
 				<input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">
1704 1704
 			</form>
1705 1705
 			<?php echo $args['extra']; ?>
@@ -1723,8 +1723,8 @@  discard block
 block discarded – undo
1723 1723
 	 * @param int $index This helps us know which template field to select from the request array.
1724 1724
 	 */
1725 1725
 	protected function _set_message_template_column_values($index) {
1726
-		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) {
1727
-			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) {
1726
+		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) {
1727
+			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) {
1728 1728
 				$this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;
1729 1729
 			}
1730 1730
 		} else {
@@ -1756,27 +1756,27 @@  discard block
 block discarded – undo
1756 1756
 
1757 1757
 
1758 1758
 
1759
-	protected function _insert_or_update_message_template($new = FALSE ) {
1759
+	protected function _insert_or_update_message_template($new = FALSE) {
1760 1760
 
1761
-		do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');
1761
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1762 1762
 		$success = 0;
1763 1763
 		$override = FALSE;
1764 1764
 
1765 1765
 		//setup notices description
1766
-		$messenger = !empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'] ) ) : false;
1767
-		$message_type = !empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'] ) ) : false;
1768
-		$context = !empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'] ) ) : false;
1766
+		$messenger = ! empty($this->_req_data['MTP_messenger']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) : false;
1767
+		$message_type = ! empty($this->_req_data['MTP_message_type']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) : false;
1768
+		$context = ! empty($this->_req_data['MTP_context']) ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) : false;
1769 1769
 
1770
-		$item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';
1770
+		$item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';
1771 1771
 		$item_desc .= 'Message Template';
1772 1772
 		$query_args = array();
1773 1773
 		$validates = '';
1774 1774
 
1775 1775
 		//if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.
1776
-		if ( $new ) {
1777
-			$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1778
-			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) {
1779
-				if ( empty($edit_array) ) {
1776
+		if ($new) {
1777
+			$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1778
+			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) {
1779
+				if (empty($edit_array)) {
1780 1780
 					$success = 0;
1781 1781
 				} else {
1782 1782
 					$success = 1;
@@ -1795,34 +1795,34 @@  discard block
 block discarded – undo
1795 1795
 
1796 1796
 
1797 1797
 			//run update for each template field in displayed context
1798
-			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) {
1799
-				EE_Error::add_error( __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1798
+			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) {
1799
+				EE_Error::add_error(__('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1800 1800
 				$success = 0;
1801 1801
 				$action_desc = '';
1802 1802
 
1803 1803
 			} else {
1804 1804
 				//first validate all fields!
1805
-				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1805
+				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1806 1806
 
1807 1807
 				//if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array.  WE need to make sure there is no actual error messages in validates.
1808
-				if ( is_array($validates) && !empty($validates) ) {
1808
+				if (is_array($validates) && ! empty($validates)) {
1809 1809
 					//add the transient so when the form loads we know which fields to highlight
1810
-					$this->_add_transient( 'edit_message_template', $validates );
1810
+					$this->_add_transient('edit_message_template', $validates);
1811 1811
 
1812 1812
 					$success = 0;
1813
-					$action_desc ='';
1813
+					$action_desc = '';
1814 1814
 
1815 1815
 					//setup notices
1816
-					foreach ( $validates as $field => $error ) {
1817
-						if ( isset($error['msg'] ) )
1818
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
1816
+					foreach ($validates as $field => $error) {
1817
+						if (isset($error['msg']))
1818
+							EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__);
1819 1819
 					}
1820 1820
 
1821 1821
 				} else {
1822
-					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) {
1822
+					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) {
1823 1823
 						$set_column_values = $this->_set_message_template_column_values($template_field);
1824 1824
 
1825
-						$where_cols_n_values = array( 'MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1825
+						$where_cols_n_values = array('MTP_ID' => $this->_req_data['MTP_template_fields'][$template_field]['MTP_ID']);
1826 1826
 
1827 1827
 						$message_template_fields = array(
1828 1828
 							'GRP_ID' => $set_column_values['GRP_ID'],
@@ -1830,10 +1830,10 @@  discard block
 block discarded – undo
1830 1830
 							'MTP_context' => $set_column_values['MTP_context'],
1831 1831
 							'MTP_content' => $set_column_values['MTP_content']
1832 1832
 							);
1833
-						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) {
1834
-							if ( $updated === FALSE ) {
1835
-								$msg = sprintf( __('%s field was NOT updated for some reason', 'event_espresso'), $template_field );
1836
-								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1833
+						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) {
1834
+							if ($updated === FALSE) {
1835
+								$msg = sprintf(__('%s field was NOT updated for some reason', 'event_espresso'), $template_field);
1836
+								EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1837 1837
 							} else {
1838 1838
 								$success = 1;
1839 1839
 							}
@@ -1850,24 +1850,24 @@  discard block
 block discarded – undo
1850 1850
 						'MTP_is_override' => $set_column_values['MTP_is_override'],
1851 1851
 						'MTP_deleted' => $set_column_values['MTP_deleted'],
1852 1852
 						'MTP_is_active' => $set_column_values['MTP_is_active'],
1853
-						'MTP_name' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_name'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1854
-						'MTP_description' => !empty( $this->_req_data['ee_msg_non_global_fields']['MTP_description'] ) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1853
+						'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] : '',
1854
+						'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] : ''
1855 1855
 						);
1856 1856
 
1857
-					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] );
1858
-					$updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );
1857
+					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']);
1858
+					$updated = $MTPG->update($mtpg_fields, array($mtpg_where));
1859 1859
 
1860
-					if ( $updated === FALSE ) {
1861
-						$msg = sprintf( __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID'] );
1862
-						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__ );
1860
+					if ($updated === FALSE) {
1861
+						$msg = sprintf(__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), $set_column_values['GRP_ID']);
1862
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1863 1863
 					} else {
1864 1864
 						//k now we need to ensure the template_pack and template_variation fields are set.
1865
-						$template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) ? $this->_req_data['MTP_template_pack'] : 'default';
1866
-						$template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) ? $this->_req_data['MTP_template_variation'] : 'default';
1867
-						$mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );
1868
-						if ( $mtpg_obj instanceof EE_Message_Template_Group ) {
1869
-							$mtpg_obj->set_template_pack_name( $template_pack );
1870
-							$mtpg_obj->set_template_pack_variation( $template_variation );
1865
+						$template_pack = ! empty($this->_req_data['MTP_template_pack']) ? $this->_req_data['MTP_template_pack'] : 'default';
1866
+						$template_variation = ! empty($this->_req_data['MTP_template_variation']) ? $this->_req_data['MTP_template_variation'] : 'default';
1867
+						$mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);
1868
+						if ($mtpg_obj instanceof EE_Message_Template_Group) {
1869
+							$mtpg_obj->set_template_pack_name($template_pack);
1870
+							$mtpg_obj->set_template_pack_variation($template_variation);
1871 1871
 						}
1872 1872
 						$success = 1;
1873 1873
 					}
@@ -1877,7 +1877,7 @@  discard block
 block discarded – undo
1877 1877
 		}
1878 1878
 
1879 1879
 		//we return things differently if doing ajax
1880
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1880
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1881 1881
 			$this->_template_args['success'] = $success;
1882 1882
 			$this->_template_args['error'] = ! $success ? TRUE : FALSE;
1883 1883
 			$this->_template_args['content'] = '';
@@ -1885,9 +1885,9 @@  discard block
 block discarded – undo
1885 1885
 				'grpID' => $edit_array['GRP_ID'],
1886 1886
 				'templateName' => $edit_array['template_name']
1887 1887
 				);
1888
-			if ( $success ) {
1888
+			if ($success) {
1889 1889
 				EE_Error::overwrite_success();
1890
-				EE_Error::add_success( __('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso') );
1890
+				EE_Error::add_success(__('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso'));
1891 1891
 			}
1892 1892
 
1893 1893
 			$this->_return_json();
@@ -1895,13 +1895,13 @@  discard block
 block discarded – undo
1895 1895
 
1896 1896
 
1897 1897
 		//was a test send triggered?
1898
-		if ( isset( $this->_req_data['test_button'] ) ) {
1898
+		if (isset($this->_req_data['test_button'])) {
1899 1899
 			EE_Error::overwrite_success();
1900
-			$this->_do_test_send( $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );
1900
+			$this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
1901 1901
 			$override = TRUE;
1902 1902
 		}
1903 1903
 
1904
-		if ( empty( $query_args ) ) {
1904
+		if (empty($query_args)) {
1905 1905
 			$query_args = array(
1906 1906
 				'id' => $this->_req_data['GRP_ID'],
1907 1907
 				'context' => $this->_req_data['MTP_context'],
@@ -1909,7 +1909,7 @@  discard block
 block discarded – undo
1909 1909
 				);
1910 1910
 		}
1911 1911
 
1912
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );
1912
+		$this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);
1913 1913
 	}
1914 1914
 
1915 1915
 
@@ -1922,24 +1922,24 @@  discard block
 block discarded – undo
1922 1922
 	 * @param  string $message_type message type being tested
1923 1923
 	 * @return void
1924 1924
 	 */
1925
-	protected function _do_test_send( $context, $messenger, $message_type ) {
1925
+	protected function _do_test_send($context, $messenger, $message_type) {
1926 1926
 		//set things up for preview
1927 1927
 		$this->_req_data['messenger'] = $messenger;
1928 1928
 		$this->_req_data['message_type'] = $message_type;
1929 1929
 		$this->_req_data['context'] = $context;
1930
-		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';
1930
+		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';
1931 1931
 
1932 1932
 		//let's save any existing fields that might be required by the messenger
1933
-		if ( isset( $this->_req_data['test_settings_fld'] ) ) {
1934
-			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings( $this->_req_data['test_settings_fld'] );
1933
+		if (isset($this->_req_data['test_settings_fld'])) {
1934
+			$this->_active_messengers[$messenger]['obj']->set_existing_test_settings($this->_req_data['test_settings_fld']);
1935 1935
 		}
1936 1936
 
1937 1937
 		$success = $this->_preview_message(TRUE);
1938 1938
 
1939
-		if ( $success ) {
1940
-			EE_Error::add_success( __('Test message sent', 'event_espresso') );
1939
+		if ($success) {
1940
+			EE_Error::add_success(__('Test message sent', 'event_espresso'));
1941 1941
 		} else {
1942
-			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1942
+			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1943 1943
 		}
1944 1944
 	}
1945 1945
 
@@ -1961,12 +1961,12 @@  discard block
 block discarded – undo
1961 1961
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = FALSE) {
1962 1962
 
1963 1963
 		//if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.
1964
-		if ( empty( $message_types ) )
1964
+		if (empty($message_types))
1965 1965
 			return true;
1966 1966
 
1967
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1967
+		EE_Registry::instance()->load_helper('MSG_Template');
1968 1968
 
1969
-		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID,  $global);
1969
+		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);
1970 1970
 
1971 1971
 	}
1972 1972
 
@@ -1982,33 +1982,33 @@  discard block
 block discarded – undo
1982 1982
 	 * @param boolean $all whether this is going to trash/restore all contexts within a template group (TRUE) OR just an individual context (FALSE).
1983 1983
 	 * @return void
1984 1984
 	 */
1985
-	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE ) {
1986
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1985
+	protected function _trash_or_restore_message_template($trash = TRUE, $all = FALSE) {
1986
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1987 1987
 		$MTP = EEM_Message_Template_Group::instance();
1988 1988
 
1989 1989
 		$success = 1;
1990 1990
 
1991 1991
 		//incoming GRP_IDs
1992
-		if ( $all ) {
1992
+		if ($all) {
1993 1993
 			//Checkboxes
1994
-			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) {
1994
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1995 1995
 				//if array has more than one element then success message should be plural.
1996 1996
 				//todo: what about nonce?
1997
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1997
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1998 1998
 
1999 1999
 				//cycle through checkboxes
2000
-				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) {
2001
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2002
-					if ( ! $trashed_or_restored ) {
2000
+				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2001
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2002
+					if ( ! $trashed_or_restored) {
2003 2003
 						$success = 0;
2004 2004
 					}
2005 2005
 				}
2006 2006
 			} else {
2007 2007
 				//grab single GRP_ID and handle
2008
-				$GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
2009
-				if ( ! empty( $GRP_ID ) ) {
2010
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2011
-					if ( ! $trashed_or_restored ) {
2008
+				$GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
2009
+				if ( ! empty($GRP_ID)) {
2010
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2011
+					if ( ! $trashed_or_restored) {
2012 2012
 						$success = 0;
2013 2013
 					}
2014 2014
 				} else {
@@ -2020,13 +2020,13 @@  discard block
 block discarded – undo
2020 2020
 
2021 2021
 		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2022 2022
 
2023
-		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc;
2023
+		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc;
2024 2024
 
2025 2025
 		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso');
2026 2026
 
2027
-		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2027
+		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2028 2028
 
2029
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, array() );
2029
+		$this->_redirect_after_action($success, $item_desc, $action_desc, array());
2030 2030
 
2031 2031
 	}
2032 2032
 
@@ -2042,26 +2042,26 @@  discard block
 block discarded – undo
2042 2042
 	 * @return void
2043 2043
 	 */
2044 2044
 	protected function _delete_message_template() {
2045
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2045
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2046 2046
 
2047 2047
 		$success = 1;
2048 2048
 
2049 2049
 		//checkboxes
2050
-		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) {
2050
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2051 2051
 			//if array has more than one element then success message should be plural
2052
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2052
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2053 2053
 
2054 2054
 			//cycle through bulk action checkboxes
2055
-			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) {
2056
-				$success = $this->_delete_mtp_permanently( $GRP_ID );
2055
+			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2056
+				$success = $this->_delete_mtp_permanently($GRP_ID);
2057 2057
 			}
2058 2058
 		} else {
2059 2059
 			//grab single grp_id and delete
2060
-			$GRP_ID = absint($this->_req_data['id'] );
2061
-			$success = $this->_delete_mtp_permanently( $GRP_ID );
2060
+			$GRP_ID = absint($this->_req_data['id']);
2061
+			$success = $this->_delete_mtp_permanently($GRP_ID);
2062 2062
 		}
2063 2063
 
2064
-		$this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );
2064
+		$this->_redirect_after_action($success, 'Message Templates', 'deleted', array());
2065 2065
 
2066 2066
 	}
2067 2067
 
@@ -2074,20 +2074,20 @@  discard block
 block discarded – undo
2074 2074
 	 * @param  bool $include_group whether to delete the Message Template Group as well.
2075 2075
 	 * @return success        boolean to indicate the success of the deletes or not.
2076 2076
 	 */
2077
-	private function _delete_mtp_permanently( $GRP_ID, $include_group = TRUE ) {
2077
+	private function _delete_mtp_permanently($GRP_ID, $include_group = TRUE) {
2078 2078
 		$success = 1;
2079 2079
 		$MTPG = EEM_Message_Template_Group::instance();
2080 2080
 		//first let's GET this group
2081
-		$MTG = $MTPG->get_one_by_ID( $GRP_ID );
2081
+		$MTG = $MTPG->get_one_by_ID($GRP_ID);
2082 2082
 		//then delete permanently all the related Message Templates
2083
-		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2083
+		$deleted = $MTG->delete_related_permanently('Message_Template');
2084 2084
 
2085
-		if ( $deleted === 0 )
2085
+		if ($deleted === 0)
2086 2086
 			$success = 0;
2087 2087
 
2088 2088
 		//now delete permanently this particular group
2089 2089
 
2090
-		if ( $include_group && ! $MTG->delete_permanently() ) {
2090
+		if ($include_group && ! $MTG->delete_permanently()) {
2091 2091
 			$success = 0;
2092 2092
 		}
2093 2093
 		return $success;
@@ -2105,7 +2105,7 @@  discard block
 block discarded – undo
2105 2105
 	*	@return string
2106 2106
 	*/
2107 2107
 	protected function _learn_more_about_message_templates_link() {
2108
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2108
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>';
2109 2109
 	}
2110 2110
 
2111 2111
 
@@ -2119,14 +2119,14 @@  discard block
 block discarded – undo
2119 2119
 	 */
2120 2120
 	protected function _settings() {
2121 2121
 
2122
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
2122
+		EE_Registry::instance()->load_helper('Tabbed_Content');
2123 2123
 
2124 2124
 		$this->_set_m_mt_settings();
2125 2125
 
2126
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2126
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2127 2127
 
2128 2128
 		//let's setup the messenger tabs
2129
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );
2129
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);
2130 2130
 		$this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';
2131 2131
 		$this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';
2132 2132
 
@@ -2145,10 +2145,10 @@  discard block
 block discarded – undo
2145 2145
 	 */
2146 2146
 	protected function _set_m_mt_settings() {
2147 2147
 		//first if this is already set then lets get out no need to regenerate data.
2148
-		if ( !empty($this->_m_mt_settings) )
2148
+		if ( ! empty($this->_m_mt_settings))
2149 2149
 			return;
2150 2150
 
2151
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2151
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2152 2152
 
2153 2153
 		//get all installed messengers and message_types
2154 2154
 		$installed_message_objects = $this->_get_installed_message_objects();
@@ -2158,10 +2158,10 @@  discard block
 block discarded – undo
2158 2158
 
2159 2159
 		//assemble the array for the _tab_text_links helper
2160 2160
 
2161
-		foreach ( $messengers as $messenger ) {
2161
+		foreach ($messengers as $messenger) {
2162 2162
 			$this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(
2163 2163
 				'label' => ucwords($messenger->label['singular']),
2164
-				'class' => isset( $this->_active_messengers[$messenger->name] ) ? 'messenger-active' : '',
2164
+				'class' => isset($this->_active_messengers[$messenger->name]) ? 'messenger-active' : '',
2165 2165
 				'href' => $messenger->name,
2166 2166
 				'title' => __('Modify this Messenger', 'event_espresso'),
2167 2167
 				'slug' => $messenger->name,
@@ -2171,23 +2171,23 @@  discard block
 block discarded – undo
2171 2171
 			$message_types_for_messenger = $messenger->get_valid_message_types();
2172 2172
 
2173 2173
 			//assemble the array for the ACTIVE and INACTIVE message types with the selected messenger //note that all message types will be in the inactive box if the messenger is NOT active.
2174
-			$selected_settings = isset( $this->_active_messengers[$messenger->name]['settings'] ) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2175
-			foreach ( $message_types as $message_type ) {
2174
+			$selected_settings = isset($this->_active_messengers[$messenger->name]['settings']) ? $this->_active_messengers[$messenger->name]['settings'] : array();
2175
+			foreach ($message_types as $message_type) {
2176 2176
 				//first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox.
2177
-				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) {
2177
+				if ( ! in_array($message_type->name, $message_types_for_messenger)) {
2178 2178
 					continue;
2179 2179
 				}
2180 2180
 
2181
-				$a_or_i = isset( $selected_settings[$messenger->name . '-message_types'][$message_type->name] ) && $selected_settings[$messenger->name . '-message_types'][$message_type->name] ? 'active' : 'inactive';
2181
+				$a_or_i = isset($selected_settings[$messenger->name.'-message_types'][$message_type->name]) && $selected_settings[$messenger->name.'-message_types'][$message_type->name] ? 'active' : 'inactive';
2182 2182
 
2183 2183
 				$this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(
2184 2184
 						'label' => ucwords($message_type->label['singular']),
2185
-						'class' => 'message-type-' . $a_or_i,
2186
-						'slug_id' => $message_type->name . '-messagetype-' . $messenger->name,
2187
-						'mt_nonce' => wp_create_nonce($message_type->name . '_nonce'),
2188
-						'href' => 'espresso_' . $message_type->name . '_message_type_settings',
2185
+						'class' => 'message-type-'.$a_or_i,
2186
+						'slug_id' => $message_type->name.'-messagetype-'.$messenger->name,
2187
+						'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),
2188
+						'href' => 'espresso_'.$message_type->name.'_message_type_settings',
2189 2189
 						'title' => $a_or_i == 'active' ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') : __('Drag this message type to the messenger to activate', 'event_espresso'),
2190
-						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content( $message_type, $messenger, TRUE ) : $this->_message_type_settings_content( $message_type, $messenger ),
2190
+						'content' => $a_or_i == 'active' ? $this->_message_type_settings_content($message_type, $messenger, TRUE) : $this->_message_type_settings_content($message_type, $messenger),
2191 2191
 						'slug' => $message_type->name,
2192 2192
 						'active' => $a_or_i == 'active' ? TRUE : FALSE,
2193 2193
 						'obj' => $message_type
@@ -2204,34 +2204,34 @@  discard block
 block discarded – undo
2204 2204
 	 * @param  boolean $active       Whether the message type is active or not
2205 2205
 	 * @return string                html output for the content
2206 2206
 	 */
2207
-	protected function _message_type_settings_content( $message_type, $messenger, $active = FALSE ) {
2207
+	protected function _message_type_settings_content($message_type, $messenger, $active = FALSE) {
2208 2208
 		//get message type fields
2209 2209
 		$fields = $message_type->get_admin_settings_fields();
2210
-		$settings_template_args['template_form_fields']= '';
2210
+		$settings_template_args['template_form_fields'] = '';
2211 2211
 
2212
-		if ( !empty( $fields ) && $active ) {
2212
+		if ( ! empty($fields) && $active) {
2213 2213
 
2214
-			$existing_settings = $message_type->get_existing_admin_settings( $messenger->name );
2214
+			$existing_settings = $message_type->get_existing_admin_settings($messenger->name);
2215 2215
 
2216
-			foreach( $fields as $fldname => $fldprops ) {
2217
-				$field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;
2216
+			foreach ($fields as $fldname => $fldprops) {
2217
+				$field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;
2218 2218
 				$template_form_field[$field_id] = array(
2219
-					'name' => 'message_type_settings[' . $fldname . ']',
2219
+					'name' => 'message_type_settings['.$fldname.']',
2220 2220
 					'label' => $fldprops['label'],
2221 2221
 					'input' => $fldprops['field_type'],
2222 2222
 					'type' => $fldprops['value_type'],
2223 2223
 					'required' => $fldprops['required'],
2224 2224
 					'validation' => $fldprops['validation'],
2225
-					'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2226
-					'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),
2227
-					'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],
2225
+					'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2226
+					'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),
2227
+					'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2228 2228
 					'css_class' => 'no-drag',
2229 2229
 					'format' => $fldprops['format']
2230 2230
 					);
2231 2231
 			}
2232 2232
 
2233 2233
 
2234
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';
2234
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';
2235 2235
 		}
2236 2236
 
2237 2237
 		$settings_template_args['description'] = $message_type->description;
@@ -2251,13 +2251,13 @@  discard block
 block discarded – undo
2251 2251
 					)
2252 2252
 				);
2253 2253
 
2254
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2255
-		$settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';
2254
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2255
+		$settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';
2256 2256
 
2257 2257
 
2258 2258
 
2259
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';
2260
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE );
2259
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';
2260
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2261 2261
 		return $content;
2262 2262
 	}
2263 2263
 
@@ -2274,21 +2274,21 @@  discard block
 block discarded – undo
2274 2274
 		$m_boxes = $mt_boxes = array();
2275 2275
 		$m_template_args = $mt_template_args = array();
2276 2276
 
2277
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2277
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2278 2278
 
2279
-		foreach ( $this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array ) {
2279
+		foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) {
2280 2280
 
2281
-			$hide_on_message = isset( $this->_active_messengers[$messenger] ) ? '' : 'hidden';
2282
-			$hide_off_message = isset( $this->_active_messengers[$messenger] ) ? 'hidden' : '';
2281
+			$hide_on_message = isset($this->_active_messengers[$messenger]) ? '' : 'hidden';
2282
+			$hide_off_message = isset($this->_active_messengers[$messenger]) ? 'hidden' : '';
2283 2283
 
2284 2284
 			//messenger meta boxes
2285 2285
 			$active = $selected_messenger == $messenger ? TRUE : FALSE;
2286
-			$active_mt_tabs = isset(  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] ) ?  $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2287
-			$m_boxes[$messenger . '_a_box'] = sprintf( __('%s Settings', 'event_espresso'), $tab_array['label'] );
2288
-			$m_template_args[$messenger . '_a_box'] = array(
2289
-					'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2290
-					'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2291
-					'content' => $this->_get_messenger_box_content( $tab_array['obj'] ),
2286
+			$active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] : '';
2287
+			$m_boxes[$messenger.'_a_box'] = sprintf(__('%s Settings', 'event_espresso'), $tab_array['label']);
2288
+			$m_template_args[$messenger.'_a_box'] = array(
2289
+					'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2290
+					'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2291
+					'content' => $this->_get_messenger_box_content($tab_array['obj']),
2292 2292
 					'hidden' => $active ? '' : ' hidden',
2293 2293
 					'hide_on_message' => $hide_on_message,
2294 2294
 					'messenger' => $messenger,
@@ -2297,10 +2297,10 @@  discard block
 block discarded – undo
2297 2297
 
2298 2298
 
2299 2299
 			//message type meta boxes (which is really just the inactive container for each messenger showing inactive message types for that messenger)
2300
-			$mt_boxes[$messenger . '_i_box'] = __('Inactive Message Types', 'event_espresso');
2301
-			$mt_template_args[$messenger . '_i_box'] = array(
2302
-				'active_message_types' => !empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2303
-				'inactive_message_types' => isset( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) ? $this->_get_mt_tabs( $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'] ) : '',
2300
+			$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso');
2301
+			$mt_template_args[$messenger.'_i_box'] = array(
2302
+				'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2303
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) : '',
2304 2304
 				'hidden' => $active ? '' : ' hidden',
2305 2305
 				'hide_on_message' => $hide_on_message,
2306 2306
 				'hide_off_message' => $hide_off_message,
@@ -2310,19 +2310,19 @@  discard block
 block discarded – undo
2310 2310
 		}
2311 2311
 
2312 2312
 		//register messenger metaboxes
2313
-		$m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';
2314
-		foreach ( $m_boxes as $box => $label ) {
2315
-			$callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );
2316
-			$msgr = str_replace( '_a_box', '', $box );
2317
-			add_meta_box( 'espresso_' . $msgr . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args );
2313
+		$m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';
2314
+		foreach ($m_boxes as $box => $label) {
2315
+			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]);
2316
+			$msgr = str_replace('_a_box', '', $box);
2317
+			add_meta_box('espresso_'.$msgr.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args);
2318 2318
 		}
2319 2319
 
2320 2320
 		//register message type metaboxes
2321
-		$mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';
2322
-		foreach ( $mt_boxes as $box => $label ) {
2323
-			$callback_args = array( 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] );
2324
-			$mt = str_replace( '_i_box', '', $box );
2325
-			add_meta_box( 'espresso_' . $mt . '_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args );
2321
+		$mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';
2322
+		foreach ($mt_boxes as $box => $label) {
2323
+			$callback_args = array('template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]);
2324
+			$mt = str_replace('_i_box', '', $box);
2325
+			add_meta_box('espresso_'.$mt.'_inactive_mts', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'side', 'high', $callback_args);
2326 2326
 		}
2327 2327
 
2328 2328
 	}
@@ -2333,13 +2333,13 @@  discard block
 block discarded – undo
2333 2333
 	 * @param  array $tab_array  This is an array of message type tab details used to generate the tabs
2334 2334
 	 * @return string            html formatted tabs
2335 2335
 	 */
2336
-	protected function _get_mt_tabs( $tab_array ) {
2336
+	protected function _get_mt_tabs($tab_array) {
2337 2337
 		$tab_array = (array) $tab_array;
2338
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';
2338
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';
2339 2339
 		$tabs = '';
2340 2340
 
2341
-		foreach ( $tab_array as $tab ) {
2342
-			$tabs .=  EEH_Template::display_template( $template, $tab, TRUE );
2341
+		foreach ($tab_array as $tab) {
2342
+			$tabs .= EEH_Template::display_template($template, $tab, TRUE);
2343 2343
 		}
2344 2344
 
2345 2345
 		return $tabs;
@@ -2353,7 +2353,7 @@  discard block
 block discarded – undo
2353 2353
 	 * @param  object $messenger The messenger we're setting up content for
2354 2354
 	 * @return string            html formatted content
2355 2355
 	 */
2356
-	protected function _get_messenger_box_content( $messenger ) {
2356
+	protected function _get_messenger_box_content($messenger) {
2357 2357
 
2358 2358
 		$fields = $messenger->get_admin_settings_fields();
2359 2359
 		$settings_template_args['template_form_fields'] = '';
@@ -2362,27 +2362,27 @@  discard block
 block discarded – undo
2362 2362
 		$settings_template_args['active'] = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2363 2363
 
2364 2364
 
2365
-		if ( !empty( $fields ) ) {
2365
+		if ( ! empty($fields)) {
2366 2366
 
2367 2367
 			$existing_settings = $messenger->get_existing_admin_settings();
2368 2368
 
2369
-			foreach( $fields as $fldname => $fldprops ) {
2370
-				$field_id = $messenger->name . '-' . $fldname;
2369
+			foreach ($fields as $fldname => $fldprops) {
2370
+				$field_id = $messenger->name.'-'.$fldname;
2371 2371
 				$template_form_field[$field_id] = array(
2372
-					'name' => 'messenger_settings[' . $field_id . ']',
2372
+					'name' => 'messenger_settings['.$field_id.']',
2373 2373
 					'label' => $fldprops['label'],
2374 2374
 					'input' => $fldprops['field_type'],
2375 2375
 					'type' => $fldprops['value_type'],
2376 2376
 					'required' => $fldprops['required'],
2377 2377
 					'validation' => $fldprops['validation'],
2378
-					'value' => isset( $existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2378
+					'value' => isset($existing_settings[$field_id]) ? $existing_settings[$field_id] : $fldprops['default'],
2379 2379
 					'css_class' => '',
2380 2380
 					'format' => $fldprops['format']
2381 2381
 					);
2382 2382
 			}
2383 2383
 
2384 2384
 
2385
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) : '';
2385
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') : '';
2386 2386
 		}
2387 2387
 
2388 2388
 		//we also need some hidden fields
@@ -2398,8 +2398,8 @@  discard block
 block discarded – undo
2398 2398
 			);
2399 2399
 
2400 2400
 		//make sure any active message types that are existing are included in the hidden fields
2401
-		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) {
2402
-			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) {
2401
+		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
2402
+			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
2403 2403
 				$settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(
2404 2404
 						'type' => 'hidden',
2405 2405
 						'value' => $mt
@@ -2407,25 +2407,25 @@  discard block
 block discarded – undo
2407 2407
 			}
2408 2408
 		}
2409 2409
 
2410
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2410
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2411 2411
 
2412
-		$active = isset( $this->_active_messengers[$messenger->name] ) ? TRUE : FALSE;
2412
+		$active = isset($this->_active_messengers[$messenger->name]) ? TRUE : FALSE;
2413 2413
 
2414 2414
 		$settings_template_args['messenger'] = $messenger->name;
2415 2415
 		$settings_template_args['description'] = $messenger->description;
2416 2416
 		$settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
2417 2417
 
2418 2418
 
2419
-		$settings_template_args['show_hide_edit_form'] = isset( $this->_active_messengers[$messenger->name] ) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2419
+		$settings_template_args['show_hide_edit_form'] = isset($this->_active_messengers[$messenger->name]) ? $settings_template_args['show_hide_edit_form'] : ' hidden';
2420 2420
 
2421
-		$settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2421
+		$settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : $settings_template_args['show_hide_edit_form'];
2422 2422
 
2423 2423
 
2424 2424
 		$settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
2425
-		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
2425
+		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce');
2426 2426
 		$settings_template_args['on_off_status'] = $active ? true : false;
2427
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
2428
-		$content = EEH_Template::display_template( $template, $settings_template_args, TRUE);
2427
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';
2428
+		$content = EEH_Template::display_template($template, $settings_template_args, TRUE);
2429 2429
 		return $content;
2430 2430
 	}
2431 2431
 
@@ -2439,39 +2439,39 @@  discard block
 block discarded – undo
2439 2439
 	public function activate_messenger_toggle() {
2440 2440
 		$success = TRUE;
2441 2441
 		//let's check that we have required data
2442
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2443
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2442
+		if ( ! isset($this->_req_data['messenger'])) {
2443
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2444 2444
 			$success = FALSE;
2445 2445
 		}
2446 2446
 
2447 2447
 		//do a nonce check here since we're not arriving via a normal route
2448
-		$nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';
2449
-		$nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';
2448
+		$nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';
2449
+		$nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';
2450 2450
 
2451
-		$this->_verify_nonce( $nonce, $nonce_ref );
2451
+		$this->_verify_nonce($nonce, $nonce_ref);
2452 2452
 
2453 2453
 
2454 2454
 
2455
-		if ( !isset( $this->_req_data[ 'status' ])) {
2456
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2455
+		if ( ! isset($this->_req_data['status'])) {
2456
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2457 2457
 			$success = FALSE;
2458 2458
 		}
2459 2459
 
2460 2460
 		//do check to verify we have a valid status.
2461 2461
 		$status = $this->_req_data['status'];
2462 2462
 
2463
-		if ( $status != 'off' && $status != 'on' ) {
2464
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2463
+		if ($status != 'off' && $status != 'on') {
2464
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2465 2465
 			$success = FALSE;
2466 2466
 		}
2467 2467
 
2468
-		if ( $success ) {
2468
+		if ($success) {
2469 2469
 			//made it here?  Stop dawdling then!!
2470
-			if ( $status == 'off' ) {
2470
+			if ($status == 'off') {
2471 2471
 				//off = deactivate.  get it?
2472
-				$success = $this->_activate_messenger( $this->_req_data['messenger'], TRUE );
2472
+				$success = $this->_activate_messenger($this->_req_data['messenger'], TRUE);
2473 2473
 			} else {
2474
-				$success = $this->_activate_messenger( $this->_req_data['messenger'] );
2474
+				$success = $this->_activate_messenger($this->_req_data['messenger']);
2475 2475
 			}
2476 2476
 		}
2477 2477
 
@@ -2497,26 +2497,26 @@  discard block
 block discarded – undo
2497 2497
 
2498 2498
 
2499 2499
 		//let's make sure we have the necessary data
2500
-		if ( !isset( $this->_req_data[ 'message_type' ] ) ) {
2501
-			EE_Error::add_error( __('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2500
+		if ( ! isset($this->_req_data['message_type'])) {
2501
+			EE_Error::add_error(__('Message Type name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2502 2502
 			$success = FALSE;
2503 2503
 		}
2504 2504
 
2505 2505
 
2506 2506
 		//do a nonce check here since we're not arriving via a normal route
2507
-		$nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';
2508
-		$nonce_ref = $this->_req_data['message_type'] . '_nonce';
2507
+		$nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';
2508
+		$nonce_ref = $this->_req_data['message_type'].'_nonce';
2509 2509
 
2510
-		$this->_verify_nonce( $nonce, $nonce_ref );
2510
+		$this->_verify_nonce($nonce, $nonce_ref);
2511 2511
 
2512 2512
 
2513
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
2514
-			EE_Error::add_error( __('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2513
+		if ( ! isset($this->_req_data['messenger'])) {
2514
+			EE_Error::add_error(__('Messenger name needed to toggle activation. None given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2515 2515
 			$success = FALSE;
2516 2516
 		}
2517 2517
 
2518
-		if ( !isset( $this->_req_data[ 'status' ])) {
2519
-			EE_Error::add_error( __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2518
+		if ( ! isset($this->_req_data['status'])) {
2519
+			EE_Error::add_error(__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2520 2520
 			$success = FALSE;
2521 2521
 		}
2522 2522
 
@@ -2524,16 +2524,16 @@  discard block
 block discarded – undo
2524 2524
 		//do check to verify we have a valid status.
2525 2525
 		$status = $this->_req_data['status'];
2526 2526
 
2527
-		if ( $status != 'activate' && $status != 'deactivate' ) {
2528
-			EE_Error::add_error( sprintf( __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status'] ), __FILE__, __FUNCTION__, __LINE__ );
2527
+		if ($status != 'activate' && $status != 'deactivate') {
2528
+			EE_Error::add_error(sprintf(__('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), $this->_req_data['status']), __FILE__, __FUNCTION__, __LINE__);
2529 2529
 			$success = FALSE;
2530 2530
 		}
2531 2531
 
2532 2532
 
2533
-		if ( $success ) {
2533
+		if ($success) {
2534 2534
 			//made it here? um, what are you waiting for then?
2535 2535
 			$deactivate = $status == 'deactivate' ? TRUE : FALSE;
2536
-			$success = $this->_activate_messenger( $this->_req_data['messenger'], $deactivate, $this->_req_data['message_type'] );
2536
+			$success = $this->_activate_messenger($this->_req_data['messenger'], $deactivate, $this->_req_data['message_type']);
2537 2537
 		}
2538 2538
 
2539 2539
 		$this->_template_args['success'] = $success;
@@ -2560,28 +2560,28 @@  discard block
 block discarded – undo
2560 2560
 		$templates = TRUE;
2561 2561
 		$this->_set_m_mt_settings();
2562 2562
 
2563
-		if ( !$deactivate ) {
2563
+		if ( ! $deactivate) {
2564 2564
 
2565 2565
 
2566 2566
 			//we are activating.  we can use $this->_m_mt_settings to get all the installed messengers
2567
-			$this->_active_messengers[$messenger]['settings'] = !isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2567
+			$this->_active_messengers[$messenger]['settings'] = ! isset($this->_active_messengers[$messenger]['settings']) ? array() : $this->_active_messengers[$messenger]['settings'];
2568 2568
 			$this->_active_messengers[$messenger]['obj'] = $this->_m_mt_settings['messenger_tabs'][$messenger]['obj'];
2569 2569
 
2570 2570
 			//get has_active so we can sure its kept up to date.
2571
-			$has_activated = get_option( 'ee_has_activated_messages' );
2571
+			$has_activated = get_option('ee_has_activated_messages');
2572 2572
 
2573
-			if ( empty( $has_activated[$messenger] ) ) {
2573
+			if (empty($has_activated[$messenger])) {
2574 2574
 				$has_activated[$messenger] = array();
2575 2575
 			}
2576 2576
 
2577 2577
 			//k we need to get what default message types are to be associated with the messenger that's been activated.
2578 2578
 			$default_types = $message_type ? (array) $message_type : $this->_active_messengers[$messenger]['obj']->get_default_message_types();
2579 2579
 
2580
-			foreach ( $default_types as $type ) {
2580
+			foreach ($default_types as $type) {
2581 2581
 				$settings_fields = $this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$type]['obj']->get_admin_settings_fields();
2582
-				if ( !empty( $settings_fields ) ) {
2582
+				if ( ! empty($settings_fields)) {
2583 2583
 					//we have fields for this message type so let's get the defaults for saving.
2584
-					foreach ( $settings_fields as $field => $values ) {
2584
+					foreach ($settings_fields as $field => $values) {
2585 2585
 						$settings[$field] = $values['default'];
2586 2586
 					}
2587 2587
 					//let's set the data for reloading this message type form in ajax
@@ -2589,9 +2589,9 @@  discard block
 block discarded – undo
2589 2589
 				} else {
2590 2590
 					$settings = array();
2591 2591
 				}
2592
-				$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$type]['settings'] =  $settings;
2592
+				$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$type]['settings'] = $settings;
2593 2593
 
2594
-				if ( ! in_array( $type, $has_activated[$messenger] ) ) {
2594
+				if ( ! in_array($type, $has_activated[$messenger])) {
2595 2595
 					$has_activated[$messenger][] = $type;
2596 2596
 				}
2597 2597
 			}
@@ -2599,41 +2599,41 @@  discard block
 block discarded – undo
2599 2599
 			//any default settings for the messenger?
2600 2600
 			$msgr_settings = $this->_active_messengers[$messenger]['obj']->get_admin_settings_fields();
2601 2601
 
2602
-			if ( !empty( $msgr_settings ) ) {
2603
-				foreach ( $msgr_settings as $field => $value ) {
2602
+			if ( ! empty($msgr_settings)) {
2603
+				foreach ($msgr_settings as $field => $value) {
2604 2604
 					$this->_active_messengers[$messenger]['settings'][$field] = $value;
2605 2605
 				}
2606 2606
 			}
2607 2607
 
2608 2608
 			//update settings in database
2609
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2610
-			update_option( 'ee_has_activated_messages', $has_activated );
2609
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2610
+			update_option('ee_has_activated_messages', $has_activated);
2611 2611
 
2612 2612
 
2613 2613
 			//generate new templates (if necessary)
2614
-			$templates = $this->_generate_new_templates( $messenger, $default_types, 0, TRUE );
2614
+			$templates = $this->_generate_new_templates($messenger, $default_types, 0, TRUE);
2615 2615
 
2616 2616
 			EE_Error::overwrite_success();
2617 2617
 
2618 2618
 			//if generation failed then we need to remove the active messenger.
2619
-			if ( !$templates ) {
2619
+			if ( ! $templates) {
2620 2620
 				unset($this->_active_messengers[$messenger]);
2621
-				EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2621
+				EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2622 2622
 			} else {
2623 2623
 				//all is good let's do a success message
2624
-				if ( $message_type ) {
2625
-					EE_Error::add_success( sprintf( __('%s message type has been successfully activated with the %s messenger', 'event_espresso'),ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2624
+				if ($message_type) {
2625
+					EE_Error::add_success(sprintf(__('%s message type has been successfully activated with the %s messenger', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'][$message_type]['obj']->label['singular']), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2626 2626
 
2627 2627
 					//if message type was invoice then let's make sure we activate the invoice payment method.
2628
-					if ( $message_type == 'invoice' ) {
2629
-						EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2630
-						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
2631
-						if ( $pm instanceof EE_Payment_Method ) {
2632
-							EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) );
2628
+					if ($message_type == 'invoice') {
2629
+						EE_Registry::instance()->load_lib('Payment_Method_Manager');
2630
+						$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
2631
+						if ($pm instanceof EE_Payment_Method) {
2632
+							EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso'));
2633 2633
 						}
2634 2634
 					}
2635 2635
 				} else {
2636
-					EE_Error::add_success( sprintf( __('%s messenger has been successfully activated', 'event_espresso'), ucwords( $this->_active_messengers[$messenger]['obj']->label['singular'] ) ) );
2636
+					EE_Error::add_success(sprintf(__('%s messenger has been successfully activated', 'event_espresso'), ucwords($this->_active_messengers[$messenger]['obj']->label['singular'])));
2637 2637
 				}
2638 2638
 			}
2639 2639
 
@@ -2649,36 +2649,36 @@  discard block
 block discarded – undo
2649 2649
 			$update_array = array(
2650 2650
 				'MTP_messenger' => $messenger);
2651 2651
 
2652
-			if ( $message_type ) {
2652
+			if ($message_type) {
2653 2653
 				$update_array['MTP_message_type'] = $message_type;
2654 2654
 			}
2655 2655
 
2656
-			$success = $MTP->update( array( 'MTP_is_active' => 0 ), array($update_array) );
2656
+			$success = $MTP->update(array('MTP_is_active' => 0), array($update_array));
2657 2657
 
2658 2658
 			$messenger_obj = $this->_active_messengers[$messenger]['obj'];
2659 2659
 
2660 2660
 			//if this is a message type deactivation then we're only unsetting the message type otherwise unset the messenger
2661
-			if ( $message_type ) {
2662
-				unset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] );
2661
+			if ($message_type) {
2662
+				unset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type]);
2663 2663
 			} else {
2664
-				unset( $this->_active_messengers[$messenger] );
2664
+				unset($this->_active_messengers[$messenger]);
2665 2665
 			}
2666 2666
 
2667
-			EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2667
+			EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2668 2668
 			EE_Error::overwrite_success();
2669
-			if ( $message_type ) {
2670
-				EE_Error::add_success( sprintf( __('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular']) ) );
2669
+			if ($message_type) {
2670
+				EE_Error::add_success(sprintf(__('%s message type has been successfully deactivated', 'event_espresso'), ucwords($this->_m_mt_settings['message_type_tabs'][$messenger]['active'][$message_type]['obj']->label['singular'])));
2671 2671
 			} else {
2672
-				EE_Error::add_success( sprintf( __('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'] ) ) );
2672
+				EE_Error::add_success(sprintf(__('%s messenger has been successfully deactivated', 'event_espresso'), ucwords($messenger_obj->label['singular'])));
2673 2673
 			}
2674 2674
 
2675 2675
 			//if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.
2676
-			if ( $messenger == 'html'  || $message_type == 'invoice') {
2677
-				EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
2678
-				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );
2679
-				if ( $count_updated > 0 ) {
2680
-					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' );
2681
-					EE_Error::add_attention( $msg );
2676
+			if ($messenger == 'html' || $message_type == 'invoice') {
2677
+				EE_Registry::instance()->load_lib('Payment_Method_Manager');
2678
+				$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice');
2679
+				if ($count_updated > 0) {
2680
+					$msg = $message_type == 'invoice' ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then vist the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') : __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso');
2681
+					EE_Error::add_attention($msg);
2682 2682
 				}
2683 2683
 			}
2684 2684
 
@@ -2695,8 +2695,8 @@  discard block
 block discarded – undo
2695 2695
 	 * @return string html data
2696 2696
 	 */
2697 2697
 	public function update_mt_form() {
2698
-		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) {
2699
-			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ );
2698
+		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) {
2699
+			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__);
2700 2700
 			$this->_return_json();
2701 2701
 		}
2702 2702
 
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
 		$message_type = $message_types[$this->_req_data['message_type']]['obj'];
2706 2706
 		$messenger = $this->_active_messengers[$this->_req_data['messenger']]['obj'];
2707 2707
 
2708
-		$content = $this->_message_type_settings_content ( $message_type, $messenger, TRUE, TRUE );
2708
+		$content = $this->_message_type_settings_content($message_type, $messenger, TRUE, TRUE);
2709 2709
 		$this->_template_args['success'] = true;
2710 2710
 		$this->_template_args['content'] = $content;
2711 2711
 		$this->_return_json();
@@ -2719,36 +2719,36 @@  discard block
 block discarded – undo
2719 2719
 	 * @return json success or fail message
2720 2720
 	 */
2721 2721
 	public function save_settings() {
2722
-		if ( !isset( $this->_req_data['type'] ) ) {
2723
-			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2722
+		if ( ! isset($this->_req_data['type'])) {
2723
+			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2724 2724
 			$this->_template_args['error'] = TRUE;
2725 2725
 			$this->_return_json();
2726 2726
 		}
2727 2727
 
2728 2728
 
2729
-		if ( $this->_req_data['type'] == 'messenger' ) {
2729
+		if ($this->_req_data['type'] == 'messenger') {
2730 2730
 			$settings = $this->_req_data['messenger_settings']; //this should be an array.
2731 2731
 			$messenger = $settings['messenger'];
2732 2732
 			//let's setup the settings data
2733
-			foreach ( $settings as $key => $value ) {
2734
-				switch ( $key ) {
2733
+			foreach ($settings as $key => $value) {
2734
+				switch ($key) {
2735 2735
 					case 'messenger' :
2736
-						unset( $settings['messenger'] );
2736
+						unset($settings['messenger']);
2737 2737
 						break;
2738 2738
 					case 'message_types' :
2739
-						if ( isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] ) ) {
2740
-							foreach ( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'] as $mt => $v ) {
2741
-								if ( isset( $settings['message_types'][$mt] ) )
2742
-									$settings[$messenger . '-message_types'][$mt]['settings'] = isset( $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ? $this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] : array();
2739
+						if (isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'])) {
2740
+							foreach ($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'] as $mt => $v) {
2741
+								if (isset($settings['message_types'][$mt]))
2742
+									$settings[$messenger.'-message_types'][$mt]['settings'] = isset($this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) ? $this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt] : array();
2743 2743
 							}
2744 2744
 						} else {
2745
-							foreach ( $value as $mt => $v ) {
2745
+							foreach ($value as $mt => $v) {
2746 2746
 								//let's see if this message type is already present and has settings.
2747
-								$settings[$messenger . '-message_types'][$mt]['settings'] = array();
2747
+								$settings[$messenger.'-message_types'][$mt]['settings'] = array();
2748 2748
 							}
2749 2749
 						}
2750 2750
 						//k settings are set let's get rid of the message types index
2751
-						unset( $settings['message_types'] );
2751
+						unset($settings['message_types']);
2752 2752
 						break;
2753 2753
 					default :
2754 2754
 						$settings[$key] = $value;
@@ -2758,36 +2758,36 @@  discard block
 block discarded – undo
2758 2758
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2759 2759
 		}
2760 2760
 
2761
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2761
+		else if ($this->_req_data['type'] == 'message_type') {
2762 2762
 			$settings = $this->_req_data['message_type_settings'];
2763 2763
 			$messenger = $settings['messenger'];
2764 2764
 			$message_type = $settings['message_type'];
2765 2765
 
2766
-			foreach ( $settings as $key => $value ) {
2767
-				switch ( $key ) {
2766
+			foreach ($settings as $key => $value) {
2767
+				switch ($key) {
2768 2768
 					case 'messenger' :
2769
-						unset( $settings['messenger'] );
2769
+						unset($settings['messenger']);
2770 2770
 						break;
2771 2771
 					case 'message_type' :
2772
-						unset( $settings['message_type'] );
2772
+						unset($settings['message_type']);
2773 2773
 						break;
2774 2774
 					default :
2775 2775
 						$settings['settings'][$key] = $value;
2776
-						unset( $settings[$key] );
2776
+						unset($settings[$key]);
2777 2777
 						break;
2778 2778
 				}
2779 2779
 			}
2780 2780
 
2781
-			$this->_active_messengers[$messenger]['settings'][$messenger . '-message_types'][$message_type] = $settings;
2781
+			$this->_active_messengers[$messenger]['settings'][$messenger.'-message_types'][$message_type] = $settings;
2782 2782
 		}
2783 2783
 
2784 2784
 		//okay we should have the data all setup.  Now we just update!
2785
-		$success = EEH_MSG_Template::update_active_messengers_in_db( $this->_active_messengers );
2785
+		$success = EEH_MSG_Template::update_active_messengers_in_db($this->_active_messengers);
2786 2786
 
2787
-		if ( $success ) {
2788
-			EE_Error::add_success( __('Settings updated', 'event_espresso') );
2787
+		if ($success) {
2788
+			EE_Error::add_success(__('Settings updated', 'event_espresso'));
2789 2789
 		} else {
2790
-			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2790
+			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2791 2791
 		}
2792 2792
 
2793 2793
 		$this->_template_args['success'] = $success;
Please login to merge, or discard this patch.
admin_pages/payments/Payment_Log_Admin_List_Table.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
 
103 103
 	/**
104 104
 	 * _get_table_filters
105
-	 * @return array
105
+	 * @return string[]
106 106
 	 */
107 107
 	protected function _get_table_filters() {
108 108
 		$filters = array();
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 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
 /**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @param \EE_Admin_Page $admin_page
36 36
 	 * @return Payment_Log_Admin_List_Table
37 37
 	 */
38
-	public function __construct( $admin_page ) {
38
+	public function __construct($admin_page) {
39 39
 		parent::__construct($admin_page);
40 40
 	}
41 41
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 //		}else{
53 53
 //			$this->_data = $this->_admin_page->get_questions( $this->_per_page,$this->_current_page, FALSE );
54 54
 //		}
55
-		$this->_all_data_count = $this->_admin_page->get_payment_logs( $this->_per_page,$this->_current_page, TRUE );
56
-		add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',array($this,'add_download_logs_checkbox'));
55
+		$this->_all_data_count = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, TRUE);
56
+		add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_download_logs_checkbox'));
57 57
 	}
58 58
 
59 59
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 * adds a checkbox to the bottom of the list table, instead of at the top with the rest of the filters
64 64
 	 * @return void
65 65
 	 */
66
-	public function add_download_logs_checkbox(){
67
-		echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='".  __( 'Download Results', 'event_espresso' )."'>";
66
+	public function add_download_logs_checkbox() {
67
+		echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='".__('Download Results', 'event_espresso')."'>";
68 68
 	}
69 69
 
70 70
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function _set_properties() {
77 77
 		$this->_wp_list_args = array(
78
-			'singular' => __('payment log', 'event_espresso' ),
79
-			'plural' => __('payment logs', 'event_espresso' ),
78
+			'singular' => __('payment log', 'event_espresso'),
79
+			'plural' => __('payment logs', 'event_espresso'),
80 80
 			'ajax' => TRUE, //for now,
81 81
 			'screen' => $this->_admin_page->get_current_screen()->id
82 82
 			);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 			);
91 91
 
92 92
 		$this->_sortable_columns = array(
93
-			'LOG_time' => array( 'LOG_time' => TRUE ),
93
+			'LOG_time' => array('LOG_time' => TRUE),
94 94
 			);
95 95
 
96 96
 		$this->_hidden_columns = array(
@@ -107,20 +107,20 @@  discard block
 block discarded – undo
107 107
 	protected function _get_table_filters() {
108 108
 		$filters = array();
109 109
 		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
110
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
110
+		EE_Registry::instance()->load_helper('Form_Fields');
111 111
 		$payment_methods = EEM_Payment_Method::instance()->get_all();
112
-		$payment_method_names = array(array('id'=>'all','text'=>  __("All", 'event_espresso')),array('id'=>'0','text'=>  __("Unknown Payment Method", 'event_espresso')));
113
-		foreach($payment_methods as $payment_method){
114
-			$payment_method_names[] = array('id'=>$payment_method->ID(),'text'=>$payment_method->admin_name());
112
+		$payment_method_names = array(array('id'=>'all', 'text'=>  __("All", 'event_espresso')), array('id'=>'0', 'text'=>  __("Unknown Payment Method", 'event_espresso')));
113
+		foreach ($payment_methods as $payment_method) {
114
+			$payment_method_names[] = array('id'=>$payment_method->ID(), 'text'=>$payment_method->admin_name());
115 115
 		}
116 116
 		$filters[] = EEH_Form_Fields::select_input('_payment_method', $payment_method_names, isset($this->_req_data['_payment_method']) ? $this->_req_data['_payment_method'] : 'all');
117
-		$start_date = isset( $this->_req_data['payment-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-6 months' ));
118
-		$end_date = isset( $this->_req_data['payment-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] ) : date( 'm/d/Y' );
117
+		$start_date = isset($this->_req_data['payment-filter-start-date']) ? wp_strip_all_tags($this->_req_data['payment-filter-start-date']) : date('m/d/Y', strtotime('-6 months'));
118
+		$end_date = isset($this->_req_data['payment-filter-end-date']) ? wp_strip_all_tags($this->_req_data['payment-filter-end-date']) : date('m/d/Y');
119 119
 		ob_start();
120 120
 		?>
121
-		<label for="txn-filter-start-date"><?php _e( 'Display Transactions from ', 'event_espresso' ); ?></label>
121
+		<label for="txn-filter-start-date"><?php _e('Display Transactions from ', 'event_espresso'); ?></label>
122 122
 		<input id="payment-filter-start-date" class="datepicker" type="text" value="<?php echo $start_date; ?>" name="payment-filter-start-date" size="15"/>
123
-		<label for="txn-filter-end-date"><?php _e( ' until ', 'event_espresso' ); ?></label>
123
+		<label for="txn-filter-end-date"><?php _e(' until ', 'event_espresso'); ?></label>
124 124
 		<input id="payment-filter-end-date" class="datepicker" type="text" value="<?php echo $end_date; ?>" name="payment-filter-end-date" size="15"/>
125 125
 		<?php
126 126
 		$filters[] = ob_get_clean();
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @return void
135 135
 	 */
136 136
 	protected function _add_view_counts() {
137
-		$this->_views['all']['count'] = $this->_admin_page->get_payment_logs( $this->_per_page,$this->_current_page, TRUE );
137
+		$this->_views['all']['count'] = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, TRUE);
138 138
 	}
139 139
 
140 140
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @return string
146 146
 	 */
147 147
 	public function column_cb($item) {
148
-		return sprintf( '<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID() );
148
+		return sprintf('<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID());
149 149
 	}
150 150
 
151 151
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @param \EE_Change_Log $item
172 172
 	 * @return string
173 173
 	 */
174
-	public function column_LOG_time(EE_Change_Log $item){
174
+	public function column_LOG_time(EE_Change_Log $item) {
175 175
 		return $item->get_datetime('LOG_time');
176 176
 	}
177 177
 
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
 	 * @param \EE_Change_Log $item
183 183
 	 * @return string
184 184
 	 */
185
-	public function column_PMD_ID(EE_Change_Log $item){
186
-		if($item->object() instanceof EE_Payment_Method){
185
+	public function column_PMD_ID(EE_Change_Log $item) {
186
+		if ($item->object() instanceof EE_Payment_Method) {
187 187
 			return $item->object()->admin_name();
188
-		}elseif($item->object() instanceof EE_Payment && $item->object()->payment_method()){
188
+		}elseif ($item->object() instanceof EE_Payment && $item->object()->payment_method()) {
189 189
 			return $item->object()->payment_method()->admin_name();
190
-		}else{
190
+		} else {
191 191
 			return __("No longer exists", 'event_espresso');
192 192
 		}
193 193
 	}
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 * @param \EE_Change_Log $item
200 200
 	 * @return string
201 201
 	 */
202
-	public function column_TXN_ID(EE_Change_Log $item){
203
-		if($item->object() instanceof EE_Payment){
204
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->object()->TXN_ID() )) {
205
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->object()->TXN_ID() ), TXN_ADMIN_URL );
206
-				return '<a href="'.$view_txn_lnk_url.'"  title="' . sprintf( esc_attr__( 'click to view transaction #%s', 'event_espresso' ),  $item->object()->TXN_ID() ) . '">' . sprintf( __( 'view txn %s', 'event_espresso' ),  $item->object()->TXN_ID() ) . '</a>';
202
+	public function column_TXN_ID(EE_Change_Log $item) {
203
+		if ($item->object() instanceof EE_Payment) {
204
+			if (EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->object()->TXN_ID())) {
205
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->object()->TXN_ID()), TXN_ADMIN_URL);
206
+				return '<a href="'.$view_txn_lnk_url.'"  title="'.sprintf(esc_attr__('click to view transaction #%s', 'event_espresso'), $item->object()->TXN_ID()).'">'.sprintf(__('view txn %s', 'event_espresso'), $item->object()->TXN_ID()).'</a>';
207 207
 			}
208 208
 		} else {
209 209
 			return __("Unable to find transaction", 'event_espresso');
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -185,9 +186,9 @@  discard block
 block discarded – undo
185 186
 	public function column_PMD_ID(EE_Change_Log $item){
186 187
 		if($item->object() instanceof EE_Payment_Method){
187 188
 			return $item->object()->admin_name();
188
-		}elseif($item->object() instanceof EE_Payment && $item->object()->payment_method()){
189
+		} elseif($item->object() instanceof EE_Payment && $item->object()->payment_method()){
189 190
 			return $item->object()->payment_method()->admin_name();
190
-		}else{
191
+		} else{
191 192
 			return __("No longer exists", 'event_espresso');
192 193
 		}
193 194
 	}
Please login to merge, or discard this patch.
admin_pages/payments/Payments_Admin_Page.core.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 	 *
422 422
 	 * @access protected
423 423
 	 * @param \EE_Payment_Method $payment_method
424
-	 * @return \EE_Form_Section_Proper
424
+	 * @return EE_Form_Section_HTML
425 425
 	 */
426 426
 	protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) {
427 427
 		if ( $payment_method->type_obj()->requires_https() ) {
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	 *
452 452
 	 * @access protected
453 453
 	 * @param \EE_Payment_Method $payment_method
454
-	 * @return \EE_Form_Section_Proper
454
+	 * @return EE_Form_Section_HTML
455 455
 	 */
456 456
 	protected function _currency_support( EE_Payment_Method $payment_method ) {
457 457
 		if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) {
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	 *
484 484
 	 * @access protected
485 485
 	 * @param \EE_Payment_Method $payment_method
486
-	 * @return \EE_Form_Section_HTML
486
+	 * @return EE_Payment_Method_Form
487 487
 	 */
488 488
 	protected function _payment_method_settings( EE_Payment_Method $payment_method ) {
489 489
 		//modify the form so we only have/show fields that will be implemented for this version
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 *
552 552
 	 * @access protected
553 553
 	 * @param \EE_Payment_Method $payment_method
554
-	 * @return \EE_Form_Section_Proper
554
+	 * @return EE_Form_Section_HTML
555 555
 	 */
556 556
 	protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) {
557 557
 		$link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() );
Please login to merge, or discard this patch.
Braces   +8 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -655,7 +656,7 @@  discard block
 block discarded – undo
655 656
 			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type );
656 657
 
657 658
 			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug()));
658
-		}else{
659
+		} else{
659 660
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
660 661
 		}
661 662
 	}
@@ -670,7 +671,7 @@  discard block
 block discarded – undo
670 671
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
671 672
 			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug );
672 673
 			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug));
673
-		}else{
674
+		} else{
674 675
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default'));
675 676
 		}
676 677
 	}
@@ -712,7 +713,7 @@  discard block
 block discarded – undo
712 713
 				$pm = $correct_pmt_form_to_use->get_model_object();
713 714
 				/** @var $pm EE_Payment_Method */
714 715
 				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug()));
715
-			}else{
716
+			} else{
716 717
 				EE_Error::add_error(
717 718
 					sprintf(
718 719
 						__('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'),
@@ -838,7 +839,7 @@  discard block
 block discarded – undo
838 839
 		if(isset($this->_req_data['order'])){
839 840
 			$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
840 841
 			$query_params['order_by'] = array('LOG_time' => $sort);
841
-		}else{
842
+		} else{
842 843
 				$query_params['order_by'] = array('LOG_time' => 'DESC');
843 844
 		}
844 845
 		$offset = ($current_page-1)*$per_page;
@@ -881,7 +882,7 @@  discard block
 block discarded – undo
881 882
 		$comparison = $timeA < $timeB ? -1 : 1;
882 883
 		if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){
883 884
 			return $comparison * -1;
884
-		}else{
885
+		} else{
885 886
 			return $comparison;
886 887
 		}
887 888
 	}
@@ -896,7 +897,7 @@  discard block
 block discarded – undo
896 897
 			if( $payment_log->object() instanceof EE_Payment ){
897 898
 				$payment_method = $payment_log->object()->payment_method();
898 899
 				$transaction = $payment_log->object()->transaction();
899
-			}elseif($payment_log->object() instanceof EE_Payment_Method){
900
+			} elseif($payment_log->object() instanceof EE_Payment_Method){
900 901
 				$payment_method = $payment_log->object();
901 902
 			}
902 903
 		}
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		 *
84 84
 		 * When cap mapping is implemented, some routes will need to use the singular form of
85 85
 		 * capability method and also include the $id of the payment method for the route.
86
-		**/
86
+		 **/
87 87
 		$this->_page_routes = array(
88 88
 			'default' => array(
89 89
 				'func'=>'_payment_methods_list',
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 					'order' => 10
135 135
 					),
136 136
 				'metaboxes' => $this->_default_espresso_metaboxes,
137
-                'help_tabs' => array_merge(
137
+				'help_tabs' => array_merge(
138 138
 			array(
139 139
 					'payment_methods_overview_help_tab' => array(
140 140
 						'title' => __('Payment Methods Overview', 'event_espresso'),
@@ -790,9 +790,9 @@  discard block
 block discarded – undo
790 790
 
791 791
 	/**
792 792
 	 * 		_update_payment_settings
793
-	*		@access protected
794
-	*		@return array
795
-	*/
793
+	 *		@access protected
794
+	 *		@return array
795
+	 */
796 796
 	protected function _update_payment_settings() {
797 797
 		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE;
798 798
 		EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );
Please login to merge, or discard this patch.
Spacing   +160 added lines, -160 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
 /**
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
45 45
 	 * @return \Payments_Admin_Page
46 46
 	 */
47
-	public function __construct( $routing = TRUE ) {
48
-		parent::__construct( $routing );
47
+	public function __construct($routing = TRUE) {
48
+		parent::__construct($routing);
49 49
 	}
50 50
 
51 51
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 						'filename' => 'payment_methods_overview_stripe'
186 186
 						)*/
187 187
 				$this->_add_payment_method_help_tabs()),
188
-				'help_tour' => array( 'Payment_Methods_Selection_Help_Tour' ),
188
+				'help_tour' => array('Payment_Methods_Selection_Help_Tour'),
189 189
 				'require_nonce' => FALSE
190 190
 				);
191 191
 
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 						'filename' => 'payment_methods_settings'
203 203
 						)
204 204
 					),
205
-				'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ),
206
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
205
+				'help_tour' => array('Payment_Methods_Settings_Help_Tour'),
206
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
207 207
 				'require_nonce' => FALSE
208 208
 				),
209 209
 			'payment_log'=>array(
@@ -222,18 +222,18 @@  discard block
 block discarded – undo
222 222
 	/**
223 223
 	 * @return array
224 224
 	 */
225
-	protected function _add_payment_method_help_tabs(){
225
+	protected function _add_payment_method_help_tabs() {
226 226
 		EE_Registry::instance()->load_lib('Payment_Method_Manager');
227 227
 		$payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types();
228 228
 		$all_pmt_help_tabs_config = array();
229
-		foreach( $payment_method_types as $payment_method_type ){
230
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) {
229
+		foreach ($payment_method_types as $payment_method_type) {
230
+			if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) {
231 231
 				continue;
232 232
 			}
233
-			foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){
233
+			foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) {
234 234
 				$all_pmt_help_tabs_config[$help_tab_name] = array(
235 235
 					'title'=>$config['title'],
236
-					'content'=>EEH_Template::display_template( $payment_method_type->file_folder().'help_tabs'.DS.$config['filename'].'.help_tab.php', array('admin_page_obj'=>$this), true)
236
+					'content'=>EEH_Template::display_template($payment_method_type->file_folder().'help_tabs'.DS.$config['filename'].'.help_tab.php', array('admin_page_obj'=>$this), true)
237 237
 				);
238 238
 			}
239 239
 		}
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 
255 255
 
256 256
 	public function load_scripts_styles() {
257
-		wp_enqueue_script( 'ee_admin_js' );
258
-		wp_enqueue_script( 'ee-text-links' );
259
-		wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE );
257
+		wp_enqueue_script('ee_admin_js');
258
+		wp_enqueue_script('ee-text-links');
259
+		wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE);
260 260
 	}
261 261
 
262 262
 
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 
266 266
 	public function load_scripts_styles_default() {
267 267
 		//styles
268
-		wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION );
269
-		wp_enqueue_style( 'espresso_payments' );
270
-		wp_enqueue_style( 'ee-text-links' );
268
+		wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION);
269
+		wp_enqueue_style('espresso_payments');
270
+		wp_enqueue_style('ee-text-links');
271 271
 		//scripts
272 272
 	}
273 273
 
@@ -281,27 +281,27 @@  discard block
 block discarded – undo
281 281
 		 * to the loading process.  However, people MUST setup the details for the payment method so its safe to do a
282 282
 		 * recheck here.
283 283
 		 */
284
-		EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
284
+		EE_Registry::instance()->load_lib('Payment_Method_Manager');
285 285
 		EEM_Payment_Method::instance()->verify_button_urls();
286
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
287
-		EE_Registry::instance()->load_helper( 'HTML' );
286
+		EE_Registry::instance()->load_helper('Tabbed_Content');
287
+		EE_Registry::instance()->load_helper('HTML');
288 288
 		//setup tabs, one for each payment method type
289 289
 		$tabs = array();
290
-		foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) {
290
+		foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
291 291
 			// we don't want to show admin-only PMTs for now
292
-			if ( $pmt_obj instanceof EE_PMT_Admin_Only ) {
292
+			if ($pmt_obj instanceof EE_PMT_Admin_Only) {
293 293
 				continue;
294 294
 			}
295 295
 			//check access
296
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) {
296
+			if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) {
297 297
 				continue;
298 298
 			}
299 299
 			//check for any active pms of that type
300
-			$payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() );
301
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
300
+			$payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name());
301
+			if ( ! $payment_method instanceof EE_Payment_Method) {
302 302
 				$payment_method = EE_Payment_Method::new_instance(
303 303
 					array(
304
-						'PMD_slug'					=>sanitize_key( $pmt_obj->system_name() ),
304
+						'PMD_slug'					=>sanitize_key($pmt_obj->system_name()),
305 305
 						'PMD_type'					=>$pmt_obj->system_name(),
306 306
 						'PMD_name'				=>$pmt_obj->pretty_name(),
307 307
 						'PMD_admin_name'	=>$pmt_obj->pretty_name()
@@ -311,11 +311,11 @@  discard block
 block discarded – undo
311 311
 
312 312
 			add_meta_box(
313 313
 				//html id
314
-				'espresso_' . $payment_method->slug() . '_payment_settings',
314
+				'espresso_'.$payment_method->slug().'_payment_settings',
315 315
 				//title
316
-				sprintf( __('%s Settings', 'event_espresso'), $payment_method->admin_name() ),
316
+				sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()),
317 317
 				//callback
318
-				array( $this, 'payment_method_settings_meta_box' ),
318
+				array($this, 'payment_method_settings_meta_box'),
319 319
 				//post type
320 320
 				NULL,
321 321
 				//context
@@ -323,20 +323,20 @@  discard block
 block discarded – undo
323 323
 				//priority
324 324
 				'default',
325 325
 				//callback args
326
-				array( 'payment_method' => $payment_method )
326
+				array('payment_method' => $payment_method)
327 327
 			);
328 328
 
329 329
 			//setup for tabbed content
330 330
 			$tabs[$payment_method->slug()] = array(
331 331
 				'label' => $payment_method->admin_name(),
332 332
 				'class' =>  $payment_method->active() ? 'gateway-active' : '',
333
-				'href' => 'espresso_' . $payment_method->slug() . '_payment_settings',
333
+				'href' => 'espresso_'.$payment_method->slug().'_payment_settings',
334 334
 				'title' => __('Modify this Payment Method', 'event_espresso'),
335 335
 				'slug' => $payment_method->slug()
336 336
 			);
337 337
 		}
338 338
 
339
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() );
339
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug());
340 340
 		$this->display_admin_page_with_sidebar();
341 341
 
342 342
 	}
@@ -347,20 +347,20 @@  discard block
 block discarded – undo
347 347
 	 *   _get_active_payment_method_slug
348 348
 	 * 	@return string
349 349
 	 */
350
-	protected function _get_active_payment_method_slug(){
350
+	protected function _get_active_payment_method_slug() {
351 351
 		$payment_method_slug = FALSE;
352 352
 		//decide which payment method tab to open first, as dictated by the request's 'payment_method'
353
-		if ( isset( $this->_req_data['payment_method'] )) {
353
+		if (isset($this->_req_data['payment_method'])) {
354 354
 			// if they provided the current payment method, use it
355
-			$payment_method_slug = sanitize_key( $this->_req_data['payment_method'] );
355
+			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
356 356
 		}
357
-		$payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug )));
357
+		$payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug)));
358 358
 		// if that didn't work or wasn't provided, find another way to select the current pm
359
-		if ( ! $this->_verify_payment_method( $payment_method )) {
359
+		if ( ! $this->_verify_payment_method($payment_method)) {
360 360
 			// like, looking for an active one
361
-			$payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' );
361
+			$payment_method = EEM_Payment_Method::instance()->get_one_active('CART');
362 362
 			// test that one as well
363
-			if ( $this->_verify_payment_method( $payment_method )) {
363
+			if ($this->_verify_payment_method($payment_method)) {
364 364
 				$payment_method_slug = $payment_method->slug();
365 365
 			} else {
366 366
 				$payment_method_slug = 'paypal_standard';
@@ -378,11 +378,11 @@  discard block
 block discarded – undo
378 378
 	 * @param \EE_Payment_Method $payment_method
379 379
 	 * @return boolean
380 380
 	 */
381
-	protected function _verify_payment_method( $payment_method ){
381
+	protected function _verify_payment_method($payment_method) {
382 382
 		if (
383 383
 			$payment_method instanceof EE_Payment_Method &&
384 384
 			$payment_method->type_obj() instanceof EE_PMT_Base &&
385
-			EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' )
385
+			EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access')
386 386
 		) {
387 387
 			return TRUE;
388 388
 		}
@@ -399,21 +399,21 @@  discard block
 block discarded – undo
399 399
 	 * @return string
400 400
 	 * @throws EE_Error
401 401
 	 */
402
-	public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){
403
-		$payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL;
404
-		if ( ! $payment_method instanceof EE_Payment_Method ){
405
-			throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' )));
402
+	public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) {
403
+		$payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL;
404
+		if ( ! $payment_method instanceof EE_Payment_Method) {
405
+			throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso')));
406 406
 		}
407 407
 		$payment_method_scopes = $payment_method->active();
408 408
 		// if the payment method really exists show its form, otherwise the activation template
409
-		if ( $payment_method->ID() && ! empty( $payment_method_scopes )) {
410
-				$form = $this->_generate_payment_method_settings_form( $payment_method );
411
-				if ( $form->form_data_present_in( $this->_req_data )) {
412
-					$form->receive_form_submission( $this->_req_data );
409
+		if ($payment_method->ID() && ! empty($payment_method_scopes)) {
410
+				$form = $this->_generate_payment_method_settings_form($payment_method);
411
+				if ($form->form_data_present_in($this->_req_data)) {
412
+					$form->receive_form_submission($this->_req_data);
413 413
 				}
414
-				echo $form->form_open() . $form->get_html_and_js() . $form->form_close();
414
+				echo $form->form_open().$form->get_html_and_js().$form->form_close();
415 415
 		} else {
416
-			echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js();
416
+			echo $this->_activate_payment_method_button($payment_method)->get_html_and_js();
417 417
 		}
418 418
 	}
419 419
 
@@ -426,14 +426,14 @@  discard block
 block discarded – undo
426 426
 	 * @param \EE_Payment_Method $payment_method
427 427
 	 * @return \EE_Form_Section_Proper
428 428
 	 */
429
-	protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) {
430
-		if ( ! $payment_method instanceof EE_Payment_Method ){
429
+	protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) {
430
+		if ( ! $payment_method instanceof EE_Payment_Method) {
431 431
 			return new EE_Form_Section_Proper();
432 432
 		}
433 433
 		return new EE_Form_Section_Proper(
434 434
 			array(
435
-				'name' 	=> $payment_method->slug() . '_settings_form',
436
-				'html_id' 	=> $payment_method->slug() . '_settings_form',
435
+				'name' 	=> $payment_method->slug().'_settings_form',
436
+				'html_id' 	=> $payment_method->slug().'_settings_form',
437 437
 				'action' 	=> EE_Admin_Page::add_query_args_and_nonce(
438 438
 					array(
439 439
 						'action' 						=> 'update_payment_method',
@@ -445,12 +445,12 @@  discard block
 block discarded – undo
445 445
 				'subsections' 			=> apply_filters(
446 446
 					'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections',
447 447
 					array(
448
-						'pci_dss_compliance_' . $payment_method->slug() 				=> $this->_pci_dss_compliance( $payment_method ),
449
-						'currency_support_' . $payment_method->slug()					=> $this->_currency_support( $payment_method ),
450
-						'payment_method_settings_' . $payment_method->slug() 	=> $this->_payment_method_settings( $payment_method ),
451
-						'update_' . $payment_method->slug()										=> $this->_update_payment_method_button( $payment_method ),
452
-						'deactivate_' . $payment_method->slug()								=> $this->_deactivate_payment_method_button( $payment_method ),
453
-						'fine_print_' . $payment_method->slug()									=> $this->_fine_print()
448
+						'pci_dss_compliance_'.$payment_method->slug() 				=> $this->_pci_dss_compliance($payment_method),
449
+						'currency_support_'.$payment_method->slug()					=> $this->_currency_support($payment_method),
450
+						'payment_method_settings_'.$payment_method->slug() 	=> $this->_payment_method_settings($payment_method),
451
+						'update_'.$payment_method->slug()										=> $this->_update_payment_method_button($payment_method),
452
+						'deactivate_'.$payment_method->slug()								=> $this->_deactivate_payment_method_button($payment_method),
453
+						'fine_print_'.$payment_method->slug()									=> $this->_fine_print()
454 454
 					)
455 455
 				)
456 456
 			)
@@ -466,19 +466,19 @@  discard block
 block discarded – undo
466 466
 	 * @param \EE_Payment_Method $payment_method
467 467
 	 * @return \EE_Form_Section_Proper
468 468
 	 */
469
-	protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) {
470
-		if ( $payment_method->type_obj()->requires_https() ) {
469
+	protected function _pci_dss_compliance(EE_Payment_Method $payment_method) {
470
+		if ($payment_method->type_obj()->requires_https()) {
471 471
 			return new EE_Form_Section_HTML(
472 472
 				EEH_HTML::tr(
473 473
 					EEH_HTML::th(
474 474
 						EEH_HTML::label(
475
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
475
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
476 476
 						)
477
-					) .
477
+					).
478 478
 					EEH_HTML::td(
479
-						EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) .
480
-						EEH_HTML::br() .
481
-						__( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' ))
479
+						EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')).
480
+						EEH_HTML::br().
481
+						__('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso'))
482 482
 					)
483 483
 				)
484 484
 			);
@@ -496,19 +496,19 @@  discard block
 block discarded – undo
496 496
 	 * @param \EE_Payment_Method $payment_method
497 497
 	 * @return \EE_Form_Section_Proper
498 498
 	 */
499
-	protected function _currency_support( EE_Payment_Method $payment_method ) {
500
-		if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) {
499
+	protected function _currency_support(EE_Payment_Method $payment_method) {
500
+		if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) {
501 501
 			return new EE_Form_Section_HTML(
502 502
 				EEH_HTML::tr(
503 503
 					EEH_HTML::th(
504 504
 						EEH_HTML::label(
505
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
505
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
506 506
 						)
507
-					) .
507
+					).
508 508
 					EEH_HTML::td(
509 509
 						EEH_HTML::strong(
510 510
 							sprintf(
511
-								__( 'This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'),
511
+								__('This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'),
512 512
 								EE_Config::instance()->currency->code
513 513
 							)
514 514
 						)
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
 	 * @param \EE_Payment_Method $payment_method
529 529
 	 * @return \EE_Form_Section_HTML
530 530
 	 */
531
-	protected function _payment_method_settings( EE_Payment_Method $payment_method ) {
531
+	protected function _payment_method_settings(EE_Payment_Method $payment_method) {
532 532
 		//modify the form so we only have/show fields that will be implemented for this version
533
-		return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() );
533
+		return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name());
534 534
 	}
535 535
 
536 536
 
@@ -543,8 +543,8 @@  discard block
 block discarded – undo
543 543
 	 * @return \EE_Payment_Method_Form
544 544
 	 * @throws \EE_Error
545 545
 	 */
546
-	protected function _simplify_form( $form_section, $payment_method_name = '' ){
547
-		if ( $form_section instanceof EE_Payment_Method_Form ) {
546
+	protected function _simplify_form($form_section, $payment_method_name = '') {
547
+		if ($form_section instanceof EE_Payment_Method_Form) {
548 548
 			$form_section->exclude(
549 549
 				array(
550 550
 					'PMD_type', //dont want them changing the type
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 			);
556 556
 			return $form_section;
557 557
 		} else {
558
-			throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name ));
558
+			throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name));
559 559
 		}
560 560
 	}
561 561
 
@@ -568,18 +568,18 @@  discard block
 block discarded – undo
568 568
 	 * @param \EE_Payment_Method $payment_method
569 569
 	 * @return \EE_Form_Section_HTML
570 570
 	 */
571
-	protected function _update_payment_method_button( EE_Payment_Method $payment_method ) {
571
+	protected function _update_payment_method_button(EE_Payment_Method $payment_method) {
572 572
 		$update_button = new EE_Submit_Input(
573 573
 			array(
574
-				'html_id' 		=> 'save_' . $payment_method->slug() . '_settings',
575
-				'default' 		=> sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ),
574
+				'html_id' 		=> 'save_'.$payment_method->slug().'_settings',
575
+				'default' 		=> sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()),
576 576
 				'html_label' => EEH_HTML::nbsp()
577 577
 			)
578 578
 		);
579 579
 		return new EE_Form_Section_HTML(
580
-			EEH_HTML::no_row( EEH_HTML::br(2) ) .
580
+			EEH_HTML::no_row(EEH_HTML::br(2)).
581 581
 			EEH_HTML::tr(
582
-				EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) .
582
+				EEH_HTML::th(__('Update Settings', 'event_espresso')).
583 583
 				EEH_HTML::td(
584 584
 					$update_button->get_html_for_input()
585 585
 				)
@@ -596,11 +596,11 @@  discard block
 block discarded – undo
596 596
 	 * @param \EE_Payment_Method $payment_method
597 597
 	 * @return \EE_Form_Section_Proper
598 598
 	 */
599
-	protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) {
600
-		$link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() );
599
+	protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) {
600
+		$link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name());
601 601
 		return new EE_Form_Section_HTML(
602 602
 			EEH_HTML::tr(
603
-				EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) .
603
+				EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')).
604 604
 				EEH_HTML::td(
605 605
 					EEH_HTML::link(
606 606
 						EE_Admin_Page::add_query_args_and_nonce(
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 						),
613 613
 						$link_text_and_title,
614 614
 						$link_text_and_title,
615
-						'deactivate_' . $payment_method->slug(),
615
+						'deactivate_'.$payment_method->slug(),
616 616
 						'espresso-button button-secondary'
617 617
 					)
618 618
 				)
@@ -628,12 +628,12 @@  discard block
 block discarded – undo
628 628
 	 * @param \EE_Payment_Method $payment_method
629 629
 	 * @return \EE_Form_Section_Proper
630 630
 	 */
631
-	protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) {
632
-		$link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() );
631
+	protected function _activate_payment_method_button(EE_Payment_Method $payment_method) {
632
+		$link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name());
633 633
 		return new EE_Form_Section_Proper(
634 634
 			array(
635
-				'name' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
636
-				'html_id' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
635
+				'name' 	=> 'activate_'.$payment_method->slug().'_settings_form',
636
+				'html_id' 	=> 'activate_'.$payment_method->slug().'_settings_form',
637 637
 				'action' 	=> '#',
638 638
 				'layout_strategy'		=> new EE_Admin_Two_Column_Layout(),
639 639
 				'subsections' 			=> apply_filters(
@@ -642,8 +642,8 @@  discard block
 block discarded – undo
642 642
 						new EE_Form_Section_HTML(
643 643
 							EEH_HTML::tr(
644 644
 								EEH_HTML::th(
645
-									EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' ))
646
-								) .
645
+									EEH_HTML::label(__('Click to Activate ', 'event_espresso'))
646
+								).
647 647
 								EEH_HTML::td(
648 648
 									EEH_HTML::link(
649 649
 										EE_Admin_Page::add_query_args_and_nonce(
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 										),
656 656
 										$link_text_and_title,
657 657
 										$link_text_and_title,
658
-										'activate_' . $payment_method->slug(),
658
+										'activate_'.$payment_method->slug(),
659 659
 										'espresso-button-green button-primary'
660 660
 									)
661 661
 								)
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
 	protected function _fine_print() {
677 677
 		return new EE_Form_Section_HTML(
678 678
 			EEH_HTML::tr(
679
-				EEH_HTML::th() .
679
+				EEH_HTML::th().
680 680
 				EEH_HTML::td(
681
-					EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )
681
+					EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')
682 682
 				)
683 683
 			)
684 684
 		);
@@ -690,15 +690,15 @@  discard block
 block discarded – undo
690 690
 	 * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far)
691 691
 	 * @global WP_User $current_user
692 692
 	 */
693
-	protected function _activate_payment_method(){
694
-		if(isset($this->_req_data['payment_method_type'])){
693
+	protected function _activate_payment_method() {
694
+		if (isset($this->_req_data['payment_method_type'])) {
695 695
 			$payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']);
696 696
 			//see if one exists
697
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
698
-			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type );
697
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
698
+			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type);
699 699
 
700
-			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug()));
701
-		}else{
700
+			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug()));
701
+		} else {
702 702
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
703 703
 		}
704 704
 	}
@@ -706,14 +706,14 @@  discard block
 block discarded – undo
706 706
 	/**
707 707
 	 * Deactivates the payment method with the specified slug, and redirects.
708 708
 	 */
709
-	protected function _deactivate_payment_method(){
710
-		if(isset($this->_req_data['payment_method'])){
709
+	protected function _deactivate_payment_method() {
710
+		if (isset($this->_req_data['payment_method'])) {
711 711
 			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
712 712
 			//deactivate it
713 713
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
714
-			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug );
715
-			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug));
716
-		}else{
714
+			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug);
715
+			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug));
716
+		} else {
717 717
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default'));
718 718
 		}
719 719
 	}
@@ -727,39 +727,39 @@  discard block
 block discarded – undo
727 727
 	 * subsequently called 'headers_sent_func' which is _payment_methods_list)
728 728
 	 * @return void
729 729
 	 */
730
-	protected function _update_payment_method(){
731
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
730
+	protected function _update_payment_method() {
731
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
732 732
 			//ok let's find which gateway form to use based on the form input
733 733
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
734 734
 			/** @var $correct_pmt_form_to_use EE_Payment_Method_Form */
735 735
 			$correct_pmt_form_to_use = NULL;
736 736
 			$pmt_obj = NULL;
737
-			foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){
737
+			foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
738 738
 				/** @var $pmt_obj EE_PMT_Base */
739 739
 				//get the form and simplify it, like what we do when we display it
740 740
 				$pmt_form = $pmt_obj->settings_form();
741 741
 				$this->_simplify_form($pmt_form);
742
-				if($pmt_form->form_data_present_in($this->_req_data)){
742
+				if ($pmt_form->form_data_present_in($this->_req_data)) {
743 743
 					$correct_pmt_form_to_use = $pmt_form;
744 744
 					break;
745 745
 				}
746 746
 			}
747 747
 			//if we couldn't find the correct payment method type...
748
-			if( ! $correct_pmt_form_to_use ){
748
+			if ( ! $correct_pmt_form_to_use) {
749 749
 				EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
750 750
 				$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
751 751
 			}
752 752
 			$correct_pmt_form_to_use->receive_form_submission($this->_req_data);
753
-			if($correct_pmt_form_to_use->is_valid()){
753
+			if ($correct_pmt_form_to_use->is_valid()) {
754 754
 				$correct_pmt_form_to_use->save();
755 755
 				$pm = $correct_pmt_form_to_use->get_model_object();
756 756
 				/** @var $pm EE_Payment_Method */
757
-				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug()));
758
-			}else{
757
+				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug()));
758
+			} else {
759 759
 				EE_Error::add_error(
760 760
 					sprintf(
761 761
 						__('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'),
762
-						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' )
762
+						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso')
763 763
 					),
764 764
 					__FILE__,
765 765
 					__FUNCTION__,
@@ -776,11 +776,11 @@  discard block
 block discarded – undo
776 776
 	protected function _payment_settings() {
777 777
 
778 778
 		$this->_template_args['values'] = $this->_yes_no_values;
779
-		$this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE;
779
+		$this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE;
780 780
 
781
-		$this->_set_add_edit_form_tags( 'update_payment_settings' );
782
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
783
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE );
781
+		$this->_set_add_edit_form_tags('update_payment_settings');
782
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
783
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE);
784 784
 		$this->display_admin_page_with_sidebar();
785 785
 
786 786
 	}
@@ -794,13 +794,13 @@  discard block
 block discarded – undo
794 794
 	*		@return array
795 795
 	*/
796 796
 	protected function _update_payment_settings() {
797
-		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE;
798
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );
797
+		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE;
798
+		EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG);
799 799
 
800 800
 
801
-		$what = __('Payment Settings','event_espresso');
802
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
803
-		$this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) );
801
+		$what = __('Payment Settings', 'event_espresso');
802
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
803
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings'));
804 804
 
805 805
 	}
806 806
 	protected function _payment_log_overview_list_table() {
@@ -826,18 +826,18 @@  discard block
 block discarded – undo
826 826
 	 * @param bool $count
827 827
 	 * @return array
828 828
 	 */
829
-	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){
830
-		EE_Registry::instance()->load_model( 'Change_Log' );
829
+	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) {
830
+		EE_Registry::instance()->load_model('Change_Log');
831 831
 		//we may need to do multiple queries (joining differently), so we actually wan tan array of query params
832
-		$query_params =  array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
832
+		$query_params = array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
833 833
 		//check if they've selected a specific payment method
834
-		if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){
834
+		if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') {
835 835
 			$query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'],
836 836
 				'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']);
837 837
 		}
838 838
 		//take into account search
839
-		if(isset($this->_req_data['s']) && $this->_req_data['s']){
840
-			$similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%');
839
+		if (isset($this->_req_data['s']) && $this->_req_data['s']) {
840
+			$similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%');
841 841
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string;
842 842
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string;
843 843
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string;
@@ -852,48 +852,48 @@  discard block
 block discarded – undo
852 852
 			$query_params[0]['OR*s']['LOG_message'] = $similarity_string;
853 853
 
854 854
 		}
855
-		if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){
855
+		if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) {
856 856
 			//add date
857
-			$start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] );
858
-			$end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] );
857
+			$start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']);
858
+			$end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']);
859 859
 			//make sure our timestamps start and end right at the boundaries for each day
860
-			$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
861
-			$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
860
+			$start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
861
+			$end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
862 862
 
863 863
 			//convert to timestamps
864
-			$start_date = strtotime( $start_date );
865
-			$end_date = strtotime( $end_date );
864
+			$start_date = strtotime($start_date);
865
+			$end_date = strtotime($end_date);
866 866
 
867 867
 			//makes sure start date is the lowest value and vice versa
868
-			$start_date = min( $start_date, $end_date );
869
-			$end_date = max( $start_date, $end_date );
868
+			$start_date = min($start_date, $end_date);
869
+			$end_date = max($start_date, $end_date);
870 870
 
871 871
 			//convert for query
872
-			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
873
-			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
872
+			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s');
873
+			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s');
874 874
 
875
-			$query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date));
875
+			$query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date));
876 876
 
877 877
 		}
878
-		if($count){
878
+		if ($count) {
879 879
 			return EEM_Change_Log::instance()->count($query_params);
880 880
 		}
881
-		if(isset($this->_req_data['order'])){
882
-			$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
881
+		if (isset($this->_req_data['order'])) {
882
+			$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
883 883
 			$query_params['order_by'] = array('LOG_time' => $sort);
884
-		}else{
884
+		} else {
885 885
 				$query_params['order_by'] = array('LOG_time' => 'DESC');
886 886
 		}
887
-		$offset = ($current_page-1)*$per_page;
887
+		$offset = ($current_page - 1) * $per_page;
888 888
 
889
-		if( ! isset($this->_req_data['download_results'])){
890
-			$query_params['limit'] = array( $offset, $per_page );
889
+		if ( ! isset($this->_req_data['download_results'])) {
890
+			$query_params['limit'] = array($offset, $per_page);
891 891
 		}
892 892
 
893 893
 
894 894
 
895 895
 		//now they've requested to instead just download the file instead of viewing it.
896
-		if(isset($this->_req_data['download_results'])){
896
+		if (isset($this->_req_data['download_results'])) {
897 897
 			$wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params);
898 898
 			header('Content-Disposition: attachment');
899 899
 			header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url()));
@@ -915,36 +915,36 @@  discard block
 block discarded – undo
915 915
 	 * @param EE_Change_Log $logB
916 916
 	 * @return int
917 917
 	 */
918
-	protected function _sort_logs_again($logA,$logB){
918
+	protected function _sort_logs_again($logA, $logB) {
919 919
 		$timeA = $logA->get_raw('LOG_time');
920 920
 		$timeB = $logB->get_raw('LOG_time');
921
-		if($timeA == $timeB){
921
+		if ($timeA == $timeB) {
922 922
 			return 0;
923 923
 		}
924 924
 		$comparison = $timeA < $timeB ? -1 : 1;
925
-		if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){
925
+		if (strtoupper($this->_sort_logs_again_direction) == 'DESC') {
926 926
 			return $comparison * -1;
927
-		}else{
927
+		} else {
928 928
 			return $comparison;
929 929
 		}
930 930
 	}
931 931
 
932 932
 	protected function _payment_log_details() {
933
-		EE_Registry::instance()->load_model( 'Change_Log' );
933
+		EE_Registry::instance()->load_model('Change_Log');
934 934
 		/** @var $payment_log EE_Change_Log */
935 935
 		$payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']);
936 936
 		$payment_method = NULL;
937 937
 		$transaction = NULL;
938
-		if( $payment_log instanceof EE_Change_Log ){
939
-			if( $payment_log->object() instanceof EE_Payment ){
938
+		if ($payment_log instanceof EE_Change_Log) {
939
+			if ($payment_log->object() instanceof EE_Payment) {
940 940
 				$payment_method = $payment_log->object()->payment_method();
941 941
 				$transaction = $payment_log->object()->transaction();
942
-			}elseif($payment_log->object() instanceof EE_Payment_Method){
942
+			}elseif ($payment_log->object() instanceof EE_Payment_Method) {
943 943
 				$payment_method = $payment_log->object();
944 944
 			}
945 945
 		}
946 946
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
947
-			EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php',
947
+			EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php',
948 948
 			array(
949 949
 				'payment_log'=>$payment_log,
950 950
 				'payment_method'=>$payment_method,
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Registrations_List_Table.class.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	/**
195 195
 	 * 	_get_table_filters
196 196
 	 * @access protected
197
-	 * @return array
197
+	 * @return string[]
198 198
 	 */
199 199
 	protected function _get_table_filters() {
200 200
 		$filters = array();
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	 *
500 500
 	 * @access public
501 501
 	 * @param  EE_Registration $item registration object
502
-	 * @return string
502
+	 * @return boolean
503 503
 	 */
504 504
 	function column__REG_code( EE_Registration $item) {
505 505
 		return $item->get('REG_code');
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
 	 * @param \EE_Registration $item
329 329
 	 * @return string
330 330
 	 */
331
-    function column__Reg_Status( EE_Registration $item ) {
332
-    	return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
333
-    }
331
+	function column__Reg_Status( EE_Registration $item ) {
332
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
333
+	}
334 334
 
335 335
 
336 336
 
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
 	 * @param \EE_Registration $item
342 342
 	 * @return string
343 343
 	 */
344
-    function column_cb($item){
344
+	function column_cb($item){
345 345
 	/** checkbox/lock **/
346 346
 	$transaction = $item->get_first_related( 'Transaction' );
347 347
 	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
348 348
 	return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() );
349
-    }
349
+	}
350 350
 
351 351
 
352 352
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	function column__REG_date(EE_Registration $item){
374 374
 		$this->_set_related_details($item);
375
-       		 //Build row actions
375
+	   		 //Build row actions
376 376
 		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );
377 377
 		return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
378 378
 	}
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 		} else {
423 423
 			return __( 'There is no ticket on this registration', 'event_espresso' );
424 424
 		}
425
-    }
425
+	}
426 426
 
427 427
 
428 428
 
Please login to merge, or discard this patch.
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -57,20 +57,20 @@  discard block
 block discarded – undo
57 57
 	 * @param \EE_Admin_Page $admin_page
58 58
 	 * @return EE_Registrations_List_Table
59 59
 	 */
60
-	function __construct( $admin_page ){
60
+	function __construct($admin_page) {
61 61
 
62
-		if ( ! empty( $_GET['event_id'] ) ) {
62
+		if ( ! empty($_GET['event_id'])) {
63 63
 			$extra_query_args = array();
64
-			foreach ( $admin_page->get_views() as $key => $view_details ) {
65
-				$extra_query_args[$view_details['slug']] = array( 'event_id' => $_GET['event_id'] );
64
+			foreach ($admin_page->get_views() as $key => $view_details) {
65
+				$extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
66 66
 			}
67
-			$this->_views = $admin_page->get_list_table_view_RLs( $extra_query_args );
67
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
68 68
 		}
69 69
 
70 70
 		parent::__construct($admin_page);
71 71
 		$this->_status = $this->_admin_page->get_registration_status_array();
72 72
 
73
-		EE_Registry::instance()->load_helper( 'Template' );
73
+		EE_Registry::instance()->load_helper('Template');
74 74
 	}
75 75
 
76 76
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 * @return void
82 82
 	 */
83 83
 	protected function _setup_data() {
84
-		$this->_data = $this->_admin_page->get_registrations( $this->_per_page );
85
-		$this->_all_data_count = $this->_admin_page->get_registrations( $this->_per_page, TRUE, FALSE, FALSE );
84
+		$this->_data = $this->_admin_page->get_registrations($this->_per_page);
85
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, TRUE, FALSE, FALSE);
86 86
 	}
87 87
 
88 88
 
@@ -101,44 +101,44 @@  discard block
 block discarded – undo
101 101
 			);
102 102
 
103 103
 
104
-		if ( isset( $_GET['event_id'] )) {
104
+		if (isset($_GET['event_id'])) {
105 105
 			$this->_columns = array(
106 106
 				'_Reg_Status' => '',
107 107
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
108
-				'_REG_ID' => __( 'ID', 'event_espresso' ),
108
+				'_REG_ID' => __('ID', 'event_espresso'),
109 109
 				'_REG_count' => '#',
110
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
110
+				'ATT_fname' => __('Name', 'event_espresso'),
111 111
 				'ATT_email' =>  __('Email', 'event_espresso'),
112
-				'_REG_date' => __( 'Reg Date', 'event_espresso' ),
113
-				'_REG_code' => __( 'Reg Code', 'event_espresso' ),
112
+				'_REG_date' => __('Reg Date', 'event_espresso'),
113
+				'_REG_code' => __('Reg Code', 'event_espresso'),
114 114
 				//'Reg_status' => __( 'Status', 'event_espresso' ),
115
-				'PRC_amount' => __( 'TKT Price', 'event_espresso' ),
116
-				'_REG_final_price' => __( 'Final Price', 'event_espresso' ),
117
-				'TXN_total' => __( 'Total Txn', 'event_espresso' ),
115
+				'PRC_amount' => __('TKT Price', 'event_espresso'),
116
+				'_REG_final_price' => __('Final Price', 'event_espresso'),
117
+				'TXN_total' => __('Total Txn', 'event_espresso'),
118 118
 				'TXN_paid' => __('Paid', 'event_espresso'),
119
-				'actions' => __( 'Actions', 'event_espresso' )
119
+				'actions' => __('Actions', 'event_espresso')
120 120
 				);
121 121
 			$this->_bottom_buttons = array(
122 122
 					'report'=> array(
123 123
 					'route' => 'registrations_report',
124
-					'extra_request' => isset( $this->_req_data['event_id'] ) ? array('EVT_ID'=>$this->_req_data['event_id']) : NULL
124
+					'extra_request' => isset($this->_req_data['event_id']) ? array('EVT_ID'=>$this->_req_data['event_id']) : NULL
125 125
 				),
126 126
 			);
127 127
 		} else {
128 128
 			$this->_columns = array(
129 129
 				'_Reg_Status' => '',
130 130
 				'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
131
-				'_REG_ID' => __( 'ID', 'event_espresso' ),
131
+				'_REG_ID' => __('ID', 'event_espresso'),
132 132
 				'_REG_count' => '#',
133
-				'ATT_fname' => __( 'Name', 'event_espresso' ),
134
-				'_REG_date' => __( 'TXN Date', 'event_espresso' ),
135
-				'event_name' => __( 'Event', 'event_espresso' ),
136
-					'DTT_EVT_start' => __( 'Event Date', 'event_espresso' ),
137
-				'_REG_code' => __( 'Reg Code', 'event_espresso' ),
133
+				'ATT_fname' => __('Name', 'event_espresso'),
134
+				'_REG_date' => __('TXN Date', 'event_espresso'),
135
+				'event_name' => __('Event', 'event_espresso'),
136
+					'DTT_EVT_start' => __('Event Date', 'event_espresso'),
137
+				'_REG_code' => __('Reg Code', 'event_espresso'),
138 138
 				//'Reg_status' => __( 'Status', 'event_espresso' ),
139
-				'_REG_final_price' => __( 'Price', 'event_espresso' ),
140
-				'_REG_paid' => __( 'Paid', 'event_espresso' ),
141
-				'actions' => __( 'Actions', 'event_espresso' )
139
+				'_REG_final_price' => __('Price', 'event_espresso'),
140
+				'_REG_paid' => __('Paid', 'event_espresso'),
141
+				'actions' => __('Actions', 'event_espresso')
142 142
 			);
143 143
 			$this->_bottom_buttons = array(
144 144
 				'report_all'=> array(
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 
150 150
 
151 151
 		$this->_sortable_columns = array(
152
-			'_REG_date' => array( '_REG_date' => TRUE ),   //true means its already sorted
153
-			'ATT_fname' => array( 'ATT_fname' => FALSE ),
154
-			'event_name' => array( 'event_name' => FALSE ),
155
-			'DTT_EVT_start'	=> array( 'DTT_EVT_start' => FALSE ),
152
+			'_REG_date' => array('_REG_date' => TRUE), //true means its already sorted
153
+			'ATT_fname' => array('ATT_fname' => FALSE),
154
+			'event_name' => array('event_name' => FALSE),
155
+			'DTT_EVT_start'	=> array('DTT_EVT_start' => FALSE),
156 156
 			//'Reg_status' => array( 'Reg_status' => FALSE ),
157
-			'_REG_ID' => array( '_REG_ID' => FALSE ),
157
+			'_REG_ID' => array('_REG_ID' => FALSE),
158 158
 		);
159 159
 
160 160
 		$this->_hidden_columns = array();
@@ -168,15 +168,15 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @param EE_Registration $registration
170 170
 	 */
171
-	protected function _set_related_details( EE_Registration $registration ) {
171
+	protected function _set_related_details(EE_Registration $registration) {
172 172
 
173
-		$transaction = $registration->get_first_related( 'Transaction' );
173
+		$transaction = $registration->get_first_related('Transaction');
174 174
 		$status = $transaction instanceof EE_Transaction ? $transaction->status_ID() : EEM_Transaction::failed_status_code;
175 175
 		$this->_transaction_details = array(
176 176
 			'transaction' => $transaction,
177 177
 			'status' => $status,
178 178
 			'id' => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
179
-			'title_attr' => sprintf( __('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) )
179
+			'title_attr' => sprintf(__('View Transaction Details (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))
180 180
 			);
181 181
 
182 182
 		$event = $registration->event();
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			'event' => $event,
186 186
 			'status' => $status,
187 187
 			'id' => $event instanceof EE_Event ? $event->ID() : 0,
188
-			'title_attr' => sprintf( __('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status( $status, false, 'sentence' ) )
188
+			'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'), EEH_Template::pretty_status($status, false, 'sentence'))
189 189
 			);
190 190
 	}
191 191
 
@@ -200,26 +200,26 @@  discard block
 block discarded – undo
200 200
 		$filters = array();
201 201
 
202 202
 		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
203
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
203
+		EE_Registry::instance()->load_helper('Form_Fields');
204 204
 
205
-		$cur_date = isset( $this->_req_data['month_range'] ) ? $this->_req_data['month_range'] : '';
206
-		$cur_category = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
207
-		$reg_status = isset( $this->_req_data['_reg_status'] ) ? $this->_req_data['_reg_status'] : '';
205
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
206
+		$cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
207
+		$reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
208 208
 
209
-		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown( $cur_date, $reg_status, $cur_category );
210
-		$filters[] = EEH_Form_Fields::generate_event_category_dropdown( $cur_category );
209
+		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
210
+		$filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
211 211
 
212 212
 		$status = array();
213
-		$status[] = array( 'id' => 0, 'text' => __('Select Status', 'event_espresso') );
214
-		foreach ( $this->_status as $key => $value ) {
215
-			$status[] = array( 'id' => $key, 'text' => $value );
213
+		$status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
214
+		foreach ($this->_status as $key => $value) {
215
+			$status[] = array('id' => $key, 'text' => $value);
216 216
 		}
217
-		if ( $this->_view != 'incomplete' ) {
218
-			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset( $this->_req_data['_reg_status'] ) ? strtoupper( sanitize_key( $this->_req_data['_reg_status'] )) : '' );
217
+		if ($this->_view != 'incomplete') {
218
+			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status, isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) : '');
219 219
 		}
220 220
 
221
-		if ( isset( $this->_req_data['event_id'] ) ) {
222
-			$filters[] = EEH_Form_Fields::hidden_input( 'event_id',  $this->_req_data['event_id'], 'reg_event_id' );
221
+		if (isset($this->_req_data['event_id'])) {
222
+			$filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
223 223
 		}
224 224
 
225 225
 		return $filters;
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 		$this->_views['all']['count'] = $this->_total_registrations();
237 237
 		$this->_views['month']['count'] = $this->_total_registrations_this_month();
238 238
 		$this->_views['today']['count'] = $this->_total_registrations_today();
239
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_trash_registrations' ) ) {
240
-			$this->_views['incomplete']['count'] = $this->_total_registrations( 'incomplete' );
241
-			$this->_views['trash']['count'] = $this->_total_registrations( 'trash' );
239
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_trash_registrations')) {
240
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
241
+			$this->_views['trash']['count'] = $this->_total_registrations('trash');
242 242
 		}
243 243
 	}
244 244
 
@@ -250,23 +250,23 @@  discard block
 block discarded – undo
250 250
 	 * @param string $view
251 251
 	 * @return int
252 252
 	 */
253
-	protected function _total_registrations( $view = '' ){
253
+	protected function _total_registrations($view = '') {
254 254
 		$_where = array();
255
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
256
-		if( $EVT_ID ) {
255
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
256
+		if ($EVT_ID) {
257 257
 			$_where['EVT_ID'] = $EVT_ID;
258 258
 		}
259
-		switch ( $view ) {
259
+		switch ($view) {
260 260
 			case 'trash' :
261
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
261
+				return EEM_Registration::instance()->count_deleted(array($_where));
262 262
 				break;
263 263
 			case 'incomplete' :
264 264
 				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
265 265
 				break;
266 266
 			default :
267
-				$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
267
+				$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
268 268
 		}
269
-		return EEM_Registration::instance()->count( array( $_where ));
269
+		return EEM_Registration::instance()->count(array($_where));
270 270
 	}
271 271
 
272 272
 
@@ -276,24 +276,24 @@  discard block
 block discarded – undo
276 276
 	 * @access protected
277 277
 	 * @return int
278 278
 	 */
279
-	protected function _total_registrations_this_month(){
280
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
281
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
279
+	protected function _total_registrations_this_month() {
280
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
281
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
282 282
 		$this_year_r = date('Y', current_time('timestamp'));
283 283
 		$time_start = ' 00:00:00';
284 284
 		$time_end = ' 23:59:59';
285 285
 		$this_month_r = date('m', current_time('timestamp'));
286
-		$days_this_month = date( 't', current_time('timestamp') );
286
+		$days_this_month = date('t', current_time('timestamp'));
287 287
 		//setup date query.
288
-		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' );
289
-		$end_string = 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' );
290
-		$_where['REG_date']= array('BETWEEN',
288
+		$beginning_string = EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s');
289
+		$end_string = 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');
290
+		$_where['REG_date'] = array('BETWEEN',
291 291
 			array(
292 292
 				$beginning_string,
293 293
 				$end_string
294 294
 		));
295
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
296
-		return EEM_Registration::instance()->count(array( $_where ) );
295
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
296
+		return EEM_Registration::instance()->count(array($_where));
297 297
 	}
298 298
 
299 299
 
@@ -303,20 +303,20 @@  discard block
 block discarded – undo
303 303
 	 * @access protected
304 304
 	 * @return int
305 305
 	 */
306
-	protected function _total_registrations_today(){
306
+	protected function _total_registrations_today() {
307 307
 
308
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : FALSE;
309
-		$_where = $EVT_ID ? array( 'EVT_ID' => $EVT_ID ) : array();
308
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
309
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
310 310
 		$current_date = date('Y-m-d', current_time('timestamp'));
311 311
 		$time_start = ' 00:00:00';
312 312
 		$time_end = ' 23:59:59';
313
-		$_where['REG_date']= array('BETWEEN',
313
+		$_where['REG_date'] = array('BETWEEN',
314 314
 			array(
315
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_start, 'Y-m-d H:i:s' ),
316
-				EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $current_date . $time_end, 'Y-m-d H:i:s' )
315
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'),
316
+				EEM_Registration::instance()->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s')
317 317
 		));
318
-		$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
319
-		return EEM_Registration::instance()->count(array( $_where ) );
318
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
319
+		return EEM_Registration::instance()->count(array($_where));
320 320
 	}
321 321
 
322 322
 
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 	 * @param \EE_Registration $item
329 329
 	 * @return string
330 330
 	 */
331
-    function column__Reg_Status( EE_Registration $item ) {
332
-    	return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
331
+    function column__Reg_Status(EE_Registration $item) {
332
+    	return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
333 333
     }
334 334
 
335 335
 
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 	 * @param \EE_Registration $item
342 342
 	 * @return string
343 343
 	 */
344
-    function column_cb($item){
344
+    function column_cb($item) {
345 345
 	/** checkbox/lock **/
346
-	$transaction = $item->get_first_related( 'Transaction' );
347
-	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related( 'Payment' ) : 0;
348
-	return $payment_count > 0 ? sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() ) . '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID() );
346
+	$transaction = $item->get_first_related('Transaction');
347
+	$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0;
348
+	return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID()).'<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID());
349 349
     }
350 350
 
351 351
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	 * @param \EE_Registration $item
358 358
 	 * @return string
359 359
 	 */
360
-	function column__REG_ID(EE_Registration $item){
360
+	function column__REG_ID(EE_Registration $item) {
361 361
 		return $item->ID();
362 362
 	}
363 363
 
@@ -370,11 +370,11 @@  discard block
 block discarded – undo
370 370
 	 * @param \EE_Registration $item
371 371
 	 * @return string
372 372
 	 */
373
-	function column__REG_date(EE_Registration $item){
373
+	function column__REG_date(EE_Registration $item) {
374 374
 		$this->_set_related_details($item);
375 375
        		 //Build row actions
376
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id'] ), TXN_ADMIN_URL );
377
-		return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_lnk_url.'" title="' . esc_attr( $this->_transaction_details['title_attr'] ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
376
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=> $this->_transaction_details['id']), TXN_ADMIN_URL);
377
+		return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'.$this->_transaction_details['status'].'" href="'.$view_lnk_url.'" title="'.esc_attr($this->_transaction_details['title_attr']).'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date');
378 378
 	}
379 379
 
380 380
 
@@ -386,18 +386,18 @@  discard block
 block discarded – undo
386 386
 	 * @param \EE_Registration $item
387 387
 	 * @return string
388 388
 	 */
389
-	function column_event_name(EE_Registration $item){
390
-		$this->_set_related_details( $item );
389
+	function column_event_name(EE_Registration $item) {
390
+		$this->_set_related_details($item);
391 391
 		// page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
392
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$item->event_ID() ), EVENTS_ADMIN_URL );
392
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$item->event_ID()), EVENTS_ADMIN_URL);
393 393
 		$event_name = $item->event_name();
394 394
 		$event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
395
-		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID() ) ? '<a class="ee-status-color-' . $this->_event_details['status'] . '" href="' . $edit_event_url . '" title="' . esc_attr( $this->_event_details['title_attr'] ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ) ;
395
+		$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $item->event_ID()) ? '<a class="ee-status-color-'.$this->_event_details['status'].'" href="'.$edit_event_url.'" title="'.esc_attr($this->_event_details['title_attr']).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...');
396 396
 
397
-		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'event_id'=>$item->event_ID() ), REG_ADMIN_URL );
398
-		$actions['event_filter'] = '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Filter this list to only show registrations for %s', 'event_espresso' ), $event_name ) .'">' .  __( 'View Registrations', 'event_espresso' ) . '</a>';
397
+		$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id'=>$item->event_ID()), REG_ADMIN_URL);
398
+		$actions['event_filter'] = '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), $event_name).'">'.__('View Registrations', 'event_espresso').'</a>';
399 399
 
400
-		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions) );
400
+		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
401 401
 	}
402 402
 
403 403
 
@@ -409,18 +409,18 @@  discard block
 block discarded – undo
409 409
 	 * @param \EE_Registration $item
410 410
 	 * @return string
411 411
 	 */
412
-   	function column_DTT_EVT_start(EE_Registration $item){
412
+   	function column_DTT_EVT_start(EE_Registration $item) {
413 413
 		$datetime_strings = array();
414
-		$ticket = $item->ticket( TRUE );
415
-		if ( $ticket instanceof EE_Ticket ) {
414
+		$ticket = $item->ticket(TRUE);
415
+		if ($ticket instanceof EE_Ticket) {
416 416
 			$remove_defaults = array('default_where_conditions' => 'none');
417 417
 			$datetimes = $ticket->datetimes($remove_defaults);
418
-			foreach($datetimes as $datetime){
419
-				$datetime_strings[] = $datetime->get_i18n_datetime( 'DTT_EVT_start' );
418
+			foreach ($datetimes as $datetime) {
419
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
420 420
 			}
421
-			return implode("<br />",$datetime_strings);
421
+			return implode("<br />", $datetime_strings);
422 422
 		} else {
423
-			return __( 'There is no ticket on this registration', 'event_espresso' );
423
+			return __('There is no ticket on this registration', 'event_espresso');
424 424
 		}
425 425
     }
426 426
 
@@ -433,12 +433,12 @@  discard block
 block discarded – undo
433 433
 	 * @param \EE_Registration $item
434 434
 	 * @return string
435 435
 	 */
436
-   	function column_ATT_fname(EE_Registration $item){
436
+   	function column_ATT_fname(EE_Registration $item) {
437 437
    		$attendee = $item->attendee();
438 438
 
439
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
439
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
440 440
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
441
-		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee_name . '</a>' : $attendee_name;
441
+		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee_name.'</a>' : $attendee_name;
442 442
 		$link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
443 443
 
444 444
 		$t = $item->get_first_related('Transaction');
@@ -446,23 +446,23 @@  discard block
 block discarded – undo
446 446
 
447 447
 		//trash/restore/delete actions
448 448
 		$actions = array();
449
-		if ( $this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID() ) ) {
450
-			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
451
-			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Trash Registration', 'event_espresso' ) . '">' . __( 'Trash', 'event_espresso' ) . '</a>';
452
-		} elseif ( $this->_view == 'trash' ) {
449
+		if ($this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) {
450
+			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
451
+			$actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
452
+		} elseif ($this->_view == 'trash') {
453 453
 			// restore registration link
454
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID() ) ) {
455
-				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
456
-				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Registration', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
454
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) {
455
+				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
456
+				$actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
457 457
 			}
458
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID() ) ) {
459
-				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_registrations', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
458
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) {
459
+				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_registrations', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
460 460
 
461
-				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Registration Permanently', 'event_espresso' ). '">' . __( 'Delete', 'event_espresso' ) . '</a>';
461
+				$actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Registration Permanently', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>';
462 462
 			}
463 463
 		}
464 464
 
465
-		return sprintf('%1$s %2$s', $link, $this->row_actions($actions) );
465
+		return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
466 466
 	}
467 467
 
468 468
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	 * @param \EE_Registration $item
475 475
 	 * @return string
476 476
 	 */
477
-	function column_ATT_email( EE_Registration $item ) {
477
+	function column_ATT_email(EE_Registration $item) {
478 478
 		$attendee = $item->get_first_related('Attendee');
479 479
 		return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso') : $attendee->email();
480 480
 	}
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
 	 * @param \EE_Registration $item
489 489
 	 * @return string
490 490
 	 */
491
-	function column__REG_count(EE_Registration $item){
492
-		return  sprintf(__( '%1$s / %2$s', 'event_espresso' ), $item->count(), $item->group_size());
491
+	function column__REG_count(EE_Registration $item) {
492
+		return  sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
493 493
 	}
494 494
 
495 495
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	 * @param  EE_Registration $item registration object
502 502
 	 * @return string
503 503
 	 */
504
-	function column__REG_code( EE_Registration $item) {
504
+	function column__REG_code(EE_Registration $item) {
505 505
 		return $item->get('REG_code');
506 506
 	}
507 507
 
@@ -514,16 +514,16 @@  discard block
 block discarded – undo
514 514
 	 * @param \EE_Registration $item
515 515
 	 * @return string
516 516
 	 */
517
-	function column_PRC_amount(EE_Registration $item){
517
+	function column_PRC_amount(EE_Registration $item) {
518 518
 		$ticket = $item->ticket();
519 519
 
520
-		$content = isset( $_GET['event_id'] ) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">' . $ticket->name() . '</span><br />' : '';
520
+		$content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'.$ticket->name().'</span><br />' : '';
521 521
 
522
-		if ( $item->final_price() > 0 ) {
523
-			$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
522
+		if ($item->final_price() > 0) {
523
+			$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
524 524
 		} else {
525 525
 			// free event
526
-			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">' . __( 'free', 'event_espresso' ) . '</span>';
526
+			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'.__('free', 'event_espresso').'</span>';
527 527
 		}
528 528
 
529 529
 		return $content;
@@ -539,11 +539,11 @@  discard block
 block discarded – undo
539 539
 	 * @param \EE_Registration $item
540 540
 	 * @return string
541 541
 	 */
542
-	function column__REG_final_price(EE_Registration $item){
542
+	function column__REG_final_price(EE_Registration $item) {
543 543
 		$ticket = $item->ticket();
544
-		$content = isset( $_GET['event_id'] ) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">' . $ticket->name() . '</span><br />';
544
+		$content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket ? '' : '<span class="TKT_name">'.$ticket->name().'</span><br />';
545 545
 
546
-		$content .= '<span class="reg-pad-rght">' .  $item->pretty_final_price() . '</span>';
546
+		$content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
547 547
 		return $content;
548 548
 
549 549
 	}
@@ -557,8 +557,8 @@  discard block
 block discarded – undo
557 557
 	 * @param \EE_Registration $item
558 558
 	 * @return string
559 559
 	 */
560
-	function column__REG_paid(EE_Registration $item){
561
-		return '<span class="reg-pad-rght">' .  $item->pretty_paid() . '</span>';
560
+	function column__REG_paid(EE_Registration $item) {
561
+		return '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>';
562 562
 	}
563 563
 
564 564
 
@@ -570,11 +570,11 @@  discard block
 block discarded – undo
570 570
 	 * @param \EE_Registration $item
571 571
 	 * @return string
572 572
 	 */
573
-	function column_TXN_total(EE_Registration $item){
574
-		if($item->transaction()){
575
-			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
576
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">'  . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
577
-		}else{
573
+	function column_TXN_total(EE_Registration $item) {
574
+		if ($item->transaction()) {
575
+			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
576
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_total().'</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>';
577
+		} else {
578 578
 			return __("None", "event_espresso");
579 579
 		}
580 580
 	}
@@ -588,15 +588,15 @@  discard block
 block discarded – undo
588 588
 	 * @param \EE_Registration $item
589 589
 	 * @return string
590 590
 	 */
591
-	function column_TXN_paid(EE_Registration $item){
591
+	function column_TXN_paid(EE_Registration $item) {
592 592
 
593
-		if ( $item->count() == 1 ) {
593
+		if ($item->count() == 1) {
594 594
 			$transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
595
-			if ( $transaction->paid() >= $transaction->total() ) {
595
+			if ($transaction->paid() >= $transaction->total()) {
596 596
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
597 597
 			} else {
598
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
599
-				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $transaction->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">' . $item->transaction()->pretty_paid() . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
598
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
599
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID()) ? '<span class="reg-pad-rght"><a class="status-'.$transaction->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">'.$item->transaction()->pretty_paid().'</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
600 600
 			}
601 601
 		}
602 602
 
@@ -617,49 +617,49 @@  discard block
 block discarded – undo
617 617
 
618 618
 		$attendee = $item->attendee();
619 619
 		$ticket = $item->ticket();
620
-		$this->_set_related_details( $item );
620
+		$this->_set_related_details($item);
621 621
 
622 622
 		//Build row actions
623
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
624
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$item->attendee_ID() ), REG_ADMIN_URL );
623
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
624
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$item->attendee_ID()), REG_ADMIN_URL);
625 625
 
626 626
 		// page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
627 627
 		//$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
628
-		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL, true );
628
+		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL, true);
629 629
 
630 630
 
631 631
 		//Build row actions
632
-		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '
632
+		$view_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '
633 633
 			<li>
634
-			<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
634
+			<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
635 635
 				<div class="dashicons dashicons-clipboard"></div>
636 636
 			</a>
637 637
 			</li>' : '';
638 638
 
639
-		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee' ) &&  $attendee instanceof EE_Attendee ?'
639
+		$edit_lnk = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') && $attendee instanceof EE_Attendee ? '
640 640
 			<li>
641
-			<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact Details', 'event_espresso' ) . '" class="tiny-text">
641
+			<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text">
642 642
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
643 643
 			</a>
644 644
 			</li>' : '';
645 645
 
646
-		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration', $item->ID() ) ? '
646
+		 $resend_reg_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration', $item->ID()) ? '
647 647
 			<li>
648
-			<a href="'.$resend_reg_lnk_url.'" title="' . esc_attr__( 'Resend Registration Details', 'event_espresso' ) . '" class="tiny-text">
648
+			<a href="'.$resend_reg_lnk_url.'" title="'.esc_attr__('Resend Registration Details', 'event_espresso').'" class="tiny-text">
649 649
 				<div class="dashicons dashicons-email-alt"></div>
650 650
 			</a>
651 651
 			</li>' : '';
652 652
 
653 653
 		// page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
654
-		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id'] ), TXN_ADMIN_URL );
655
-		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id'] ) ? '
654
+		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$this->_transaction_details['id']), TXN_ADMIN_URL);
655
+		$view_txn_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? '
656 656
 			<li>
657
-			<a class="ee-status-color-' . $this->_transaction_details['status'] . '" href="'.$view_txn_lnk_url.'"  title="' . $this->_transaction_details['title_attr'] . '" class="tiny-text">
657
+			<a class="ee-status-color-' . $this->_transaction_details['status'].'" href="'.$view_txn_lnk_url.'"  title="'.$this->_transaction_details['title_attr'].'" class="tiny-text">
658 658
 				<div class="dashicons dashicons-cart"></div>
659 659
 			</a>
660 660
 			</li>' : '';
661 661
 
662
-			return $this->_action_string( $view_lnk . $edit_lnk . $resend_reg_lnk . $view_txn_lnk, $item, 'ul', 'reg-overview-actions-ul' );
662
+			return $this->_action_string($view_lnk.$edit_lnk.$resend_reg_lnk.$view_txn_lnk, $item, 'ul', 'reg-overview-actions-ul');
663 663
 	}
664 664
 
665 665
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -574,7 +576,7 @@  discard block
 block discarded – undo
574 576
 		if($item->transaction()){
575 577
 			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
576 578
 			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->transaction_ID() ) ? '<span class="reg-pad-rght"><a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">'  . $item->transaction()->pretty_total() . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
577
-		}else{
579
+		} else{
578 580
 			return __("None", "event_espresso");
579 581
 		}
580 582
 	}
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 4 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1565,8 +1565,6 @@  discard block
 block discarded – undo
1565 1565
 	 * 		form_form_field_input__wrap
1566 1566
 	 *
1567 1567
 	 * 		@access 		public
1568
-	 * 		@param 		string 		$label
1569
-	 * 		@return 		string
1570 1568
 	 */
1571 1569
 	public function form_form_field_input__wrap( $input ) {
1572 1570
 		return '
@@ -1649,6 +1647,10 @@  discard block
 block discarded – undo
1649 1647
 
1650 1648
 
1651 1649
 	//TODO: try changing this to use the model directly... not indirectly through creating a default object...
1650
+
1651
+	/**
1652
+	 * @param boolean $REG_ID
1653
+	 */
1652 1654
 	private function _save_new_answer( $REG_ID, $QST_ID, $ans ) {
1653 1655
 		$set_values = array(
1654 1656
 			'QST_ID' => $QST_ID,
Please login to merge, or discard this patch.
Braces   +30 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -79,8 +81,9 @@  discard block
 block discarded – undo
79 81
 	public function clear_comment_link( $link, $comment, $args ) {
80 82
 		//gotta make sure this only happens on this route
81 83
 		$post_type = get_post_type( $comment->comment_post_ID);
82
-		if ( $post_type == 'espresso_attendees' )
83
-			return '#commentsdiv';
84
+		if ( $post_type == 'espresso_attendees' ) {
85
+					return '#commentsdiv';
86
+		}
84 87
 		return $link;
85 88
 	}
86 89
 
@@ -834,9 +837,9 @@  discard block
 block discarded – undo
834 837
 
835 838
 		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
836 839
 
837
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
838
-			return TRUE;
839
-		else {
840
+		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) {
841
+					return TRUE;
842
+		} else {
840 843
 			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
841 844
 			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
842 845
 			$this->_registration = NULL;
@@ -933,7 +936,7 @@  discard block
 block discarded – undo
933 936
 					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
934 937
 					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
935 938
 			));
936
-		}elseif($this_month_a || $this_month){
939
+		} elseif($this_month_a || $this_month){
937 940
 			$this_month_r = date('m', current_time('timestamp'));
938 941
 			$days_this_month = date( 't', current_time('timestamp') );
939 942
 			$_where['REG_date']= array('BETWEEN',
@@ -941,18 +944,18 @@  discard block
 block discarded – undo
941 944
 					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
942 945
 					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' )
943 946
 			));
944
-		}elseif($month_range){
947
+		} elseif($month_range){
945 948
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
946 949
 			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
947 950
 			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
948 951
 			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
949 952
 			$_where['REG_date']= array('BETWEEN',
950 953
 				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' ) ) );
951
-		}elseif($start_date && $end_date){
954
+		} elseif($start_date && $end_date){
952 955
 			throw new EE_Error("not yet supported");
953
-		}elseif($start_date){
956
+		} elseif($start_date){
954 957
 			throw new EE_Error("not yet supported");
955
-		}elseif($end_date){
958
+		} elseif($end_date){
956 959
 			throw new EE_Error("not yet supported");
957 960
 		}
958 961
 
@@ -1876,8 +1879,9 @@  discard block
 block discarded – undo
1876 1879
 			// cycle thru checkboxes
1877 1880
 			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1878 1881
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1879
-				if ( ! $REG instanceof EE_Registration )
1880
-					continue;
1882
+				if ( ! $REG instanceof EE_Registration ) {
1883
+									continue;
1884
+				}
1881 1885
 				$deleted = $this->_delete_registration($REG);
1882 1886
 				if ( !$deleted ) {
1883 1887
 					$success = 0;
@@ -1916,8 +1920,9 @@  discard block
 block discarded – undo
1916 1920
 
1917 1921
 		$all_trashed = TRUE;
1918 1922
 		foreach ( $REGS as $registration ) {
1919
-			if ( ! $registration->get('REG_deleted') )
1920
-				$all_trashed = FALSE;
1923
+			if ( ! $registration->get('REG_deleted') ) {
1924
+							$all_trashed = FALSE;
1925
+			}
1921 1926
 		}
1922 1927
 
1923 1928
 		if ( ! $all_trashed ) {
@@ -1943,8 +1948,10 @@  discard block
 block discarded – undo
1943 1948
 			//now delete permanently the checkins related to this registration.
1944 1949
 			$registration->delete_related_permanently('Checkin');
1945 1950
 
1946
-			if ( $registration->ID() === $REG->ID() )
1947
-				continue; //we don't want to delete permanently the existing registration just yet.
1951
+			if ( $registration->ID() === $REG->ID() ) {
1952
+							continue;
1953
+			}
1954
+			//we don't want to delete permanently the existing registration just yet.
1948 1955
 
1949 1956
 			//remove relation to transaction for these registrations if NOT the existing registrations
1950 1957
 			$registration->_remove_relations('Transaction');
@@ -1997,8 +2004,9 @@  discard block
 block discarded – undo
1997 2004
 
1998 2005
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
1999 2006
 
2000
-		if ( defined('DOING_AJAX' ) )
2001
-			$this->_return_json();
2007
+		if ( defined('DOING_AJAX' ) ) {
2008
+					$this->_return_json();
2009
+		}
2002 2010
 
2003 2011
 
2004 2012
 		// grab header
@@ -2412,8 +2420,9 @@  discard block
 block discarded – undo
2412 2420
 			}
2413 2421
 		}
2414 2422
 
2415
-		if ( $success === FALSE )
2416
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2423
+		if ( $success === FALSE ) {
2424
+					EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2425
+		}
2417 2426
 
2418 2427
 	}
2419 2428
 
Please login to merge, or discard this patch.
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 
125 125
 	/**
126 126
 	 * 		grab url requests and route them
127
-	*		@access private
128
-	*		@return void
129
-	*/
127
+	 *		@access private
128
+	 *		@return void
129
+	 */
130 130
 	public function _set_page_routes() {
131 131
 
132 132
 		$this->_get_registration_status_array();
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 						'title' => __('Registrations Other', 'event_espresso'),
399 399
 						'filename' => 'registrations_overview_other'
400 400
 					)
401
-                ),
401
+				),
402 402
 				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
403 403
 				'qtips' => array('Registration_List_Table_Tips'),
404 404
 				'list_table' => 'EE_Registrations_List_Table',
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
413 413
 					'persistent' => FALSE
414 414
 					),
415
-                'help_tabs' => array(
415
+				'help_tabs' => array(
416 416
 					'registrations_details_help_tab' => array(
417 417
 						'title' => __('Registration Details', 'event_espresso'),
418 418
 						'filename' => 'registrations_details'
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 					'order' => 20
477 477
 					),
478 478
 				'list_table' => 'EE_Attendee_Contact_List_Table',
479
-                'help_tabs' => array(
479
+				'help_tabs' => array(
480 480
 					'registrations_contact_list_help_tab' => array(
481 481
 						'title' => __('Registrations Contact List', 'event_espresso'),
482 482
 						'filename' => 'registrations_contact_list'
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 						'title' => __('Contact List Other', 'event_espresso'),
494 494
 						'filename' => 'registrations_contact_list_other'
495 495
 					)
496
-                ),
496
+				),
497 497
 				'help_tour' => array( 'Contact_List_Help_Tour' ),
498 498
 				'metaboxes' => array(),
499 499
 				'require_nonce' => FALSE
@@ -525,9 +525,9 @@  discard block
 block discarded – undo
525 525
 
526 526
 	/**
527 527
 	 * 		get list of registration statuses
528
-	*		@access private
529
-	*		@return void
530
-	*/
528
+	 *		@access private
529
+	 *		@return void
530
+	 */
531 531
 	private function _get_registration_status_array() {
532 532
 		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
533 533
 	}
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 			return TRUE;
830 830
 		}
831 831
 
832
-	    $REG = EEM_Registration::instance();
832
+		$REG = EEM_Registration::instance();
833 833
 
834 834
 		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
835 835
 
@@ -1048,9 +1048,9 @@  discard block
 block discarded – undo
1048 1048
 
1049 1049
 	/**
1050 1050
 	 * 		generates HTML for the View Registration Details Admin page
1051
-	*		@access protected
1052
-	*		@return void
1053
-	*/
1051
+	 *		@access protected
1052
+	 *		@return void
1053
+	 */
1054 1054
 	protected function _registration_details() {
1055 1055
 
1056 1056
 		$this->_template_args = array();
@@ -1127,9 +1127,9 @@  discard block
 block discarded – undo
1127 1127
 
1128 1128
 	/**
1129 1129
 	 * 		_set_approve_or_decline_reg_status_buttons
1130
-	*		@access protected
1131
-	*		@return string
1132
-	*/
1130
+	 *		@access protected
1131
+	 *		@return string
1132
+	 */
1133 1133
 	public function set_reg_status_buttons_metabox() {
1134 1134
 
1135 1135
 		//is registration for free event OR for a completed transaction? This will determine whether the set to pending option is shown.
@@ -1318,10 +1318,10 @@  discard block
 block discarded – undo
1318 1318
 
1319 1319
 	/**
1320 1320
 	 * 		approve_registration
1321
-	*		@access protected
1322
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1323
-	*		@return void
1324
-	*/
1321
+	 *		@access protected
1322
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1323
+	 *		@return void
1324
+	 */
1325 1325
 	protected function approve_registration( $notify = false ) {
1326 1326
 		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1327 1327
 	}
@@ -1331,10 +1331,10 @@  discard block
 block discarded – undo
1331 1331
 
1332 1332
 	/**
1333 1333
 	 * 		decline_registration
1334
-	*		@access protected
1335
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1336
-	*		@return void
1337
-	*/
1334
+	 *		@access protected
1335
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1336
+	 *		@return void
1337
+	 */
1338 1338
 	protected function decline_registration( $notify = false ) {
1339 1339
 		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1340 1340
 	}
@@ -1344,10 +1344,10 @@  discard block
 block discarded – undo
1344 1344
 
1345 1345
 	/**
1346 1346
 	 * 		cancel_registration
1347
-	*		@access protected
1348
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1349
-	*		@return void
1350
-	*/
1347
+	 *		@access protected
1348
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1349
+	 *		@return void
1350
+	 */
1351 1351
 	protected function cancel_registration( $notify = false ) {
1352 1352
 		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1353 1353
 	}
@@ -1358,10 +1358,10 @@  discard block
 block discarded – undo
1358 1358
 
1359 1359
 	/**
1360 1360
 	 * 		not_approve_registration
1361
-	*		@access protected
1362
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1363
-	*		@return void
1364
-	*/
1361
+	 *		@access protected
1362
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1363
+	 *		@return void
1364
+	 */
1365 1365
 	protected function not_approve_registration( $notify = false ) {
1366 1366
 		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1367 1367
 	}
@@ -1370,10 +1370,10 @@  discard block
 block discarded – undo
1370 1370
 
1371 1371
 	/**
1372 1372
 	 * 		decline_registration
1373
-	*		@access protected
1374
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1375
-	*		@return void
1376
-	*/
1373
+	 *		@access protected
1374
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1375
+	 *		@return void
1376
+	 */
1377 1377
 	protected function pending_registration( $notify = false ) {
1378 1378
 		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1379 1379
 	}
@@ -1383,9 +1383,9 @@  discard block
 block discarded – undo
1383 1383
 
1384 1384
 	/**
1385 1385
 	 * 		generates HTML for the Registration main meta box
1386
-	*		@access public
1387
-	*		@return void
1388
-	*/
1386
+	 *		@access public
1387
+	 *		@return void
1388
+	 */
1389 1389
 	public function _reg_details_meta_box() {
1390 1390
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1391 1391
 		$this->_session = $transaction->session_data();
@@ -1467,9 +1467,9 @@  discard block
 block discarded – undo
1467 1467
 
1468 1468
 	/**
1469 1469
 	 * 		generates HTML for the Registration Questions meta box
1470
-	*		@access public
1471
-	*		@return void
1472
-	*/
1470
+	 *		@access public
1471
+	 *		@return void
1472
+	 */
1473 1473
 	public function _reg_questions_meta_box() {
1474 1474
 
1475 1475
 		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 );
@@ -1577,9 +1577,9 @@  discard block
 block discarded – undo
1577 1577
 
1578 1578
 	/**
1579 1579
 	 * 		generates HTML for the Registration main meta box
1580
-	*		@access protected
1581
-	*		@return void
1582
-	*/
1580
+	 *		@access protected
1581
+	 *		@return void
1582
+	 */
1583 1583
 	protected function _update_attendee_registration_form() {
1584 1584
 		$qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE;
1585 1585
 		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
@@ -1661,12 +1661,12 @@  discard block
 block discarded – undo
1661 1661
 
1662 1662
 	/**
1663 1663
 	 * 		generates HTML for the Registration main meta box
1664
-	*		@access public
1665
-	*		@return void
1666
-	*/
1664
+	 *		@access public
1665
+	 *		@return void
1666
+	 */
1667 1667
 	public function _reg_attendees_meta_box() {
1668 1668
 
1669
-	    $REG = EEM_Registration::instance();
1669
+		$REG = EEM_Registration::instance();
1670 1670
 		//get all other registrations on this transaction, and cache
1671 1671
 		//the attendees for them so we don't have to run another query using force_join
1672 1672
 		$registrations = $REG->get_all(array(
@@ -1719,9 +1719,9 @@  discard block
 block discarded – undo
1719 1719
 
1720 1720
 	/**
1721 1721
 	 * 		generates HTML for the Edit Registration side meta box
1722
-	*		@access public
1723
-	*		@return void
1724
-	*/
1722
+	 *		@access public
1723
+	 *		@return void
1724
+	 */
1725 1725
 	public function _reg_registrant_side_meta_box() {
1726 1726
 
1727 1727
 		/*@var $attendee EE_Attendee */
@@ -2067,9 +2067,9 @@  discard block
 block discarded – undo
2067 2067
 
2068 2068
 	/**
2069 2069
 	 * 		set_reg_event
2070
-	*		@access private
2071
-	*		@return boolean
2072
-	*/
2070
+	 *		@access private
2071
+	 *		@return boolean
2072
+	 */
2073 2073
 	private function _set_reg_event() {
2074 2074
 		if ( is_object( $this->_reg_event )) {
2075 2075
 			return TRUE;
@@ -2173,9 +2173,9 @@  discard block
 block discarded – undo
2173 2173
 
2174 2174
 	/**
2175 2175
 	 * 		generates HTML for the Attendee Contact List
2176
-	*		@access protected
2177
-	*		@return void
2178
-	*/
2176
+	 *		@access protected
2177
+	 *		@return void
2178
+	 */
2179 2179
 	protected function _attendee_contact_list_table() {
2180 2180
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2181 2181
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
@@ -2189,9 +2189,9 @@  discard block
 block discarded – undo
2189 2189
 	/**
2190 2190
 	 * 		get_attendees
2191 2191
 	 * 		@param bool $count whether to return count or data.
2192
-	*		@access public
2193
-	*		@return array
2194
-	*/
2192
+	 *		@access public
2193
+	 *		@return array
2194
+	 */
2195 2195
 	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2196 2196
 
2197 2197
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -2509,9 +2509,9 @@  discard block
 block discarded – undo
2509 2509
 
2510 2510
 	/**
2511 2511
 	 * 		_attendee_details
2512
-	*		@access protected
2513
-	*		@return void
2514
-	*/
2512
+	 *		@access protected
2513
+	 *		@return void
2514
+	 */
2515 2515
 	public function attendee_registrations_meta_box( $post ) {
2516 2516
 
2517 2517
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
@@ -2544,10 +2544,10 @@  discard block
 block discarded – undo
2544 2544
 
2545 2545
 	/**
2546 2546
 	 * 		_trash_or_restore_attendee
2547
-	*		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2548
-	*		@access protected
2549
-	*		@return void
2550
-	*/
2547
+	 *		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2548
+	 *		@access protected
2549
+	 *		@return void
2550
+	 */
2551 2551
 	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2552 2552
 
2553 2553
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Spacing   +492 added lines, -492 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param bool $routing
43 43
 	 * @return Registrations_Admin_Page
44 44
 	 */
45
-	public function __construct( $routing = TRUE ) {
46
-		parent::__construct( $routing );
45
+	public function __construct($routing = TRUE) {
46
+		parent::__construct($routing);
47 47
 	}
48 48
 
49 49
 
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 			'espresso_attendees' => 'edit_attendee'
71 71
 			);
72 72
 
73
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
73
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
74 74
 		//add filters so that the comment urls don't take users to a confusing 404 page
75
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
75
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
76 76
 	}
77 77
 
78 78
 
79
-	public function clear_comment_link( $link, $comment, $args ) {
79
+	public function clear_comment_link($link, $comment, $args) {
80 80
 		//gotta make sure this only happens on this route
81
-		$post_type = get_post_type( $comment->comment_post_ID);
82
-		if ( $post_type == 'espresso_attendees' )
81
+		$post_type = get_post_type($comment->comment_post_ID);
82
+		if ($post_type == 'espresso_attendees')
83 83
 			return '#commentsdiv';
84 84
 		return $link;
85 85
 	}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 	protected function _ajax_hooks() {
89 89
 		//todo: all hooks for registrations ajax goes in here
90
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
90
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
91 91
 	}
92 92
 
93 93
 
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 					'add-attendee' => __('Add Contact', 'event_espresso'),
103 103
 					'edit' => __('Edit Contact', 'event_espresso'),
104 104
 					'report'=>  __("Event Registrations CSV Report", "event_espresso"),
105
-					'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
106
-					'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
105
+					'report_all' => __('All Registrations CSV Report', 'event_espresso'),
106
+					'contact_list_report' => __('Contact List Report', 'event_espresso'),
107 107
 					'contact_list_export'=>  __("Export Data", "event_espresso"),
108 108
 				),
109 109
 			'publishbox' => array(
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 
131 131
 		$this->_get_registration_status_array();
132 132
 
133
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
134
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
135
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
133
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
134
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
135
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
136 136
 
137 137
 		$this->_page_routes = array(
138 138
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 				'edit_registration'	=> array(
151 151
 						'func' => '_registration_details',
152
-						'args' => array( 'edit' ),
152
+						'args' => array('edit'),
153 153
 						'noheader' => TRUE,
154 154
 						'capability' => 'ee_edit_registration',
155 155
 						'obj_id' => $reg_id
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
 				'restore_registrations' => array(
166 166
 					'func' => '_trash_or_restore_registrations',
167
-					'args' => array( 'trash' => FALSE ),
167
+					'args' => array('trash' => FALSE),
168 168
 					'noheader' => TRUE,
169 169
 					'capability' => 'ee_delete_registrations'
170 170
 					),
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 						'filename' => 'registrations_overview_other'
399 399
 					)
400 400
                 ),
401
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
401
+				'help_tour' => array('Registration_Overview_Help_Tour'),
402 402
 				'qtips' => array('Registration_List_Table_Tips'),
403 403
 				'list_table' => 'EE_Registrations_List_Table',
404 404
 				'require_nonce' => FALSE
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 				'nav' => array(
409 409
 					'label' => __('REG Details', 'event_espresso'),
410 410
 					'order' => 15,
411
-					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
411
+					'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
412 412
 					'persistent' => FALSE
413 413
 					),
414 414
                 'help_tabs' => array(
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 						'filename' => 'registrations_details_registrant_details'
430 430
 						)
431 431
 					),
432
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
433
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
432
+				'help_tour' => array('Registration_Details_Help_Tour'),
433
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
434 434
 				'require_nonce' => FALSE
435 435
 				),
436 436
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 					'order' => 15,
455 455
 					'persistent' => FALSE
456 456
 					),
457
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
457
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
458 458
 				'require_nonce' => FALSE
459 459
 				),
460 460
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 					'label' => __('Edit Contact', 'event_espresso'),
464 464
 					'order' => 15,
465 465
 					'persistent' => FALSE,
466
-					'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
466
+					'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
467 467
 					),
468 468
 				'metaboxes' => array('attendee_editor_metaboxes'),
469 469
 				'require_nonce' => FALSE
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 						'filename' => 'registrations_contact_list_other'
494 494
 					)
495 495
                 ),
496
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
496
+				'help_tour' => array('Contact_List_Help_Tour'),
497 497
 				'metaboxes' => array(),
498 498
 				'require_nonce' => FALSE
499 499
 				),
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 	*		@return void
529 529
 	*/
530 530
 	private function _get_registration_status_array() {
531
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
531
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
532 532
 	}
533 533
 
534 534
 
@@ -551,11 +551,11 @@  discard block
 block discarded – undo
551 551
 	public function load_scripts_styles() {
552 552
 		//style
553 553
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
554
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
554
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
555 555
 		wp_enqueue_style('espresso_reg');
556 556
 
557 557
 		//script
558
-		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);
558
+		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);
559 559
 		wp_enqueue_script('espresso_reg');
560 560
 	}
561 561
 
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
 	public function load_scripts_styles_edit_attendee() {
565 565
 		//stuff to only show up on our attendee edit details page.
566 566
 		$attendee_details_translations = array(
567
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
567
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
568 568
 			);
569
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
569
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
570 570
 		wp_enqueue_script('jquery-validate');
571 571
 	}
572 572
 
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		//styles
576 576
 		wp_enqueue_style('espresso-ui-theme');
577 577
 		//scripts
578
-		EE_Registry::$i18n_js_strings['update_att_qstns'] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
578
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
579 579
 	}
580 580
 
581 581
 
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 
586 586
 	public function load_scripts_styles_contact_list() {
587 587
 		wp_deregister_style('espresso_reg');
588
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
588
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
589 589
 		wp_enqueue_style('espresso_att');
590 590
 	}
591 591
 
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
 
595 595
 
596 596
 	public function load_scripts_styles_new_registration() {
597
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
597
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
598 598
 		wp_enqueue_script('ee-spco-for-admin');
599
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
599
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
600 600
 		EE_Form_Section_Proper::wp_enqueue_scripts();
601 601
 		EED_Ticket_Selector::load_tckt_slctr_assets();
602 602
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -635,23 +635,23 @@  discard block
 block discarded – undo
635 635
 
636 636
 		/** setup reg status bulk actions **/
637 637
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
638
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
638
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
639 639
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
640 640
 		}
641 641
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
642
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
642
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
643 643
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
644 644
 		}
645 645
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
646
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
646
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
647 647
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
648 648
 		}
649 649
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
650
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
650
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
651 651
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
652 652
 		}
653 653
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
654
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
654
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
655 655
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
656 656
 		}
657 657
 
@@ -660,29 +660,29 @@  discard block
 block discarded – undo
660 660
 				'slug' => 'all',
661 661
 				'label' => __('View All Registrations', 'event_espresso'),
662 662
 				'count' => 0,
663
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
663
+				'bulk_action' => array_merge($def_reg_status_actions, array(
664 664
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
665
-					) )
665
+					))
666 666
 				),
667 667
 			'month' => array(
668 668
 				'slug' => 'month',
669 669
 				'label' => __('This Month', 'event_espresso'),
670 670
 				'count' => 0,
671
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
671
+				'bulk_action' => array_merge($def_reg_status_actions, array(
672 672
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
673 673
 					))
674 674
 				),
675 675
 			'today' => array(
676 676
 				'slug' => 'today',
677
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
677
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
678 678
 				'count' => 0,
679
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
679
+				'bulk_action' => array_merge($def_reg_status_actions, array(
680 680
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
681 681
 					))
682 682
 				)
683 683
 			);
684 684
 
685
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
685
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
686 686
 			$this->_views['incomplete'] = array(
687 687
 				'slug' => 'incomplete',
688 688
 				'label' => __('Incomplete', 'event_espresso'),
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 				)
719 719
 			);
720 720
 
721
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
721
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
722 722
 			$this->_views['trash'] = array(
723 723
 				'slug' => 'trash',
724 724
 				'label' => __('Trash', 'event_espresso'),
@@ -753,42 +753,42 @@  discard block
 block discarded – undo
753 753
 				'desc' => __('View Transaction Details', 'event_espresso')
754 754
 				)
755 755
  			);
756
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
756
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
757 757
 			$fc_items['resend_registration'] = array(
758 758
 				'class' => 'dashicons dashicons-email-alt',
759 759
 				'desc' => __('Resend Registration Details', 'event_espresso')
760 760
 				);
761 761
 		} else {
762
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
762
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
763 763
 		}
764 764
 
765 765
 		$sc_items = array(
766 766
 			'approved_status' => array(
767
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
768
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
767
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
768
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
769 769
 				),
770 770
 			'pending_status' => array(
771
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
772
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
771
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
772
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
773 773
 				),
774 774
 			'incomplete_status' => array(
775
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
776
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
775
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
776
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
777 777
 			),
778 778
 			'not_approved' => array(
779
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
780
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
779
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
780
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
781 781
 				),
782 782
 			'declined_status' => array(
783
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
784
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
783
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
784
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
785 785
 				),
786 786
 			'cancelled_status' => array(
787
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
788
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
787
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
788
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
789 789
 				)
790 790
 			);
791
-		return array_merge( $fc_items, $sc_items );
791
+		return array_merge($fc_items, $sc_items);
792 792
 	}
793 793
 
794 794
 
@@ -801,15 +801,15 @@  discard block
 block discarded – undo
801 801
 
802 802
 
803 803
 	protected function _registrations_overview_list_table() {
804
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
805
-		if ( $EVT_ID ) {
806
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) {
807
-				$this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' );
804
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
805
+		if ($EVT_ID) {
806
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) {
807
+				$this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2');
808 808
 			}
809
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
810
-			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : '';
809
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
810
+			$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : '';
811 811
 		}
812
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
812
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
813 813
 		$this->display_admin_list_table_page_with_no_sidebar();
814 814
 	}
815 815
 
@@ -824,19 +824,19 @@  discard block
 block discarded – undo
824 824
 	 */
825 825
 	private function _set_registration_object() {
826 826
 		//get out if we've already set the object
827
-		if ( is_object( $this->_registration )) {
827
+		if (is_object($this->_registration)) {
828 828
 			return TRUE;
829 829
 		}
830 830
 
831 831
 	    $REG = EEM_Registration::instance();
832 832
 
833
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
833
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
834 834
 
835
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
835
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
836 836
 			return TRUE;
837 837
 		else {
838
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
839
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
838
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
839
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
840 840
 			$this->_registration = NULL;
841 841
 			return FALSE;
842 842
 		}
@@ -855,25 +855,25 @@  discard block
 block discarded – undo
855 855
 	 * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set)
856 856
 	 * @return mixed (int|array)  int = count || array of registration objects
857 857
 	 */
858
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
859
-
860
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
861
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
862
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
863
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
864
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE;
865
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE  : FALSE;
858
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
859
+
860
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
861
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
862
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
863
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
864
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE;
865
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE  : FALSE;
866 866
 		$start_date = FALSE;
867 867
 		$end_date = FALSE;
868 868
 		$_where = array();
869
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE;
870
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE;
869
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE;
870
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE;
871 871
 
872 872
 		//set orderby
873 873
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
874 874
 
875 875
 
876
-		switch ( $this->_req_data['orderby'] ) {
876
+		switch ($this->_req_data['orderby']) {
877 877
 			case '_REG_ID':
878 878
 				$orderby = 'REG_ID';
879 879
 				break;
@@ -893,26 +893,26 @@  discard block
 block discarded – undo
893 893
 				$orderby = 'REG_date';
894 894
 		}
895 895
 
896
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
897
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
898
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
896
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
897
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
898
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
899 899
 
900 900
 
901
-		$offset = ($current_page-1)*$per_page;
902
-		$limit = $count  ? NULL : array( $offset, $per_page );
901
+		$offset = ($current_page - 1) * $per_page;
902
+		$limit = $count ? NULL : array($offset, $per_page);
903 903
 
904
-		if($EVT_ID){
905
-			$_where['EVT_ID']=$EVT_ID;
904
+		if ($EVT_ID) {
905
+			$_where['EVT_ID'] = $EVT_ID;
906 906
 		}
907
-		if($CAT_ID){
907
+		if ($CAT_ID) {
908 908
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
909 909
 		}
910
-		if ( $incomplete ) {
910
+		if ($incomplete) {
911 911
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
912 912
 		} else if ( ! $trash) {
913
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
913
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
914 914
 		}
915
-		if($reg_status){
915
+		if ($reg_status) {
916 916
 			$_where['STS_ID'] = $reg_status;
917 917
 		}
918 918
 
@@ -924,103 +924,103 @@  discard block
 block discarded – undo
924 924
 		$time_start = ' 00:00:00';
925 925
 		$time_end = ' 23:59:59';
926 926
 
927
-		if($today_a || $today ){
927
+		if ($today_a || $today) {
928 928
 			$curdate = date('Y-m-d', current_time('timestamp'));
929
-			$_where['REG_date']= array('BETWEEN',
929
+			$_where['REG_date'] = array('BETWEEN',
930 930
 				array(
931
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
932
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
931
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
932
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
933 933
 			));
934
-		}elseif($this_month_a || $this_month){
934
+		}elseif ($this_month_a || $this_month) {
935 935
 			$this_month_r = date('m', current_time('timestamp'));
936
-			$days_this_month = date( 't', current_time('timestamp') );
937
-			$_where['REG_date']= array('BETWEEN',
936
+			$days_this_month = date('t', current_time('timestamp'));
937
+			$_where['REG_date'] = array('BETWEEN',
938 938
 				array(
939
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
940
-					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' )
939
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
940
+					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')
941 941
 			));
942
-		}elseif($month_range){
942
+		}elseif ($month_range) {
943 943
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
944
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
945
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
946
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
947
-			$_where['REG_date']= array('BETWEEN',
948
-				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' ) ) );
949
-		}elseif($start_date && $end_date){
944
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
945
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
946
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
947
+			$_where['REG_date'] = array('BETWEEN',
948
+				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')));
949
+		}elseif ($start_date && $end_date) {
950 950
 			throw new EE_Error("not yet supported");
951
-		}elseif($start_date){
951
+		}elseif ($start_date) {
952 952
 			throw new EE_Error("not yet supported");
953
-		}elseif($end_date){
953
+		}elseif ($end_date) {
954 954
 			throw new EE_Error("not yet supported");
955 955
 		}
956 956
 
957
-		if ( isset( $this->_req_data['s'] ) ) {
958
-			$sstr = '%' . $this->_req_data['s'] . '%';
957
+		if (isset($this->_req_data['s'])) {
958
+			$sstr = '%'.$this->_req_data['s'].'%';
959 959
 			$_where['OR'] = array(
960
-				'Event.EVT_name' => array( 'LIKE', $sstr),
961
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
962
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
963
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
964
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
965
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
966
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
967
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
968
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
969
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
970
-				'REG_final_price' => array( 'LIKE', $sstr ),
971
-				'REG_code' => array( 'LIKE', $sstr ),
972
-				'REG_count' => array( 'LIKE' , $sstr ),
973
-				'REG_group_size' => array( 'LIKE' , $sstr ),
974
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
975
-				'Ticket.TKT_description' => array( 'LIKE', $sstr )
960
+				'Event.EVT_name' => array('LIKE', $sstr),
961
+				'Event.EVT_desc' => array('LIKE', $sstr),
962
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
963
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
964
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
965
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
966
+				'Attendee.ATT_email' => array('LIKE', $sstr),
967
+				'Attendee.ATT_address' => array('LIKE', $sstr),
968
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
969
+				'Attendee.ATT_city' => array('LIKE', $sstr),
970
+				'REG_final_price' => array('LIKE', $sstr),
971
+				'REG_code' => array('LIKE', $sstr),
972
+				'REG_count' => array('LIKE', $sstr),
973
+				'REG_group_size' => array('LIKE', $sstr),
974
+				'Ticket.TKT_name' => array('LIKE', $sstr),
975
+				'Ticket.TKT_description' => array('LIKE', $sstr)
976 976
 				);
977 977
 		}
978 978
 
979 979
 		//capability checks
980
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
980
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
981 981
 			$_where['AND'] = array(
982 982
 				'Event.EVT_wp_user' => get_current_user_id()
983 983
 				);
984 984
 		}
985 985
 
986 986
 
987
-		if( $count ){
988
-			if ( $trash ) {
989
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
990
-			} else if ( $incomplete ) {
991
-				return EEM_Registration::instance()->count( array( $_where ));
987
+		if ($count) {
988
+			if ($trash) {
989
+				return EEM_Registration::instance()->count_deleted(array($_where));
990
+			} else if ($incomplete) {
991
+				return EEM_Registration::instance()->count(array($_where));
992 992
 			} else {
993
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
993
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
994 994
 			}
995 995
 		} else {
996 996
 			//make sure we remove default where conditions cause all registrations matching query are returned
997
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
998
-			if ( $per_page !== -1 ) {
997
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
998
+			if ($per_page !== -1) {
999 999
 				$query_params['limit'] = $limit;
1000 1000
 			}
1001
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1001
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1002 1002
 
1003 1003
 
1004
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1004
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1005 1005
 				$first_registration = $registrations[0];
1006 1006
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1007 1007
 				$event_name = $first_registration->event_obj()->name();
1008
-				$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 ) : '';
1008
+				$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 ) : '';
1009 1009
 				// edit event link
1010
-				if ( $event_name != '' ) {
1011
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1012
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1013
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1010
+				if ($event_name != '') {
1011
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1012
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1013
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1014 1014
 				}
1015 1015
 
1016
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1017
-				$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>';
1016
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1017
+				$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>';
1018 1018
 
1019 1019
 				$this->_template_args['before_admin_page_content'] = '
1020 1020
 			<div id="admin-page-header">
1021
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1022
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1023
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1021
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1022
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1023
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1024 1024
 			</div>
1025 1025
 			';
1026 1026
 
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
 
1059 1059
 		$this->_set_registration_object();
1060 1060
 
1061
-		if ( is_object( $this->_registration )) {
1061
+		if (is_object($this->_registration)) {
1062 1062
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1063 1063
 			$this->_session = $transaction->session_data();
1064 1064
 
@@ -1066,10 +1066,10 @@  discard block
 block discarded – undo
1066 1066
 
1067 1067
 
1068 1068
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1069
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1069
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1070 1070
 
1071
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->pretty_date('l F j, Y','g:i:s a') ;
1072
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1071
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a');
1072
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1073 1073
 
1074 1074
 			$this->_template_args['grand_total'] = $transaction->total();
1075 1075
 
@@ -1077,19 +1077,19 @@  discard block
 block discarded – undo
1077 1077
 			// link back to overview
1078 1078
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1079 1079
 			$this->_template_args['registration'] = $this->_registration;
1080
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1081
-			$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' ) );
1082
-			$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' ) );
1080
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1081
+			$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'));
1082
+			$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'));
1083 1083
 
1084 1084
 			//next and previous links
1085
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1086
-			$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' ) : '';
1087
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1088
-			$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' ) : '';
1085
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1086
+			$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') : '';
1087
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1088
+			$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') : '';
1089 1089
 
1090 1090
 			// grab header
1091
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1092
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1091
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1092
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1093 1093
 
1094 1094
 		} else {
1095 1095
 
@@ -1110,14 +1110,14 @@  discard block
 block discarded – undo
1110 1110
 	protected function _registration_details_metaboxes() {
1111 1111
 		$this->_set_registration_object();
1112 1112
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1113
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1114
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1115
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1116
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1113
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1114
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1115
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1116
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1117 1117
 		}
1118
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1119
-		if ( $this->_registration->group_size() > 1 ) {
1120
-			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' );
1118
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1119
+		if ($this->_registration->group_size() > 1) {
1120
+			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');
1121 1121
 		}
1122 1122
 	}
1123 1123
 
@@ -1138,23 +1138,23 @@  discard block
 block discarded – undo
1138 1138
 
1139 1139
 		//let's get an array of all possible buttons that we can just reference
1140 1140
 		$status_buttons = $this->_get_reg_status_buttons();
1141
-		$template_args[ 'reg_status_value' ] = $this->_registration->pretty_status();
1142
-		$template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID();
1141
+		$template_args['reg_status_value'] = $this->_registration->pretty_status();
1142
+		$template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID();
1143 1143
 		$template_args['attendee'] = $this->_registration->attendee();
1144
-		$template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php';
1145
-		if ( $this->_set_registration_object() ) {
1144
+		$template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php';
1145
+		if ($this->_set_registration_object()) {
1146 1146
 			$current_status = $this->_registration->status_ID();
1147
-			unset( $status_buttons[$current_status] );
1148
-			if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) {
1149
-				unset( $status_buttons[EEM_Registration::status_id_pending_payment] );
1147
+			unset($status_buttons[$current_status]);
1148
+			if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) {
1149
+				unset($status_buttons[EEM_Registration::status_id_pending_payment]);
1150 1150
 			}
1151
-			$template_args['status_buttons'] = implode( "\n", $status_buttons );
1151
+			$template_args['status_buttons'] = implode("\n", $status_buttons);
1152 1152
 		}
1153 1153
 		$template_args['form_url'] = REG_ADMIN_URL;
1154 1154
 		$template_args['REG_ID'] = $this->_registration->ID();
1155
-		$template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce',  'change_reg_status_nonce', FALSE, FALSE );
1155
+		$template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE);
1156 1156
 
1157
-		EEH_Template::display_template( $template, $template_args );
1157
+		EEH_Template::display_template($template, $template_args);
1158 1158
 
1159 1159
 	}
1160 1160
 
@@ -1168,11 +1168,11 @@  discard block
 block discarded – undo
1168 1168
 	private function _get_reg_status_buttons() {
1169 1169
 
1170 1170
 		$buttons = array(
1171
-			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' ) . '">',
1172
-			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' ) . '">',
1173
-			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' ) . '">',
1174
-			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' ) . '">',
1175
-			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' ) . '">',
1171
+			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').'">',
1172
+			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').'">',
1173
+			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').'">',
1174
+			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').'">',
1175
+			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').'">',
1176 1176
 			);
1177 1177
 		return $buttons;
1178 1178
 	}
@@ -1186,13 +1186,13 @@  discard block
 block discarded – undo
1186 1186
 	 *
1187 1187
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1188 1188
 	 */
1189
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1190
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array();
1189
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1190
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1191 1191
 
1192
-		$success = $this->_set_registration_status( $REG_ID, $status );
1192
+		$success = $this->_set_registration_status($REG_ID, $status);
1193 1193
 
1194 1194
 		//notify?
1195
-		if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
1195
+		if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
1196 1196
 			$this->_process_resend_registration();
1197 1197
 		}
1198 1198
 
@@ -1210,19 +1210,19 @@  discard block
 block discarded – undo
1210 1210
 	 * @param bool $status
1211 1211
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1212 1212
 	 */
1213
-	protected function _set_registration_status( $REG_ID, $status = false ) {
1213
+	protected function _set_registration_status($REG_ID, $status = false) {
1214 1214
 		$success = true;
1215 1215
 		// set default status if none is passed
1216 1216
 		$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1217 1217
 
1218 1218
 		//typecast and sanitize reg_id
1219
-		$reg_ids = array_filter( (array) $REG_ID, 'absint' );
1219
+		$reg_ids = array_filter((array) $REG_ID, 'absint');
1220 1220
 
1221 1221
 		//loop through REG_ID's and change status
1222
-		foreach ( $reg_ids as $r_id ) {
1223
-			$registration = EEM_Registration::instance()->get_one_by_ID( $r_id );
1224
-			if ( $registration instanceof EE_Registration ) {
1225
-				$registration->set_status( $status );
1222
+		foreach ($reg_ids as $r_id) {
1223
+			$registration = EEM_Registration::instance()->get_one_by_ID($r_id);
1224
+			if ($registration instanceof EE_Registration) {
1225
+				$registration->set_status($status);
1226 1226
 				$result = $registration->save();
1227 1227
 
1228 1228
 				//verifying explicit fails because update *may* just return 0 for 0 rows affected
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
 		$this->_req_data['_REG_ID'] = $reg_ids;
1235 1235
 
1236 1236
 		//return $success and processed registrations
1237
-		return array( 'REG_ID' => $reg_ids, 'success' => $success );
1237
+		return array('REG_ID' => $reg_ids, 'success' => $success);
1238 1238
 	}
1239 1239
 
1240 1240
 
@@ -1246,37 +1246,37 @@  discard block
 block discarded – undo
1246 1246
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1247 1247
 	 * @return void
1248 1248
 	 */
1249
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1249
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1250 1250
 
1251
-		$result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false );
1251
+		$result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false);
1252 1252
 
1253 1253
 
1254
-		$success = isset( $result['success'] ) && $result['success'];
1254
+		$success = isset($result['success']) && $result['success'];
1255 1255
 
1256 1256
 		//setup success message
1257
-		if ( $success ) {
1258
-			$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' ) ) ;
1259
-			EE_Error::add_success( $msg );
1257
+		if ($success) {
1258
+			$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'));
1259
+			EE_Error::add_success($msg);
1260 1260
 		} else {
1261
-			EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ );
1261
+			EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
1262 1262
 		}
1263 1263
 
1264
-		$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' );
1264
+		$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');
1265 1265
 		//unset nonces
1266
-		foreach ( $this->_req_data as $ref => $value ) {
1267
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1268
-				unset( $this->_req_data[$ref] );
1266
+		foreach ($this->_req_data as $ref => $value) {
1267
+			if (strpos($ref, 'nonce') !== false) {
1268
+				unset($this->_req_data[$ref]);
1269 1269
 				continue;
1270 1270
 			}
1271 1271
 
1272
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1272
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1273 1273
 			$this->_req_data[$ref] = $value;
1274 1274
 		}
1275 1275
 
1276 1276
 		//merge request vars so that the reloaded list table contains any existing filter query params
1277
-		$route = array_merge( $this->_req_data, $route );
1277
+		$route = array_merge($this->_req_data, $route);
1278 1278
 
1279
-		$this->_redirect_after_action( false, '', '', $route, true );
1279
+		$this->_redirect_after_action(false, '', '', $route, true);
1280 1280
 	}
1281 1281
 
1282 1282
 
@@ -1289,28 +1289,28 @@  discard block
 block discarded – undo
1289 1289
 		$this->_req_data['return'] = 'view_registration';
1290 1290
 
1291 1291
 		//set notify based on whether the send notifications toggle is set or not
1292
-		$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1292
+		$notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']);
1293 1293
 
1294
-		switch ( $this->_req_data['_reg_status_id'] ) {
1295
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1296
-				$this->approve_registration( $notify );
1294
+		switch ($this->_req_data['_reg_status_id']) {
1295
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1296
+				$this->approve_registration($notify);
1297 1297
 				break;
1298
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1299
-				$this->pending_registration( $notify );
1298
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1299
+				$this->pending_registration($notify);
1300 1300
 				break;
1301
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1302
-				$this->not_approve_registration( $notify );
1301
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1302
+				$this->not_approve_registration($notify);
1303 1303
 				break;
1304
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1305
-				$this->decline_registration( $notify );
1304
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1305
+				$this->decline_registration($notify);
1306 1306
 				break;
1307
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1308
-				$this->cancel_registration( $notify );
1307
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1308
+				$this->cancel_registration($notify);
1309 1309
 				break;
1310 1310
 			default :
1311 1311
 				$result['success'] = false;
1312
-				unset( $this->_req_data['return'] );
1313
-				$this->_reg_status_change_return( '', false );
1312
+				unset($this->_req_data['return']);
1313
+				$this->_reg_status_change_return('', false);
1314 1314
 				break;
1315 1315
 		}
1316 1316
 	}
@@ -1323,8 +1323,8 @@  discard block
 block discarded – undo
1323 1323
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1324 1324
 	*		@return void
1325 1325
 	*/
1326
-	protected function approve_registration( $notify = false ) {
1327
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1326
+	protected function approve_registration($notify = false) {
1327
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1328 1328
 	}
1329 1329
 
1330 1330
 
@@ -1336,8 +1336,8 @@  discard block
 block discarded – undo
1336 1336
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1337 1337
 	*		@return void
1338 1338
 	*/
1339
-	protected function decline_registration( $notify = false ) {
1340
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1339
+	protected function decline_registration($notify = false) {
1340
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1341 1341
 	}
1342 1342
 
1343 1343
 
@@ -1349,8 +1349,8 @@  discard block
 block discarded – undo
1349 1349
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1350 1350
 	*		@return void
1351 1351
 	*/
1352
-	protected function cancel_registration( $notify = false ) {
1353
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1352
+	protected function cancel_registration($notify = false) {
1353
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1354 1354
 	}
1355 1355
 
1356 1356
 
@@ -1363,8 +1363,8 @@  discard block
 block discarded – undo
1363 1363
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1364 1364
 	*		@return void
1365 1365
 	*/
1366
-	protected function not_approve_registration( $notify = false ) {
1367
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1366
+	protected function not_approve_registration($notify = false) {
1367
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1368 1368
 	}
1369 1369
 
1370 1370
 
@@ -1375,8 +1375,8 @@  discard block
 block discarded – undo
1375 1375
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1376 1376
 	*		@return void
1377 1377
 	*/
1378
-	protected function pending_registration( $notify = false ) {
1379
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1378
+	protected function pending_registration($notify = false) {
1379
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1380 1380
 	}
1381 1381
 
1382 1382
 
@@ -1392,72 +1392,72 @@  discard block
 block discarded – undo
1392 1392
 		$this->_session = $transaction->session_data();
1393 1393
 
1394 1394
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1395
-		$this->_template_args['line_items'] = $transaction->get_many_related('Line_Item', array( array('LIN_type' => 'line-item' ) ) );
1395
+		$this->_template_args['line_items'] = $transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
1396 1396
 
1397 1397
 
1398 1398
 		$attendee = $this->_registration->attendee();
1399 1399
 
1400 1400
 		// process taxes
1401
-		if ( $transaction ) {
1401
+		if ($transaction) {
1402 1402
 			//get all "tax" line items for this transaction and we'll use them for the tax display.
1403
-			$taxes = $transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax ) ) );
1404
-			$this->_template_args['taxes'] = !empty($taxes) ? $taxes : array();
1403
+			$taxes = $transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax)));
1404
+			$this->_template_args['taxes'] = ! empty($taxes) ? $taxes : array();
1405 1405
 		} else {
1406 1406
 			$this->_template_args['taxes'] = array();
1407 1407
 		}
1408 1408
 
1409
-		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : '';
1410
-		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : '';
1409
+		$this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ?EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : '';
1410
+		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ?EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : '';
1411 1411
 
1412
-		$this->_template_args['grand_total'] = EEH_Template::format_currency( $transaction->total() );
1412
+		$this->_template_args['grand_total'] = EEH_Template::format_currency($transaction->total());
1413 1413
 
1414 1414
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1415
-		$payment = $transaction->get_first_related( 'Payment' );
1415
+		$payment = $transaction->get_first_related('Payment');
1416 1416
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1417
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1417
+		$payment_method = $payment->get_first_related('Payment_Method');
1418 1418
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1419
-		$reg_status_class = 'status-' . $this->_registration->status_ID();
1419
+		$reg_status_class = 'status-'.$this->_registration->status_ID();
1420 1420
 		$reg_details = array(
1421 1421
 			'payment_method' => $payment_method->name(),
1422 1422
 			'response_msg' => $payment->gateway_response(),
1423
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1423
+			'registration_id' => $this->_registration->get('REG_code'),
1424 1424
 			'registration_session' => $this->_registration->session_ID(),
1425
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1426
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1425
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1426
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1427 1427
 			);
1428 1428
 
1429 1429
 
1430
-		if ( isset( $reg_details['registration_id'] )) {
1430
+		if (isset($reg_details['registration_id'])) {
1431 1431
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1432
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1432
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1433 1433
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1434 1434
 		}
1435 1435
 
1436
-		if ( isset( $reg_details['payment_method'] ) ) {
1436
+		if (isset($reg_details['payment_method'])) {
1437 1437
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1438
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1438
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1439 1439
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1440 1440
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1441
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1441
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1442 1442
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1443 1443
 		}
1444 1444
 
1445 1445
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1446
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1446
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1447 1447
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1448 1448
 
1449 1449
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1450
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1450
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1451 1451
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1452 1452
 
1453 1453
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1454
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1454
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1455 1455
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1456 1456
 
1457
-		$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 );
1457
+		$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);
1458 1458
 
1459
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1460
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1459
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1460
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1461 1461
 
1462 1462
 	}
1463 1463
 
@@ -1473,23 +1473,23 @@  discard block
 block discarded – undo
1473 1473
 	*/
1474 1474
 	public function _reg_questions_meta_box() {
1475 1475
 
1476
-		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 );
1477
-		add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $this, 'form_after_question_group' ), 10, 1 );
1478
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'form_form_field_label_wrap' ), 10, 1 );
1479
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'form_form_field_input__wrap' ), 10, 1 );
1476
+		add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($this, 'form_before_question_group'), 10, 1);
1477
+		add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($this, 'form_after_question_group'), 10, 1);
1478
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'form_form_field_label_wrap'), 10, 1);
1479
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'form_form_field_input__wrap'), 10, 1);
1480 1480
 
1481
-		$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $this->_registration, $this->_registration->get('EVT_ID') );
1481
+		$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($this->_registration, $this->_registration->get('EVT_ID'));
1482 1482
 
1483 1483
 		//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1484 1484
 
1485
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
1486
-		$this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html( $question_groups );
1485
+		EE_Registry::instance()->load_helper('Form_Fields');
1486
+		$this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html($question_groups);
1487 1487
 
1488 1488
 		$this->_template_args['reg_questions_form_action'] = 'update_attendee_registration_form';
1489 1489
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1490 1490
 
1491
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1492
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1491
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1492
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1493 1493
 
1494 1494
 	}
1495 1495
 
@@ -1504,7 +1504,7 @@  discard block
 block discarded – undo
1504 1504
 	 * 		@param 		string 		$output
1505 1505
 	 * 		@return 		string
1506 1506
 	 */
1507
-	public function form_before_question_group( $output ) {
1507
+	public function form_before_question_group($output) {
1508 1508
 		return '
1509 1509
 	<table class="form-table ee-width-100">
1510 1510
 		<tbody>
@@ -1521,13 +1521,13 @@  discard block
 block discarded – undo
1521 1521
 	 * 		@param 		string 		$output
1522 1522
 	 * 		@return 		string
1523 1523
 	 */
1524
-	public function form_after_question_group( $output ) {
1524
+	public function form_after_question_group($output) {
1525 1525
 		return  '
1526 1526
 			<tr class="hide-if-no-js">
1527 1527
 				<th> </th>
1528 1528
 				<td class="reg-admin-edit-attendee-question-td">
1529
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1530
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1529
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1530
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1531 1531
 						<div class="dashicons dashicons-edit"></div>
1532 1532
 					</a>
1533 1533
 				</td>
@@ -1547,11 +1547,11 @@  discard block
 block discarded – undo
1547 1547
 	 * 		@param 		string 		$label
1548 1548
 	 * 		@return 		string
1549 1549
 	 */
1550
-	public function form_form_field_label_wrap( $label ) {
1550
+	public function form_form_field_label_wrap($label) {
1551 1551
 		return '
1552 1552
 			<tr>
1553 1553
 				<th>
1554
-					' . $label  . '
1554
+					' . $label.'
1555 1555
 				</th>';
1556 1556
 	}
1557 1557
 
@@ -1565,10 +1565,10 @@  discard block
 block discarded – undo
1565 1565
 	 * 		@param 		string 		$label
1566 1566
 	 * 		@return 		string
1567 1567
 	 */
1568
-	public function form_form_field_input__wrap( $input ) {
1568
+	public function form_form_field_input__wrap($input) {
1569 1569
 		return '
1570 1570
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1571
-					' . $input . '
1571
+					' . $input.'
1572 1572
 				</td>
1573 1573
 			</tr>';
1574 1574
 	}
@@ -1582,13 +1582,13 @@  discard block
 block discarded – undo
1582 1582
 	*		@return void
1583 1583
 	*/
1584 1584
 	protected function _update_attendee_registration_form() {
1585
-		$qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE;
1586
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1587
-		$qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns );
1588
-		$success = $this->_save_attendee_registration_form( $REG_ID, $qstns );
1585
+		$qstns = isset($this->_req_data['qstn']) ? $this->_req_data['qstn'] : FALSE;
1586
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1587
+		$qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
1588
+		$success = $this->_save_attendee_registration_form($REG_ID, $qstns);
1589 1589
 		$what = __('Registration Form', 'event_espresso');
1590
-		$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1591
-		$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1590
+		$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1591
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1592 1592
 
1593 1593
 	}
1594 1594
 
@@ -1601,26 +1601,26 @@  discard block
 block discarded – undo
1601 1601
 	 * @param bool $qstns
1602 1602
 	 * @return bool
1603 1603
 	 */
1604
-	private function _save_attendee_registration_form( $REG_ID = FALSE, $qstns = FALSE ) {
1604
+	private function _save_attendee_registration_form($REG_ID = FALSE, $qstns = FALSE) {
1605 1605
 
1606
-		if ( ! $REG_ID || ! $qstns ) {
1607
-			EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1606
+		if ( ! $REG_ID || ! $qstns) {
1607
+			EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1608 1608
 		}
1609 1609
 		$success = TRUE;
1610 1610
 
1611 1611
 		// allow others to get in on this awesome fun   :D
1612
-		do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns );
1612
+		do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns);
1613 1613
 		// loop thru questions... FINALLY!!!
1614 1614
 
1615
-		foreach ( $qstns as $QST_ID => $qstn ) {
1615
+		foreach ($qstns as $QST_ID => $qstn) {
1616 1616
 			//if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
1617
-			if ( !is_array($qstn) ) {
1618
-				$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
1617
+			if ( ! is_array($qstn)) {
1618
+				$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
1619 1619
 				continue;
1620 1620
 			}
1621 1621
 
1622 1622
 
1623
-			foreach ( $qstn as $ANS_ID => $ANS_value ) {
1623
+			foreach ($qstn as $ANS_ID => $ANS_value) {
1624 1624
 				//get answer
1625 1625
 				$query_params = array(
1626 1626
 					0 => array(
@@ -1631,8 +1631,8 @@  discard block
 block discarded – undo
1631 1631
 					);
1632 1632
 				$answer = EEM_Answer::instance()->get_one($query_params);
1633 1633
 				//this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
1634
-				if ( ! $answer instanceof EE_Answer ) {
1635
-					$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
1634
+				if ( ! $answer instanceof EE_Answer) {
1635
+					$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
1636 1636
 					continue 2;
1637 1637
 				}
1638 1638
 
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
 
1647 1647
 
1648 1648
 	//TODO: try changing this to use the model directly... not indirectly through creating a default object...
1649
-	private function _save_new_answer( $REG_ID, $QST_ID, $ans ) {
1649
+	private function _save_new_answer($REG_ID, $QST_ID, $ans) {
1650 1650
 		$set_values = array(
1651 1651
 			'QST_ID' => $QST_ID,
1652 1652
 			'REG_ID' => $REG_ID,
@@ -1673,30 +1673,30 @@  discard block
 block discarded – undo
1673 1673
 		$registrations = $REG->get_all(array(
1674 1674
 			array(
1675 1675
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1676
-				'REG_ID'=>array('!=',$this->_registration->ID())
1676
+				'REG_ID'=>array('!=', $this->_registration->ID())
1677 1677
 			),
1678 1678
 			'force_join'=>array('Attendee')));
1679 1679
 
1680 1680
 		$this->_template_args['attendees'] = array();
1681 1681
 		$this->_template_args['attendee_notice'] = '';
1682 1682
 		EE_Registry::instance()->load_helper('Array');
1683
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1684
-			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__ );
1683
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1684
+			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__);
1685 1685
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1686 1686
 		} else {
1687 1687
 
1688 1688
 			$att_nmbr = 1;
1689
-			foreach ( $registrations as $registration ) {
1689
+			foreach ($registrations as $registration) {
1690 1690
 				/* @var $registration EE_Registration */
1691 1691
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1692
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1693
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1694
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1695
-				$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 : '';
1692
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1693
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1694
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1695
+				$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 : '';
1696 1696
 
1697
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1697
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1698 1698
 
1699
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1699
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1700 1700
 
1701 1701
 				$att_nmbr++;
1702 1702
 			}
@@ -1708,8 +1708,8 @@  discard block
 block discarded – undo
1708 1708
 
1709 1709
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
1710 1710
 		}
1711
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
1712
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1711
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
1712
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1713 1713
 
1714 1714
 	}
1715 1715
 
@@ -1730,11 +1730,11 @@  discard block
 block discarded – undo
1730 1730
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
1731 1731
 
1732 1732
 		//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 cereate button or not)
1733
-		if ( ! $this->_registration->is_primary_registrant() ) {
1733
+		if ( ! $this->_registration->is_primary_registrant()) {
1734 1734
 			$primary_registration = $this->_registration->get_primary_registration();
1735 1735
 			$primary_attendee = $primary_registration->attendee();
1736 1736
 
1737
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
1737
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
1738 1738
 				//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.
1739 1739
 				$primary_registration = NULL;
1740 1740
 			}
@@ -1743,28 +1743,28 @@  discard block
 block discarded – undo
1743 1743
 		}
1744 1744
 
1745 1745
 		$this->_template_args['ATT_ID'] = $attendee->ID();
1746
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
1747
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
1748
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
1746
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
1747
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
1748
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
1749 1749
 		$this->_template_args['phone'] = $attendee->phone();
1750 1750
 
1751
-		EE_Registry::instance()->load_helper( 'Formatter' );
1752
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
1751
+		EE_Registry::instance()->load_helper('Formatter');
1752
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
1753 1753
 
1754 1754
 
1755 1755
 		//edit link
1756
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1757
-		$this->_template_args['att_edit_label'] = __('View/Edit Contact' );
1756
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1757
+		$this->_template_args['att_edit_label'] = __('View/Edit Contact');
1758 1758
 
1759 1759
 		//create link
1760
-		$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 ): '';
1760
+		$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) : '';
1761 1761
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
1762 1762
 
1763 1763
 		$this->_template_args['att_check'] = $att_check;
1764 1764
 
1765 1765
 
1766
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
1767
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1766
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
1767
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1768 1768
 	}
1769 1769
 
1770 1770
 
@@ -1777,7 +1777,7 @@  discard block
 block discarded – undo
1777 1777
 	 * @access protected
1778 1778
 	 * @return void
1779 1779
 	 */
1780
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
1780
+	protected function _trash_or_restore_registrations($trash = TRUE) {
1781 1781
 		$REGM = EEM_Registration::instance();
1782 1782
 
1783 1783
 		$success = 1;
@@ -1787,26 +1787,26 @@  discard block
 block discarded – undo
1787 1787
 		$dtts = array();
1788 1788
 
1789 1789
 		//if empty _REG_ID then get out because there's nothing to do
1790
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
1790
+		if (empty($this->_req_data['_REG_ID'])) {
1791 1791
 			$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');
1792
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
1793
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
1792
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
1793
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
1794 1794
 		}
1795 1795
 
1796 1796
 		//Checkboxes
1797
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1797
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1798 1798
 			// if array has more than one element than success message should be plural
1799
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1799
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1800 1800
 			// cycle thru checkboxes
1801
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1801
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1802 1802
 
1803 1803
 				$REG = $REGM->get_one_by_ID($REG_ID);
1804 1804
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
1805
-				if ( $payment_count > 0 ) {
1805
+				if ($payment_count > 0) {
1806 1806
 					$name = $REG->attendee()->full_name();
1807 1807
 					$error = 1;
1808 1808
 					$success = 0;
1809
-					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__ );
1809
+					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__);
1810 1810
 					continue; //can't trash this registration because it has payments.
1811 1811
 				}
1812 1812
 				$ticket = $REG->get_first_related('Ticket');
@@ -1815,7 +1815,7 @@  discard block
 block discarded – undo
1815 1815
 				$dtts = array_merge($dtts, $dtt);
1816 1816
 
1817 1817
 				$updated = $trash ? $REG->delete() : $REG->restore();
1818
-				if ( !$updated ) {
1818
+				if ( ! $updated) {
1819 1819
 					$success = 0;
1820 1820
 				} else {
1821 1821
 					$success = 2;
@@ -1830,7 +1830,7 @@  discard block
 block discarded – undo
1830 1830
 			$tickets[$ticket->ID()] = $ticket;
1831 1831
 			$dtts = $ticket->get_many_related('Datetime');
1832 1832
 			$updated = $trash ? $REG->delete() : $REG->restore();
1833
-			if ( ! $updated ) {
1833
+			if ( ! $updated) {
1834 1834
 				$success = 0;
1835 1835
 			}
1836 1836
 
@@ -1840,10 +1840,10 @@  discard block
 block discarded – undo
1840 1840
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
1841 1841
 		EEM_Datetime::instance()->update_sold($dtts);
1842 1842
 
1843
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1844
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
1843
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1844
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
1845 1845
 		$overwrite_msgs = $error ? TRUE : FALSE;
1846
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
1846
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
1847 1847
 	}
1848 1848
 
1849 1849
 
@@ -1867,16 +1867,16 @@  discard block
 block discarded – undo
1867 1867
 		$success = 1;
1868 1868
 
1869 1869
 		//Checkboxes
1870
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1870
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1871 1871
 			// if array has more than one element than success message should be plural
1872
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1872
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1873 1873
 			// cycle thru checkboxes
1874
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1874
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1875 1875
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
1876
-				if ( ! $REG instanceof EE_Registration )
1876
+				if ( ! $REG instanceof EE_Registration)
1877 1877
 					continue;
1878 1878
 				$deleted = $this->_delete_registration($REG);
1879
-				if ( !$deleted ) {
1879
+				if ( ! $deleted) {
1880 1880
 					$success = 0;
1881 1881
 				}
1882 1882
 			}
@@ -1886,15 +1886,15 @@  discard block
 block discarded – undo
1886 1886
 			$REG_ID = $this->_req_data['_REG_ID'];
1887 1887
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
1888 1888
 			$deleted = $this->_delete_registration($REG);
1889
-			if ( ! $deleted ) {
1889
+			if ( ! $deleted) {
1890 1890
 				$success = 0;
1891 1891
 			}
1892 1892
 
1893 1893
 		}
1894 1894
 
1895
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1896
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
1897
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
1895
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1896
+		$action_desc = __('permanently deleted.', 'event_espresso');
1897
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
1898 1898
 	}
1899 1899
 
1900 1900
 
@@ -1906,31 +1906,31 @@  discard block
 block discarded – undo
1906 1906
 	 * @param  EE_Registration $REG registration to be deleted permenantly
1907 1907
 	 * @return boolean              true = successful deletion, false = fail.
1908 1908
 	 */
1909
-	protected function _delete_registration( EE_Registration $REG ) {
1909
+	protected function _delete_registration(EE_Registration $REG) {
1910 1910
 		//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.
1911 1911
 		$TXN = $REG->get_first_related('Transaction');
1912 1912
 		$REGS = $TXN->get_many_related('Registration');
1913 1913
 
1914 1914
 		$all_trashed = TRUE;
1915
-		foreach ( $REGS as $registration ) {
1916
-			if ( ! $registration->get('REG_deleted') )
1915
+		foreach ($REGS as $registration) {
1916
+			if ( ! $registration->get('REG_deleted'))
1917 1917
 				$all_trashed = FALSE;
1918 1918
 		}
1919 1919
 
1920
-		if ( ! $all_trashed ) {
1921
-			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__ );
1920
+		if ( ! $all_trashed) {
1921
+			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__);
1922 1922
 			return false;
1923 1923
 		}
1924 1924
 
1925 1925
 		//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).
1926
-		foreach ( $REGS as $registration ) {
1926
+		foreach ($REGS as $registration) {
1927 1927
 
1928 1928
 			//delete related answers
1929 1929
 			$registration->delete_related_permanently('Answer');
1930 1930
 
1931 1931
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
1932 1932
 			$attendee = $registration->get_first_related('Attendee');
1933
-			if ( $attendee instanceof EE_Attendee ) {
1933
+			if ($attendee instanceof EE_Attendee) {
1934 1934
 				$registration->_remove_relation_to($attendee, 'Attendee');
1935 1935
 			}
1936 1936
 
@@ -1940,7 +1940,7 @@  discard block
 block discarded – undo
1940 1940
 			//now delete permanently the checkins related to this registration.
1941 1941
 			$registration->delete_related_permanently('Checkin');
1942 1942
 
1943
-			if ( $registration->ID() === $REG->ID() )
1943
+			if ($registration->ID() === $REG->ID())
1944 1944
 				continue; //we don't want to delete permanently the existing registration just yet.
1945 1945
 
1946 1946
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -1973,34 +1973,34 @@  discard block
 block discarded – undo
1973 1973
 	 * @return void
1974 1974
 	 */
1975 1975
 	public function new_registration() {
1976
-		if ( ! $this->_set_reg_event() ) {
1977
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
1976
+		if ( ! $this->_set_reg_event()) {
1977
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
1978 1978
 		}
1979
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
1979
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
1980 1980
 
1981 1981
 		// gotta start with a clean slate if we're not coming here via ajax
1982
-		if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) {
1983
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
1982
+		if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) {
1983
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
1984 1984
 		}
1985 1985
 
1986
-		$this->_template_args['event_name'] = '' ;
1986
+		$this->_template_args['event_name'] = '';
1987 1987
 		// event name
1988
-		if ( $this->_reg_event ) {
1988
+		if ($this->_reg_event) {
1989 1989
 			$this->_template_args['event_name'] = $this->_reg_event->name();
1990
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
1991
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1992
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1990
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
1991
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
1992
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1993 1993
 		}
1994 1994
 
1995 1995
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
1996 1996
 
1997
-		if ( defined('DOING_AJAX' ) )
1997
+		if (defined('DOING_AJAX'))
1998 1998
 			$this->_return_json();
1999 1999
 
2000 2000
 
2001 2001
 		// grab header
2002
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2003
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2002
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2003
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2004 2004
 
2005 2005
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2006 2006
 		// the details template wrapper
@@ -2018,7 +2018,7 @@  discard block
 block discarded – undo
2018 2018
 	 */
2019 2019
 	protected function _get_registration_step_content() {
2020 2020
 
2021
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php';
2021
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php';
2022 2022
 		$template_args = array(
2023 2023
 			'title' => '',
2024 2024
 			'content' => '',
@@ -2039,11 +2039,11 @@  discard block
 block discarded – undo
2039 2039
 
2040 2040
 		//if the cart is empty then we know we're at step one so we'll display ticket selector
2041 2041
 		$cart = EE_Registry::instance()->SSN->get_session_data('cart');
2042
-		$step = empty( $cart ) ? 'ticket' : 'questions';
2043
-		switch ( $step ) {
2042
+		$step = empty($cart) ? 'ticket' : 'questions';
2043
+		switch ($step) {
2044 2044
 			case 'ticket' :
2045 2045
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2046
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2046
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2047 2047
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2048 2048
 				$template_args['show_notification_toggle'] = FALSE;
2049 2049
 				break;
@@ -2056,9 +2056,9 @@  discard block
 block discarded – undo
2056 2056
 				break;
2057 2057
 		}
2058 2058
 
2059
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2059
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2060 2060
 
2061
-		return EEH_Template::display_template( $template_path, $template_args, TRUE );
2061
+		return EEH_Template::display_template($template_path, $template_args, TRUE);
2062 2062
 	}
2063 2063
 
2064 2064
 
@@ -2072,11 +2072,11 @@  discard block
 block discarded – undo
2072 2072
 	*		@return boolean
2073 2073
 	*/
2074 2074
 	private function _set_reg_event() {
2075
-		if ( is_object( $this->_reg_event )) {
2075
+		if (is_object($this->_reg_event)) {
2076 2076
 			return TRUE;
2077 2077
 		}
2078
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2079
-		if ( ! $EVT_ID ) {
2078
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2079
+		if ( ! $EVT_ID) {
2080 2080
 			return FALSE;
2081 2081
 		}
2082 2082
 
@@ -2097,59 +2097,59 @@  discard block
 block discarded – undo
2097 2097
 	public function process_reg_step() {
2098 2098
 
2099 2099
 		$this->_set_reg_event();
2100
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2100
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2101 2101
 
2102 2102
 		//what step are we on?
2103
-		$cart = EE_Registry::instance()->SSN->get_session_data( 'cart' );
2104
-		$step = empty( $cart ) ? 'ticket' : 'questions';
2103
+		$cart = EE_Registry::instance()->SSN->get_session_data('cart');
2104
+		$step = empty($cart) ? 'ticket' : 'questions';
2105 2105
 
2106 2106
 		//if doing ajax then we need to verify the nonce
2107
-		if ( 'DOING_AJAX' ) {
2108
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2109
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2107
+		if ('DOING_AJAX') {
2108
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2109
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2110 2110
 		}
2111 2111
 
2112
-		switch ( $step ) {
2112
+		switch ($step) {
2113 2113
 			case 'ticket' :
2114 2114
 				//process ticket selection
2115 2115
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2116
-				if ( $success ) {
2117
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2116
+				if ($success) {
2117
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2118 2118
 				} else {
2119 2119
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2120 2120
 				}
2121
-				if ( defined('DOING_AJAX') ) {
2121
+				if (defined('DOING_AJAX')) {
2122 2122
 					$this->new_registration(); //display next step
2123 2123
 				} else {
2124 2124
 					$query_args['action'] = 'new_registration';
2125 2125
 					$query_args['processing_registration'] = true;
2126 2126
 					$query_args['event_id'] = $this->_reg_event->ID();
2127
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2127
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2128 2128
 				}
2129 2129
 				break;
2130 2130
 			case 'questions' :
2131 2131
 				//process registration
2132 2132
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2133
-				if ( ! $transaction instanceof EE_Transaction ) {
2133
+				if ( ! $transaction instanceof EE_Transaction) {
2134 2134
 					$query_args = array(
2135 2135
 						'action' => 'new_registration',
2136 2136
 						'processing_registration' => true,
2137 2137
 						'event_id' => $this->_reg_event->ID()
2138 2138
 					);
2139 2139
 
2140
-					if ( defined('DOING_AJAX' )) {
2140
+					if (defined('DOING_AJAX')) {
2141 2141
 						//display registration form again because there are errors (maybe validation?)
2142 2142
 						$this->new_registration();
2143 2143
 						return;
2144 2144
 					} else {
2145
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2145
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2146 2146
 						return;
2147 2147
 					}
2148 2148
 				}
2149 2149
 				/** @type EE_Transaction_Payments $transaction_payments */
2150
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2150
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2151 2151
 				// maybe update status, and make sure to save transaction if not done already
2152
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2152
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2153 2153
 					$transaction->save();
2154 2154
 				}
2155 2155
 				$query_args = array(
@@ -2157,8 +2157,8 @@  discard block
 block discarded – undo
2157 2157
 					'TXN_ID' => $transaction->ID(),
2158 2158
 					'page' => 'espresso_transactions'
2159 2159
 				);
2160
-				EE_Error::add_success( __('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso') );
2161
-				$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2160
+				EE_Error::add_success(__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso'));
2161
+				$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2162 2162
 				break;
2163 2163
 			}
2164 2164
 
@@ -2178,7 +2178,7 @@  discard block
 block discarded – undo
2178 2178
 	*		@return void
2179 2179
 	*/
2180 2180
 	protected function _attendee_contact_list_table() {
2181
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2181
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2182 2182
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2183 2183
 		$this->display_admin_list_table_page_with_no_sidebar();
2184 2184
 	}
@@ -2193,13 +2193,13 @@  discard block
 block discarded – undo
2193 2193
 	*		@access public
2194 2194
 	*		@return array
2195 2195
 	*/
2196
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2196
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2197 2197
 
2198
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2198
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2199 2199
 		// start with an empty array
2200 2200
 		$attendees = array();
2201 2201
 
2202
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2202
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2203 2203
 		$ATT_MDL = EEM_Attendee::instance();
2204 2204
 
2205 2205
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2227,47 +2227,47 @@  discard block
 block discarded – undo
2227 2227
 				$orderby = 'ATT_lname';
2228 2228
 		}
2229 2229
 
2230
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2230
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2231 2231
 
2232
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2233
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2234
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2232
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2233
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2234
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2235 2235
 
2236 2236
 		$_where = array();
2237 2237
 
2238
-		if ( isset( $this->_req_data['s'] ) ) {
2239
-			$sstr = '%' . $this->_req_data['s'] . '%';
2238
+		if (isset($this->_req_data['s'])) {
2239
+			$sstr = '%'.$this->_req_data['s'].'%';
2240 2240
 			$_where['OR'] = array(
2241
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2242
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2243
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2244
-				'ATT_fname' => array( 'LIKE', $sstr ),
2245
-				'ATT_lname' => array( 'LIKE', $sstr ),
2246
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2247
-				'ATT_email' => array('LIKE', $sstr ),
2248
-				'ATT_address' => array( 'LIKE', $sstr ),
2249
-				'ATT_address2' => array( 'LIKE', $sstr ),
2250
-				'ATT_city' => array( 'LIKE', $sstr ),
2251
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2252
-				'State.STA_name' => array('LIKE', $sstr ),
2253
-				'ATT_phone' => array( 'LIKE', $sstr ),
2254
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2255
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2256
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2257
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2241
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2242
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2243
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2244
+				'ATT_fname' => array('LIKE', $sstr),
2245
+				'ATT_lname' => array('LIKE', $sstr),
2246
+				'ATT_short_bio' => array('LIKE', $sstr),
2247
+				'ATT_email' => array('LIKE', $sstr),
2248
+				'ATT_address' => array('LIKE', $sstr),
2249
+				'ATT_address2' => array('LIKE', $sstr),
2250
+				'ATT_city' => array('LIKE', $sstr),
2251
+				'Country.CNT_name' => array('LIKE', $sstr),
2252
+				'State.STA_name' => array('LIKE', $sstr),
2253
+				'ATT_phone' => array('LIKE', $sstr),
2254
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2255
+				'Registration.REG_code' => array('LIKE', $sstr),
2256
+				'Registration.REG_count' => array('LIKE', $sstr),
2257
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2258 2258
 				);
2259 2259
 		}
2260 2260
 
2261 2261
 
2262
-		$offset = ($current_page-1)*$per_page;
2263
-		$limit = $count ? NULL : array( $offset, $per_page );
2262
+		$offset = ($current_page - 1) * $per_page;
2263
+		$limit = $count ? NULL : array($offset, $per_page);
2264 2264
 
2265
-		if ( $trash ) {
2266
-			$_where['status'] = array( '!=', 'publish' );
2267
-			$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));
2265
+		if ($trash) {
2266
+			$_where['status'] = array('!=', 'publish');
2267
+			$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));
2268 2268
 		} else {
2269
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2270
-			$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) );
2269
+			$_where['status'] = array('IN', array('publish'));
2270
+			$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));
2271 2271
 		}
2272 2272
 
2273 2273
 		return $all_attendees;
@@ -2284,10 +2284,10 @@  discard block
 block discarded – undo
2284 2284
 	 */
2285 2285
 	protected function _resend_registration() {
2286 2286
 		$this->_process_resend_registration();
2287
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2287
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2288 2288
 			'action' => 'default'
2289 2289
 		);
2290
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2290
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2291 2291
 	}
2292 2292
 
2293 2293
 
@@ -2295,17 +2295,17 @@  discard block
 block discarded – undo
2295 2295
 
2296 2296
 
2297 2297
 
2298
-	public function _registrations_report(){
2299
-		EE_Registry::instance()->load_helper( 'File' );
2298
+	public function _registrations_report() {
2299
+		EE_Registry::instance()->load_helper('File');
2300 2300
 		$new_request_args = array(
2301 2301
 			'export' => 'report',
2302 2302
 			'action' => 'registrations_report_for_event',
2303
-			'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2303
+			'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2304 2304
 		);
2305 2305
 		$this->_req_data = array_merge($this->_req_data, $new_request_args);
2306 2306
 
2307
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2308
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2307
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2308
+			require_once(EE_CLASSES.'EE_Export.class.php');
2309 2309
 			$EE_Export = EE_Export::instance($this->_req_data);
2310 2310
 			$EE_Export->export();
2311 2311
 		}
@@ -2313,19 +2313,19 @@  discard block
 block discarded – undo
2313 2313
 
2314 2314
 
2315 2315
 
2316
-	public function _contact_list_export(){
2317
-		EE_Registry::instance()->load_helper( 'File' );
2318
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2319
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2316
+	public function _contact_list_export() {
2317
+		EE_Registry::instance()->load_helper('File');
2318
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2319
+			require_once(EE_CLASSES.'EE_Export.class.php');
2320 2320
 			$EE_Export = EE_Export::instance($this->_req_data);
2321 2321
 			$EE_Export->export_attendees();
2322 2322
 		}
2323 2323
 	}
2324 2324
 
2325
-	public function _contact_list_report(){
2326
-		EE_Registry::instance()->load_helper( 'File' );
2327
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2328
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2325
+	public function _contact_list_report() {
2326
+		EE_Registry::instance()->load_helper('File');
2327
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2328
+			require_once(EE_CLASSES.'EE_Export.class.php');
2329 2329
 			$EE_Export = EE_Export::instance($this->_req_data);
2330 2330
 			$EE_Export->report_attendees();
2331 2331
 		}
@@ -2344,73 +2344,73 @@  discard block
 block discarded – undo
2344 2344
 	 * @return void
2345 2345
 	 */
2346 2346
 	protected function _duplicate_attendee() {
2347
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2347
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2348 2348
 		//verify we have necessary info
2349
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2350
-			EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ );
2351
-			$query_args = array( 'action' => $action );
2349
+		if (empty($this->_req_data['_REG_ID'])) {
2350
+			EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
2351
+			$query_args = array('action' => $action);
2352 2352
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2353 2353
 		}
2354 2354
 
2355 2355
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2356
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2356
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2357 2357
 		$attendee = $registration->attendee();
2358 2358
 
2359 2359
 		//remove relation of existing attendee on registration
2360
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2360
+		$registration->_remove_relation_to($attendee, 'Attendee');
2361 2361
 		//new attendee
2362 2362
 		$new_attendee = clone $attendee;
2363
-		$new_attendee->set( 'ATT_ID', 0 );
2363
+		$new_attendee->set('ATT_ID', 0);
2364 2364
 		$new_attendee->save();
2365 2365
 
2366 2366
 		//add new attendee to reg
2367
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2367
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2368 2368
 
2369
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2369
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2370 2370
 
2371 2371
 		//redirect to edit page for attendee
2372
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2372
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2373 2373
 
2374
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2374
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2375 2375
 	}
2376 2376
 
2377 2377
 
2378 2378
 	//related to cpt routes
2379 2379
 	protected function _insert_update_cpt_item($post_id, $post) {
2380 2380
 		$success = true;
2381
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2381
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2382 2382
 		//for attendee updates
2383
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2383
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2384 2384
 			//note we should only be UPDATING attendees at this point.
2385 2385
 			$updated_fields = array(
2386 2386
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2387 2387
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2388
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2388
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2389 2389
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2390 2390
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2391
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2392
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2393
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2394
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2395
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2396
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2391
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2392
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2393
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2394
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2395
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2396
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2397 2397
 				);
2398
-			foreach ( $updated_fields as $field => $value ) {
2398
+			foreach ($updated_fields as $field => $value) {
2399 2399
 				$attendee->set($field, $value);
2400 2400
 			}
2401 2401
 
2402 2402
 			$success = $attendee->save();
2403 2403
 
2404
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2405
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2406
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2407
-					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 ) );
2404
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2405
+			foreach ($attendee_update_callbacks as $a_callback) {
2406
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2407
+					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));
2408 2408
 				}
2409 2409
 			}
2410 2410
 		}
2411 2411
 
2412
-		if ( $success === FALSE )
2413
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2412
+		if ($success === FALSE)
2413
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2414 2414
 
2415 2415
 	}
2416 2416
 
@@ -2430,17 +2430,17 @@  discard block
 block discarded – undo
2430 2430
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2431 2431
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2432 2432
 
2433
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2434
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2433
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2434
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2435 2435
 		}
2436 2436
 
2437
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2437
+		if (post_type_supports('espresso_attendees', 'comments')) {
2438 2438
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2439 2439
 		}
2440 2440
 
2441
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2442
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2443
-		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');
2441
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2442
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2443
+		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');
2444 2444
 	}
2445 2445
 
2446 2446
 
@@ -2449,10 +2449,10 @@  discard block
 block discarded – undo
2449 2449
 	 * @param  WP_Post $post wp post object
2450 2450
 	 * @return string        attendee contact info ( and form )
2451 2451
 	 */
2452
-	public function attendee_contact_info( $post ) {
2452
+	public function attendee_contact_info($post) {
2453 2453
 		//get attendee object ( should already have it )
2454 2454
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2455
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2455
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2456 2456
 		EEH_Template::display_template($template, $this->_template_args);
2457 2457
 	}
2458 2458
 
@@ -2468,12 +2468,12 @@  discard block
 block discarded – undo
2468 2468
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2469 2469
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2470 2470
 				new EE_Question_Form_Input(
2471
-				EE_Question::new_instance( array(
2471
+				EE_Question::new_instance(array(
2472 2472
 					'QST_ID' => 0,
2473 2473
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2474 2474
 					'QST_system' => 'admin-state'
2475 2475
 					)),
2476
-				EE_Answer::new_instance( array(
2476
+				EE_Answer::new_instance(array(
2477 2477
 					'ANS_ID' => 0,
2478 2478
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2479 2479
 					)),
@@ -2486,12 +2486,12 @@  discard block
 block discarded – undo
2486 2486
 			));
2487 2487
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2488 2488
 				new EE_Question_Form_Input(
2489
-				EE_Question::new_instance( array(
2489
+				EE_Question::new_instance(array(
2490 2490
 					'QST_ID' => 0,
2491 2491
 					'QST_display_text' => __('Country', 'event_espresso'),
2492 2492
 					'QST_system' => 'admin-country'
2493 2493
 					)),
2494
-				EE_Answer::new_instance( array(
2494
+				EE_Answer::new_instance(array(
2495 2495
 					'ANS_ID' => 0,
2496 2496
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2497 2497
 					)),
@@ -2502,8 +2502,8 @@  discard block
 block discarded – undo
2502 2502
 					'append_qstn_id' => FALSE
2503 2503
 					)
2504 2504
 				));
2505
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2506
-		EEH_Template::display_template($template, $this->_template_args );
2505
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2506
+		EEH_Template::display_template($template, $this->_template_args);
2507 2507
 
2508 2508
 	}
2509 2509
 
@@ -2513,11 +2513,11 @@  discard block
 block discarded – undo
2513 2513
 	*		@access protected
2514 2514
 	*		@return void
2515 2515
 	*/
2516
-	public function attendee_registrations_meta_box( $post ) {
2516
+	public function attendee_registrations_meta_box($post) {
2517 2517
 
2518 2518
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2519 2519
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2520
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2520
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2521 2521
 		EEH_Template::display_template($template, $this->_template_args);
2522 2522
 
2523 2523
 	}
@@ -2531,8 +2531,8 @@  discard block
 block discarded – undo
2531 2531
 	 * @return string        html for new form.
2532 2532
 	 */
2533 2533
 	public function after_title_form_fields($post) {
2534
-		if ( $post->post_type == 'espresso_attendees' ) {
2535
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2534
+		if ($post->post_type == 'espresso_attendees') {
2535
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2536 2536
 			$template_args['attendee'] = $this->_cpt_model_obj;
2537 2537
 			EEH_Template::display_template($template, $template_args);
2538 2538
 		}
@@ -2549,21 +2549,21 @@  discard block
 block discarded – undo
2549 2549
 	*		@access protected
2550 2550
 	*		@return void
2551 2551
 	*/
2552
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2552
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2553 2553
 
2554
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2554
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2555 2555
 
2556 2556
 		$ATT_MDL = EEM_Attendee::instance();
2557 2557
 
2558 2558
 		$success = 1;
2559 2559
 		//Checkboxes
2560
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2560
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2561 2561
 			// if array has more than one element than success message should be plural
2562
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2562
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2563 2563
 			// cycle thru checkboxes
2564
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2565
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2566
-				if ( !$updated ) {
2564
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2565
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2566
+				if ( ! $updated) {
2567 2567
 					$success = 0;
2568 2568
 				}
2569 2569
 			}
@@ -2572,18 +2572,18 @@  discard block
 block discarded – undo
2572 2572
 			// grab single id and delete
2573 2573
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2574 2574
 			//get attendee
2575
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2575
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2576 2576
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2577 2577
 			$updated = $att->save();
2578
-			if ( ! $updated ) {
2578
+			if ( ! $updated) {
2579 2579
 				$success = 0;
2580 2580
 			}
2581 2581
 
2582 2582
 		}
2583 2583
 
2584
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2585
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2586
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2584
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2585
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2586
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2587 2587
 
2588 2588
 	}
2589 2589
 
Please login to merge, or discard this patch.
admin_pages/transactions/EE_Admin_Transactions_List_Table.class.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
 	 *
94 94
 	 * @abstract
95 95
 	 * @access protected
96
-	 * @return array
96
+	 * @return string[]
97 97
 	 */
98 98
 	protected function _get_table_filters() {
99 99
 		$filters = array();
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 * @param \EE_Admin_Page $admin_page
34 34
 	 * @return EE_Admin_Transactions_List_Table
35 35
 	 */
36
-	function __construct( EE_Admin_Page $admin_page ){
37
-   		parent::__construct( $admin_page );
36
+	function __construct(EE_Admin_Page $admin_page) {
37
+   		parent::__construct($admin_page);
38 38
    		$this->_status = $this->_admin_page->get_transaction_status_array();
39 39
 
40 40
 	}
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
 
46 46
 	protected function _setup_data() {
47
-		$this->_data = $this->_admin_page->get_transactions( $this->_per_page );
48
-		$status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all';
49
-		$this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status );
47
+		$this->_data = $this->_admin_page->get_transactions($this->_per_page);
48
+		$status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all';
49
+		$this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status);
50 50
 	}
51 51
 
52 52
 
@@ -66,21 +66,21 @@  discard block
 block discarded – undo
66 66
 
67 67
 		$this->_columns = array(
68 68
 			'STS_ID' => '',
69
-			'TXN_ID' => __( 'ID', 'event_espresso' ),
70
-			'TXN_timestamp'	=> __( 'Transaction Date', 'event_espresso' ),
71
-			'TXN_total' => __( 'Total', 'event_espresso' ),
72
-			'TXN_paid' => __( 'Paid', 'event_espresso' ),
73
-			'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ),
74
-			'ATT_email' => __( 'Email Address', 'event_espresso' ),
75
-			'event_name' => __( 'Event', 'event_espresso' ),
76
-			'actions' => __( 'Actions', 'event_espresso' )
69
+			'TXN_ID' => __('ID', 'event_espresso'),
70
+			'TXN_timestamp'	=> __('Transaction Date', 'event_espresso'),
71
+			'TXN_total' => __('Total', 'event_espresso'),
72
+			'TXN_paid' => __('Paid', 'event_espresso'),
73
+			'ATT_fname' => __('Primary Registrant', 'event_espresso'),
74
+			'ATT_email' => __('Email Address', 'event_espresso'),
75
+			'event_name' => __('Event', 'event_espresso'),
76
+			'actions' => __('Actions', 'event_espresso')
77 77
 		);
78 78
 
79 79
 		$this->_sortable_columns = array(
80
-			'TXN_ID' => array( 'TXN_ID' => FALSE ),
81
-			'event_name' => array( 'event_name'=> FALSE ),
82
-			'ATT_fname'	=> array( 'ATT_fname'=> FALSE ),
83
-			'TXN_timestamp'	=> array( 'TXN_timestamp'=> TRUE ) //true means its already sorted
80
+			'TXN_ID' => array('TXN_ID' => FALSE),
81
+			'event_name' => array('event_name'=> FALSE),
82
+			'ATT_fname'	=> array('ATT_fname'=> FALSE),
83
+			'TXN_timestamp'	=> array('TXN_timestamp'=> TRUE) //true means its already sorted
84 84
 		);
85 85
 
86 86
 		$this->_hidden_columns = array();
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	protected function _get_table_filters() {
99 99
 		$filters = array();
100
-		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
101
-		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
100
+		$start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year'));
101
+		$end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y');
102 102
 		ob_start();
103 103
 		?>
104 104
 		<label for="txn-filter-start-date">Display Transactions from </label>
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 
117 117
 
118 118
 	protected function _add_view_counts() {
119
-		$this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' );
120
-		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' );
121
-		$this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' );
119
+		$this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all');
120
+		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned');
121
+		$this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed');
122 122
 	}
123 123
 
124 124
 
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 * @param \EE_Transaction $item
128 128
 	 * @return string
129 129
 	 */
130
-   function column_TXN_ID( EE_Transaction $item ){
131
-    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
132
-				return '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>';
130
+   function column_TXN_ID(EE_Transaction $item) {
131
+    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
132
+				return '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>';
133 133
 	}
134 134
 
135 135
 
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 * @param \EE_Transaction $item
139 139
 	 * @return string
140 140
 	 */
141
-	function column_STS_ID( EE_Transaction $item ){
142
-		return '<span class="ee-status-strip ee-status-strip-td txn-status-' . $item->status_ID() . '"></span>';
141
+	function column_STS_ID(EE_Transaction $item) {
142
+		return '<span class="ee-status-strip ee-status-strip-td txn-status-'.$item->status_ID().'"></span>';
143 143
 	}
144 144
 
145 145
 
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 	 * @param \EE_Transaction $item
149 149
 	 * @return string
150 150
 	 */
151
-	function column_cb($item ){
152
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'],  $item->ID());
151
+	function column_cb($item) {
152
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID());
153 153
 	}
154 154
 
155 155
 
@@ -158,19 +158,19 @@  discard block
 block discarded – undo
158 158
 	 * @param \EE_Transaction $item
159 159
 	 * @return string
160 160
 	 */
161
-	function column_TXN_timestamp( EE_Transaction $item ){
162
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
161
+	function column_TXN_timestamp(EE_Transaction $item) {
162
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
163 163
 		// is TXN less than 2 hours old ?
164 164
 		if (
165 165
 			(
166
-				( time() - EE_Registry::instance()->SSN->lifespan() )
167
-				< $item->datetime( false, true )
166
+				(time() - EE_Registry::instance()->SSN->lifespan())
167
+				< $item->datetime(false, true)
168 168
 			) &&
169
-			( $item->failed() || $item->is_abandoned() )
169
+			($item->failed() || $item->is_abandoned())
170 170
 		) {
171
-			$txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . __( 'TXN in progress...', 'event_espresso' ) . '</a>';
171
+			$txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.__('TXN in progress...', 'event_espresso').'</a>';
172 172
 		} else {
173
-			$txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $item->get_i18n_datetime( 'TXN_timestamp' ) .  '</a>';
173
+			$txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$item->get_i18n_datetime('TXN_timestamp').'</a>';
174 174
 		}
175 175
 		return $txn_date;
176 176
 	}
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 	 * @param \EE_Transaction $item
182 182
 	 * @return string
183 183
 	 */
184
-	function column_TXN_total( EE_Transaction $item ){
185
-		if ( $item->get('TXN_total') > 0 ) {
186
-			return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>';
184
+	function column_TXN_total(EE_Transaction $item) {
185
+		if ($item->get('TXN_total') > 0) {
186
+			return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>';
187 187
 		} else {
188
-			return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>';
188
+			return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>';
189 189
 		}
190 190
 	}
191 191
 
@@ -195,19 +195,19 @@  discard block
 block discarded – undo
195 195
 	 * @param \EE_Transaction $item
196 196
 	 * @return mixed|string
197 197
 	 */
198
-	function column_TXN_paid( EE_Transaction $item ){
198
+	function column_TXN_paid(EE_Transaction $item) {
199 199
 		$transaction_total = $item->get('TXN_total');
200 200
 		$transaction_paid = $item->get('TXN_paid');
201 201
 
202
-		if (( $transaction_total > 0 ) && ( $transaction_paid >= $transaction_total )) {
202
+		if (($transaction_total > 0) && ($transaction_paid >= $transaction_total)) {
203 203
 			// paid in full
204 204
 			$span_class = 'txn-overview-full-payment-spn';
205 205
 
206
-		} elseif (( $transaction_total > 0 ) && ( $transaction_paid > 0 )) {
206
+		} elseif (($transaction_total > 0) && ($transaction_paid > 0)) {
207 207
 			// monies owing
208 208
 			$span_class = 'txn-overview-part-payment-spn';
209 209
 
210
-		} elseif (( $transaction_total > 0 ) && ( $transaction_paid == 0 )) {
210
+		} elseif (($transaction_total > 0) && ($transaction_paid == 0)) {
211 211
 			// no payments made
212 212
 			$span_class = 'txn-overview-no-payment-spn';
213 213
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 			$transaction_paid = 0;
217 217
 		}
218 218
 
219
-		return '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>';
219
+		return '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>';
220 220
 
221 221
 	}
222 222
 
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
 	 * @param \EE_Transaction $item
227 227
 	 * @return string|void
228 228
 	 */
229
-	function column_ATT_fname( EE_Transaction $item ){
229
+	function column_ATT_fname(EE_Transaction $item) {
230 230
 		$primary_reg = $item->primary_registration();
231 231
 		$attendee = $primary_reg->get_first_related('Attendee');
232
-		if ( $attendee instanceof EE_Attendee ) {
233
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL );
234
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name();
232
+		if ($attendee instanceof EE_Attendee) {
233
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL);
234
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name();
235 235
 		}
236 236
 		return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
237 237
 	}
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 	 * @param \EE_Transaction $item
243 243
 	 * @return string|void
244 244
 	 */
245
-	function column_ATT_email( EE_Transaction $item ){
245
+	function column_ATT_email(EE_Transaction $item) {
246 246
 		$attendee = $item->primary_registration()->get_first_related('Attendee');
247
-		if ( !empty( $attendee ) )
248
-			return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
247
+		if ( ! empty($attendee))
248
+			return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>';
249 249
 		else
250 250
 			return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
251 251
 		;
@@ -257,20 +257,20 @@  discard block
 block discarded – undo
257 257
 	 * @param \EE_Transaction $item
258 258
 	 * @return string|void
259 259
 	 */
260
-    function column_event_name( EE_Transaction $item ){
260
+    function column_event_name(EE_Transaction $item) {
261 261
     	$actions = array();
262 262
 		$event = $item->primary_registration()->get_first_related('Event');
263
-		if ( !empty( $event ) ) {
264
-			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL );
263
+		if ( ! empty($event)) {
264
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL);
265 265
 			$event_name = $event->get('EVT_name');
266 266
 
267 267
 			//filter this view by transactions for this event
268
-			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) );
269
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) {
270
-				$actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>';
268
+			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID()));
269
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) {
270
+				$actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>';
271 271
 			}
272 272
 
273
-			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) );
273
+			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions));
274 274
 		} else {
275 275
 			return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso');
276 276
 		}
@@ -282,33 +282,33 @@  discard block
 block discarded – undo
282 282
 	 * @param \EE_Transaction $item
283 283
 	 * @return string
284 284
 	 */
285
-    function column_actions( EE_Transaction $item ){
285
+    function column_actions(EE_Transaction $item) {
286 286
 
287 287
     	$registration = $item->primary_registration();
288 288
     	$attendee = $registration->attendee();
289
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
289
+		EE_Registry::instance()->load_helper('MSG_Template');
290 290
 
291 291
         //Build row actions
292
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
292
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
293 293
 		$dl_invoice_lnk_url = $registration->invoice_url();
294 294
 		$dl_receipt_lnk_url = $registration->receipt_url();
295
-		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
296
-		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
295
+		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
296
+		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
297 297
 
298 298
 		//Build row actions
299 299
 		$view_lnk = '
300 300
 			<li>
301
-				<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text">
301
+				<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text">
302 302
 					<span class="dashicons dashicons-cart"></span>
303 303
 				</a>
304 304
 			</li>';
305 305
 
306 306
 
307 307
 	//only show invoice link if message type is active.
308
-	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
308
+	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
309 309
 		$dl_invoice_lnk = '
310 310
 		<li>
311
-			<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
311
+			<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
312 312
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
313 313
 			</a>
314 314
 		</li>';
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 	}
318 318
 
319 319
 	//only show receipt link if message type is active.
320
-	if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) {
320
+	if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) {
321 321
 		$dl_receipt_lnk = '
322 322
 		<li>
323
-			<a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
323
+			<a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
324 324
 				<span class="dashicons dashicons-media-default ee-icon-size-18"></span>
325 325
 			</a>
326 326
 		</li>';
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 	}
330 330
 
331 331
       		//only show payment reminder link if the message type is active.
332
-      		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
333
-		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? '
332
+      		if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
333
+		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? '
334 334
 			<li>
335
-				<a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">
335
+				<a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text">
336 336
 					<span class="dashicons dashicons-email-alt"></span>
337 337
 				</a>
338 338
 			</li>' : '';
@@ -341,14 +341,14 @@  discard block
 block discarded – undo
341 341
 			$send_pay_lnk = '';
342 342
 		}
343 343
 
344
-		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '
344
+		$view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
345 345
 			<li>
346
-				<a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
346
+				<a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
347 347
 					<span class="dashicons dashicons-clipboard"></span>
348 348
 				</a>
349 349
 			</li>' : '';
350 350
 
351
-	return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' );
351
+	return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul');
352 352
     }
353 353
 
354 354
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -244,10 +246,11 @@  discard block
 block discarded – undo
244 246
 	 */
245 247
 	function column_ATT_email( EE_Transaction $item ){
246 248
 		$attendee = $item->primary_registration()->get_first_related('Attendee');
247
-		if ( !empty( $attendee ) )
248
-			return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
249
-		else
250
-			return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
249
+		if ( !empty( $attendee ) ) {
250
+					return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>';
251
+		} else {
252
+					return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
253
+		}
251 254
 		;
252 255
 	}
253 256
 
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @return string
129 129
 	 */
130 130
    function column_TXN_ID( EE_Transaction $item ){
131
-    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
131
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
132 132
 				return '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>';
133 133
 	}
134 134
 
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 	 * @param \EE_Transaction $item
259 259
 	 * @return string|void
260 260
 	 */
261
-    function column_event_name( EE_Transaction $item ){
262
-    	$actions = array();
261
+	function column_event_name( EE_Transaction $item ){
262
+		$actions = array();
263 263
 		$event = $item->primary_registration()->get_first_related('Event');
264 264
 		if ( !empty( $event ) ) {
265 265
 			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL );
@@ -283,13 +283,13 @@  discard block
 block discarded – undo
283 283
 	 * @param \EE_Transaction $item
284 284
 	 * @return string
285 285
 	 */
286
-    function column_actions( EE_Transaction $item ){
286
+	function column_actions( EE_Transaction $item ){
287 287
 
288
-    	$registration = $item->primary_registration();
289
-    	$attendee = $registration->attendee();
288
+		$registration = $item->primary_registration();
289
+		$attendee = $registration->attendee();
290 290
 		EE_Registry::instance()->load_helper( 'MSG_Template' );
291 291
 
292
-        //Build row actions
292
+		//Build row actions
293 293
 		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
294 294
 		$dl_invoice_lnk_url = $registration->invoice_url();
295 295
 		$dl_receipt_lnk_url = $registration->receipt_url();
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
 		$dl_receipt_lnk = '';
330 330
 	}
331 331
 
332
-      		//only show payment reminder link if the message type is active.
333
-      		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
332
+	  		//only show payment reminder link if the message type is active.
333
+	  		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
334 334
 		$send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? '
335 335
 			<li>
336 336
 				<a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 			</li>' : '';
351 351
 
352 352
 	return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk, $item, 'ul', 'txn-overview-actions-ul' );
353
-    }
353
+	}
354 354
 
355 355
 
356 356
 }
Please login to merge, or discard this patch.
admin_pages/transactions/Transactions_Admin_Page.core.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1151,7 +1151,7 @@
 block discarded – undo
1151 1151
 	 * @param  EE_Transaction $transaction
1152 1152
 	 * @param \EE_Payment $payment
1153 1153
 	 * @param array $registration_query_where_params
1154
-	 * @return bool
1154
+	 * @return boolean|null
1155 1155
 	 */
1156 1156
 	protected function _process_updated_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $registration_query_where_params = array() ) {
1157 1157
 		// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 
90 90
 	/**
91 91
 	 * 		grab url requests and route them
92
-	*		@access private
93
-	*		@return void
94
-	*/
92
+	 *		@access private
93
+	 *		@return void
94
+	 */
95 95
 	public function _set_page_routes() {
96 96
 
97 97
 		$this->_set_transaction_status_array();
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 	/**
227 227
 	 * _set_transaction_status_array
228 228
 	 * sets list of transaction statuses
229
-	*
229
+	 *
230 230
 	 * @access private
231
-	*	@return void
232
-	*/
231
+	 *	@return void
232
+	 */
233 233
 	private function _set_transaction_status_array() {
234 234
 		self::$_txn_status = EEM_Transaction::instance()->status_array(TRUE);
235 235
 	}
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
 
252 252
 	/**
253 253
 	 * 	get list of payment statuses
254
-	*
254
+	 *
255 255
 	 * @access private
256
-	*	@return void
257
-	*/
256
+	 *	@return void
257
+	 */
258 258
 	private function _get_payment_status_array() {
259 259
 		self::$_pay_status = EEM_Payment::instance()->status_array(TRUE);
260 260
 		$this->_template_args['payment_status'] = self::$_pay_status;
@@ -362,18 +362,18 @@  discard block
 block discarded – undo
362 362
 		if ( is_object( $this->_transaction) )
363 363
 			return; //get out we've already set the object
364 364
 
365
-	    $TXN = EEM_Transaction::instance();
365
+		$TXN = EEM_Transaction::instance();
366 366
 
367
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
367
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
368 368
 
369
-	    //get transaction object
370
-	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
371
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
369
+		//get transaction object
370
+		$this->_transaction = $TXN->get_one_by_ID($TXN_ID);
371
+		$this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
372 372
 
373 373
 	 	if ( empty( $this->_transaction ) ) {
374
-	    	$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  __(' could not be retrieved.', 'event_espresso');
374
+			$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  __(' could not be retrieved.', 'event_espresso');
375 375
 			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
376
-	    }
376
+		}
377 377
 	}
378 378
 
379 379
 
@@ -475,12 +475,12 @@  discard block
 block discarded – undo
475 475
 
476 476
 
477 477
 	/**
478
-	* 	_transaction_details
478
+	 * 	_transaction_details
479 479
 	 * generates HTML for the View Transaction Details Admin page
480
-	*
480
+	 *
481 481
 	 * @access protected
482
-	*	@return void
483
-	*/
482
+	 *	@return void
483
+	 */
484 484
 	protected function _transaction_details() {
485 485
 		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
486 486
 		EE_Registry::instance()->load_helper( 'MSG_Template' );
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
 	/**
604 604
 	 * txn_details_meta_box
605 605
 	 * generates HTML for the Transaction main meta box
606
-	*
606
+	 *
607 607
 	 * @access public
608
-	*	@return void
609
-	*/
608
+	 *	@return void
609
+	 */
610 610
 	public function txn_details_meta_box() {
611 611
 
612 612
 		$this->_set_transaction_object();
@@ -947,10 +947,10 @@  discard block
 block discarded – undo
947 947
 	/**
948 948
 	 * txn_billing_info_side_meta_box
949 949
 	 * 	generates HTML for the Edit Transaction side meta box
950
-	*
950
+	 *
951 951
 	 * @access public
952
-	*	@return void
953
-	*/
952
+	 *	@return void
953
+	 */
954 954
 	public function txn_billing_info_side_meta_box() {
955 955
 
956 956
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
@@ -965,10 +965,10 @@  discard block
 block discarded – undo
965 965
 	/**
966 966
 	 * apply_payments_or_refunds
967 967
 	 * 	registers a payment or refund made towards a transaction
968
-	*
968
+	 *
969 969
 	 * @access public
970
-	*	@return void
971
-	*/
970
+	 *	@return void
971
+	 */
972 972
 	public function apply_payments_or_refunds() {
973 973
 
974 974
 		$json_response_data = array( 'return_data' => FALSE );
@@ -1206,10 +1206,10 @@  discard block
 block discarded – undo
1206 1206
 	/**
1207 1207
 	 * delete_payment
1208 1208
 	 * 	delete a payment or refund made towards a transaction
1209
-	*
1209
+	 *
1210 1210
 	 * @access public
1211
-	*	@return void
1212
-	*/
1211
+	 *	@return void
1212
+	 */
1213 1213
 	public function delete_payment() {
1214 1214
 
1215 1215
 		$json_response_data = array( 'return_data' => FALSE );
@@ -1273,12 +1273,12 @@  discard block
 block discarded – undo
1273 1273
 	/**
1274 1274
 	 * _send_payment_reminder
1275 1275
 	 * 	generates HTML for the View Transaction Details Admin page
1276
-	*
1276
+	 *
1277 1277
 	 * @access protected
1278
-	*	@return void
1279
-	*/
1278
+	 *	@return void
1279
+	 */
1280 1280
 	protected function _send_payment_reminder() {
1281
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1281
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1282 1282
 		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1283 1283
 		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1284 1284
 		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
@@ -1301,29 +1301,29 @@  discard block
 block discarded – undo
1301 1301
 
1302 1302
 		$TXN = EEM_Transaction::instance();
1303 1303
 
1304
-	    $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1305
-	    $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1304
+		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1305
+		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1306 1306
 
1307
-	    //make sure our timestamps start and end right at the boundaries for each day
1308
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1309
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1307
+		//make sure our timestamps start and end right at the boundaries for each day
1308
+		$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1309
+		$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1310 1310
 
1311 1311
 
1312
-	    //convert to timestamps
1313
-	    $start_date = strtotime( $start_date );
1314
-	    $end_date = strtotime( $end_date );
1312
+		//convert to timestamps
1313
+		$start_date = strtotime( $start_date );
1314
+		$end_date = strtotime( $end_date );
1315 1315
 
1316
-	    //makes sure start date is the lowest value and vice versa
1317
-	    $start_date = min( $start_date, $end_date );
1318
-	    $end_date = max( $start_date, $end_date );
1316
+		//makes sure start date is the lowest value and vice versa
1317
+		$start_date = min( $start_date, $end_date );
1318
+		$end_date = max( $start_date, $end_date );
1319 1319
 
1320
-	    //convert to correct format for query
1320
+		//convert to correct format for query
1321 1321
 	$start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
1322 1322
 	$end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
1323 1323
 
1324 1324
 
1325 1325
 
1326
-	    //set orderby
1326
+		//set orderby
1327 1327
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1328 1328
 
1329 1329
 		switch ( $this->_req_data['orderby'] ) {
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -359,8 +361,10 @@  discard block
 block discarded – undo
359 361
 	 *	@return void
360 362
 	 */
361 363
 	private function _set_transaction_object() {
362
-		if ( is_object( $this->_transaction) )
363
-			return; //get out we've already set the object
364
+		if ( is_object( $this->_transaction) ) {
365
+					return;
366
+		}
367
+		//get out we've already set the object
364 368
 
365 369
 	    $TXN = EEM_Transaction::instance();
366 370
 
@@ -836,7 +840,7 @@  discard block
 block discarded – undo
836 840
 			$query_args = array( array( 'OR*payment_method_for_payment' => array(
837 841
 					'PMD_ID' => array( 'IN', $payment_methods_of_payments ),
838 842
 					'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) );
839
-		}else{
843
+		} else{
840 844
 			$query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) );
841 845
 		}
842 846
 		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args );
Please login to merge, or discard this patch.
Spacing   +333 added lines, -333 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	 * @param bool $routing
40 40
 	 * @return Transactions_Admin_Page
41 41
 	 */
42
-	public function __construct( $routing = TRUE ) {
43
-		parent::__construct( $routing );
42
+	public function __construct($routing = TRUE) {
43
+		parent::__construct($routing);
44 44
 	}
45 45
 
46 46
 
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	 * @return void
64 64
 	 */
65 65
 	protected function _ajax_hooks() {
66
-		add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds'));
67
-		add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds'));
68
-		add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment'));
66
+		add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds'));
67
+		add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds'));
68
+		add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment'));
69 69
 	}
70 70
 
71 71
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 			'buttons' => array(
81 81
 				'add' => __('Add New Transaction', 'event_espresso'),
82 82
 				'edit' => __('Edit Transaction', 'event_espresso'),
83
-				'delete' => __('Delete Transaction','event_espresso')
83
+				'delete' => __('Delete Transaction', 'event_espresso')
84 84
 				)
85 85
 			);
86 86
 	}
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
 		$this->_set_transaction_status_array();
98 98
 
99
-		$txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0;
99
+		$txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0;
100 100
 
101 101
 		$this->_page_routes = array(
102 102
 
@@ -168,15 +168,15 @@  discard block
 block discarded – undo
168 168
 						'filename' => 'transactions_overview_views_filters_search'
169 169
 					),
170 170
 				),
171
-				'help_tour' => array( 'Transactions_Overview_Help_Tour' ),
172
-				'qtips' => array( 'Transactions_List_Table_Tips' ),
171
+				'help_tour' => array('Transactions_Overview_Help_Tour'),
172
+				'qtips' => array('Transactions_List_Table_Tips'),
173 173
 				'require_nonce' => FALSE
174 174
 				),
175 175
 			'view_transaction' => array(
176 176
 				'nav' => array(
177 177
 					'label' => __('View Transaction', 'event_espresso'),
178 178
 					'order' => 5,
179
-					'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
179
+					'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
180 180
 					'persistent' => FALSE
181 181
 					),
182 182
 				'help_tabs' => array(
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 						'filename' => 'transactions_view_transaction_primary_registrant_billing_information'
198 198
 					),
199 199
 				),
200
-				'qtips' => array( 'Transaction_Details_Tips' ),
201
-				'help_tour' => array( 'Transaction_Details_Help_Tour' ),
200
+				'qtips' => array('Transaction_Details_Tips'),
201
+				'help_tour' => array('Transaction_Details_Help_Tour'),
202 202
 				'metaboxes' => array('_transaction_details_metaboxes'),
203 203
 
204 204
 				'require_nonce' => FALSE
@@ -278,19 +278,19 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public function load_scripts_styles() {
280 280
 		//enqueue style
281
-		wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION );
281
+		wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION);
282 282
 		wp_enqueue_style('espresso_txn');
283 283
 
284 284
 		//scripts
285 285
 		add_filter('FHEE_load_accounting_js', '__return_true');
286 286
 
287 287
 		//scripts
288
-		wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
288
+		wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
289 289
 		wp_enqueue_script('espresso_txn');
290 290
 
291 291
 		;
292
-		EE_Registry::$i18n_js_strings['invalid_server_response'] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' );
293
-		EE_Registry::$i18n_js_strings['error_occurred'] = __(  'An error occurred! Please refresh the page and try again.', 'event_espresso' );
292
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso');
293
+		EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso');
294 294
 		EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status;
295 295
 		EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status;
296 296
 
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 	 *	@return void
334 334
 	 */
335 335
 	protected function _set_list_table_views_default() {
336
-		$this->_views = array (
337
-			'all' => array (
336
+		$this->_views = array(
337
+			'all' => array(
338 338
 				'slug' 		=> 'all',
339 339
 				'label' 		=> __('View All Transactions', 'event_espresso'),
340 340
 				'count' 	=> 0
@@ -362,20 +362,20 @@  discard block
 block discarded – undo
362 362
 	 *	@return void
363 363
 	 */
364 364
 	private function _set_transaction_object() {
365
-		if ( is_object( $this->_transaction) )
365
+		if (is_object($this->_transaction))
366 366
 			return; //get out we've already set the object
367 367
 
368 368
 	    $TXN = EEM_Transaction::instance();
369 369
 
370
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
370
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
371 371
 
372 372
 	    //get transaction object
373 373
 	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
374
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
374
+	    $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL;
375 375
 
376
-	 	if ( empty( $this->_transaction ) ) {
377
-	    	$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  __(' could not be retrieved.', 'event_espresso');
378
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
376
+	 	if (empty($this->_transaction)) {
377
+	    	$error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.__(' could not be retrieved.', 'event_espresso');
378
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
379 379
 	    }
380 380
 	}
381 381
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 				),
402 402
 				'view_receipt' => array(
403 403
 					'class' => 'dashicons dashicons-media-default',
404
-					'desc' => __('View Transaction Receipt', 'event_espresso' )
404
+					'desc' => __('View Transaction Receipt', 'event_espresso')
405 405
 				),
406 406
 				'view_registration' => array(
407 407
 					'class' => 'dashicons dashicons-clipboard',
@@ -410,10 +410,10 @@  discard block
 block discarded – undo
410 410
 			)
411 411
 		);
412 412
 
413
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) {
413
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) {
414 414
 
415
-			EE_Registry::instance()->load_helper( 'MSG_Template' );
416
-			if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
415
+			EE_Registry::instance()->load_helper('MSG_Template');
416
+			if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
417 417
 				$items['send_payment_reminder'] = array(
418 418
 					'class' => 'dashicons dashicons-email-alt',
419 419
 					'desc' => __('Send Payment Reminder', 'event_espresso')
@@ -434,29 +434,29 @@  discard block
 block discarded – undo
434 434
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items',
435 435
 			array(
436 436
 				'overpaid'   => array(
437
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code,
438
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' )
437
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code,
438
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence')
439 439
 				),
440 440
 				'complete'   => array(
441
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code,
442
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' )
441
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code,
442
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence')
443 443
 				),
444 444
 				'incomplete' => array(
445
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code,
446
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' )
445
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code,
446
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence')
447 447
 				),
448 448
 				'abandoned'  => array(
449
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code,
450
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' )
449
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code,
450
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence')
451 451
 				),
452 452
 				'failed'     => array(
453
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code,
454
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' )
453
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code,
454
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence')
455 455
 				)
456 456
 			)
457 457
 		);
458 458
 
459
-		return array_merge( $items, $more_items);
459
+		return array_merge($items, $more_items);
460 460
 	}
461 461
 
462 462
 
@@ -469,9 +469,9 @@  discard block
 block discarded – undo
469 469
 	 */
470 470
 	protected function _transactions_overview_list_table() {
471 471
 		$this->_admin_page_title = __('Transactions', 'event_espresso');
472
-		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL;
473
-		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : '';
474
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() );
472
+		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL;
473
+		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : '';
474
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items());
475 475
 		$this->display_admin_list_table_page_with_no_sidebar();
476 476
 	}
477 477
 
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
 	*	@return void
486 486
 	*/
487 487
 	protected function _transaction_details() {
488
-		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
489
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
488
+		do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction);
489
+		EE_Registry::instance()->load_helper('MSG_Template');
490 490
 
491 491
 		$this->_set_transaction_status_array();
492 492
 
@@ -499,75 +499,75 @@  discard block
 block discarded – undo
499 499
 		$attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL;
500 500
 
501 501
 		$this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID();
502
-		$this->_template_args['txn_nmbr']['label'] = __( 'Transaction Number', 'event_espresso' );
502
+		$this->_template_args['txn_nmbr']['label'] = __('Transaction Number', 'event_espresso');
503 503
 
504
-		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_datetime('TXN_timestamp', 'l F j, Y', 'g:i:s a' );
505
-		$this->_template_args['txn_datetime']['label'] = __( 'Date', 'event_espresso' );
504
+		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_datetime('TXN_timestamp', 'l F j, Y', 'g:i:s a');
505
+		$this->_template_args['txn_datetime']['label'] = __('Date', 'event_espresso');
506 506
 
507
-		$this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ];
508
-		$this->_template_args['txn_status']['label'] = __( 'Transaction Status', 'event_espresso' );
509
-		$this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID');
507
+		$this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')];
508
+		$this->_template_args['txn_status']['label'] = __('Transaction Status', 'event_espresso');
509
+		$this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID');
510 510
 
511 511
 		$this->_template_args['grand_total'] = $this->_transaction->get('TXN_total');
512 512
 		$this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid');
513 513
 
514
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) {
515
-			EE_Registry::instance()->load_helper( 'MSG_Template' );
516
-			$this->_template_args['send_payment_reminder_button'] = EEH_MSG_Template::is_mt_active( 'payment_reminder' )
514
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) {
515
+			EE_Registry::instance()->load_helper('MSG_Template');
516
+			$this->_template_args['send_payment_reminder_button'] = EEH_MSG_Template::is_mt_active('payment_reminder')
517 517
 				 && $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code
518 518
 				 && $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code
519
-				 ? EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$this->_transaction->ID(), 'redirect_to' => 'view_transaction' ), TXN_ADMIN_URL ), __(' Send Payment Reminder'), 'button secondary-button right',  'dashicons dashicons-email-alt' )
519
+				 ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$this->_transaction->ID(), 'redirect_to' => 'view_transaction'), TXN_ADMIN_URL), __(' Send Payment Reminder'), 'button secondary-button right', 'dashicons dashicons-email-alt')
520 520
 				 : '';
521 521
 		} else {
522 522
 			$this->_template_args['send_payment_reminder_button'] = '';
523 523
 		}
524 524
 
525 525
 		$amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid');
526
-		$this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE );
527
-		if ( EE_Registry::instance()->CFG->currency->sign_b4 ) {
528
-			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due'];
526
+		$this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE);
527
+		if (EE_Registry::instance()->CFG->currency->sign_b4) {
528
+			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due'];
529 529
 		} else {
530
-			$this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign;
530
+			$this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign;
531 531
 		}
532
-		$this->_template_args['amount_due_class'] =  '';
532
+		$this->_template_args['amount_due_class'] = '';
533 533
 
534
-		if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) {
534
+		if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) {
535 535
 			// paid in full
536
-			$this->_template_args['amount_due'] =  FALSE;
537
-		} elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) {
536
+			$this->_template_args['amount_due'] = FALSE;
537
+		} elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) {
538 538
 			// overpaid
539
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
540
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) {
539
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
540
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) {
541 541
 			// monies owing
542
-			$this->_template_args['amount_due_class'] =  'txn-overview-part-payment-spn';
543
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) {
542
+			$this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn';
543
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) {
544 544
 			// no payments made yet
545
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
546
-		} elseif ( $this->_transaction->get('TXN_total') == 0 ) {
545
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
546
+		} elseif ($this->_transaction->get('TXN_total') == 0) {
547 547
 			// free event
548
-			$this->_template_args['amount_due'] =  FALSE;
548
+			$this->_template_args['amount_due'] = FALSE;
549 549
 		}
550 550
 
551 551
 		$payment_method = $this->_transaction->payment_method();
552 552
 
553
-		$this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' );
553
+		$this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso');
554 554
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
555 555
 		// link back to overview
556
-		$this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : TXN_ADMIN_URL;
556
+		$this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : TXN_ADMIN_URL;
557 557
 
558 558
 
559 559
 		//next and previous links
560
-		$next_txn = $this->_transaction->next(null, array(), 'TXN_ID' );
561
-		$this->_template_args['next_transaction'] = $next_txn ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ), TXN_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';
562
-		$previous_txn = $this->_transaction->previous( null, array(), 'TXN_ID' );
563
-		$this->_template_args['previous_transaction'] = $previous_txn ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ), TXN_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';
560
+		$next_txn = $this->_transaction->next(null, array(), 'TXN_ID');
561
+		$this->_template_args['next_transaction'] = $next_txn ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']), TXN_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : '';
562
+		$previous_txn = $this->_transaction->previous(null, array(), 'TXN_ID');
563
+		$this->_template_args['previous_transaction'] = $previous_txn ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']), TXN_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : '';
564 564
 
565 565
 
566 566
 		// grab messages at the last second
567 567
 		$this->_template_args['notices'] = EE_Error::get_notices();
568 568
 		// path to template
569
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php';
570
-		$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
569
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php';
570
+		$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
571 571
 
572 572
 		// the details template wrapper
573 573
 		$this->display_admin_page_with_sidebar();
@@ -586,18 +586,18 @@  discard block
 block discarded – undo
586 586
 
587 587
 		$this->_set_transaction_object();
588 588
 
589
-		add_meta_box( 'edit-txn-details-mbox', __( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' );
589
+		add_meta_box('edit-txn-details-mbox', __('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high');
590 590
 		add_meta_box(
591 591
 			'edit-txn-attendees-mbox',
592
-			__( 'Attendees Registered in this Transaction', 'event_espresso' ),
593
-			array( $this, 'txn_attendees_meta_box' ),
592
+			__('Attendees Registered in this Transaction', 'event_espresso'),
593
+			array($this, 'txn_attendees_meta_box'),
594 594
 			$this->_wp_page_slug,
595 595
 			'normal',
596 596
 			'high',
597
-			array( 'TXN_ID' => $this->_transaction->ID() )
597
+			array('TXN_ID' => $this->_transaction->ID())
598 598
 		);
599
-		add_meta_box( 'edit-txn-registrant-mbox', __( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
600
-		add_meta_box( 'edit-txn-billing-info-mbox', __( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
599
+		add_meta_box('edit-txn-registrant-mbox', __('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
600
+		add_meta_box('edit-txn-billing-info-mbox', __('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
601 601
 
602 602
 	}
603 603
 
@@ -617,14 +617,14 @@  discard block
 block discarded – undo
617 617
 		$this->_template_args['attendee'] = $this->_transaction->primary_registration()->attendee();
618 618
 
619 619
 		//get line items from transaction
620
-		$this->_template_args['line_items'] = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item' ) ) );
620
+		$this->_template_args['line_items'] = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
621 621
 		$this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code');
622 622
 
623 623
 		// process taxes
624
-		$taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax )));
625
-		$this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE;
624
+		$taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax)));
625
+		$this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE;
626 626
 
627
-		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE );
627
+		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE);
628 628
 		$this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total');
629 629
 		$this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID');
630 630
 
@@ -632,63 +632,63 @@  discard block
 block discarded – undo
632 632
 
633 633
 		// process payment details
634 634
 		$payments = $this->_transaction->get_many_related('Payment');
635
-		if( ! empty(  $payments ) ) {
636
-			$this->_template_args[ 'payments' ] = $payments;
637
-			$this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments );
635
+		if ( ! empty($payments)) {
636
+			$this->_template_args['payments'] = $payments;
637
+			$this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments);
638 638
 		} else {
639
-			$this->_template_args[ 'payments' ] = false;
640
-			$this->_template_args[ 'existing_reg_payments' ] = array();
639
+			$this->_template_args['payments'] = false;
640
+			$this->_template_args['existing_reg_payments'] = array();
641 641
 		}
642 642
 
643
-		$this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment'  ), TXN_ADMIN_URL );
644
-		$this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL );
643
+		$this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL);
644
+		$this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL);
645 645
 
646
-		if ( isset( $txn_details['invoice_number'] )) {
646
+		if (isset($txn_details['invoice_number'])) {
647 647
 			$this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code'];
648
-			$this->_template_args['txn_details']['invoice_number']['label'] = __( 'Invoice Number', 'event_espresso' );
648
+			$this->_template_args['txn_details']['invoice_number']['label'] = __('Invoice Number', 'event_espresso');
649 649
 		}
650 650
 
651 651
 		$this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session');
652
-		$this->_template_args['txn_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
652
+		$this->_template_args['txn_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
653 653
 
654
-		$this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '';
655
-		$this->_template_args['txn_details']['ip_address']['label'] = __( 'Transaction placed from IP', 'event_espresso' );
654
+		$this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '';
655
+		$this->_template_args['txn_details']['ip_address']['label'] = __('Transaction placed from IP', 'event_espresso');
656 656
 
657
-		$this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '';
658
-		$this->_template_args['txn_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
657
+		$this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '';
658
+		$this->_template_args['txn_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
659 659
 
660 660
 		$reg_steps = '<ul>';
661
-		foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) {
662
-			if ( $reg_step_status === true ) {
663
-				$reg_steps .= '<li style="color:#70cc50">' . sprintf( __( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
664
-			} else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) {
665
-					$reg_steps .= '<li style="color:#2EA2CC">' . sprintf(
666
-							__( '%1$s : Initiated %2$s', 'event_espresso' ),
667
-							ucwords( str_replace( '_', ' ', $reg_step ) ),
668
-							gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) )
669
-						) . '</li>';
661
+		foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) {
662
+			if ($reg_step_status === true) {
663
+				$reg_steps .= '<li style="color:#70cc50">'.sprintf(__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
664
+			} else if (is_numeric($reg_step_status) && $reg_step_status !== false) {
665
+					$reg_steps .= '<li style="color:#2EA2CC">'.sprintf(
666
+							__('%1$s : Initiated %2$s', 'event_espresso'),
667
+							ucwords(str_replace('_', ' ', $reg_step)),
668
+							gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS)))
669
+						).'</li>';
670 670
 				} else {
671
-				$reg_steps .= '<li style="color:#E76700">' . sprintf( __( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
671
+				$reg_steps .= '<li style="color:#E76700">'.sprintf(__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
672 672
 			}
673 673
 		}
674 674
 		$reg_steps .= '</ul>';
675 675
 		$this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps;
676
-		$this->_template_args['txn_details']['reg_steps']['label'] = __( 'Registration Step Progress', 'event_espresso' );
676
+		$this->_template_args['txn_details']['reg_steps']['label'] = __('Registration Step Progress', 'event_espresso');
677 677
 
678 678
 
679 679
 		$this->_get_registrations_to_apply_payment_to();
680
-		$this->_get_payment_methods( $payments );
680
+		$this->_get_payment_methods($payments);
681 681
 		$this->_get_payment_status_array();
682 682
 		$this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction.
683 683
 
684
-		$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction'  ), TXN_ADMIN_URL );
685
-		$this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL );
686
-		$this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL );
684
+		$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL);
685
+		$this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL);
686
+		$this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL);
687 687
 
688 688
 		// 'espresso_delete_payment_nonce'
689 689
 
690
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php';
691
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
690
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php';
691
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
692 692
 
693 693
 	}
694 694
 
@@ -703,27 +703,27 @@  discard block
 block discarded – undo
703 703
 	 * @param EE_Payment[] $payments
704 704
 	 * @return array
705 705
 	 */
706
-	protected function _get_registration_payment_IDs( $payments = array() ) {
706
+	protected function _get_registration_payment_IDs($payments = array()) {
707 707
 		$existing_reg_payments = array();
708 708
 		// get all reg payments for these payments
709
-		$reg_payments = EEM_Registration_Payment::instance()->get_all( array(
709
+		$reg_payments = EEM_Registration_Payment::instance()->get_all(array(
710 710
 			array(
711 711
 				'PAY_ID' => array(
712 712
 					'IN',
713
-					array_keys( $payments )
713
+					array_keys($payments)
714 714
 				)
715 715
 			)
716
-		) );
717
-		if ( ! empty( $reg_payments ) ) {
718
-			foreach ( $payments as $payment ) {
719
-				if ( ! $payment instanceof EE_Payment ) {
716
+		));
717
+		if ( ! empty($reg_payments)) {
718
+			foreach ($payments as $payment) {
719
+				if ( ! $payment instanceof EE_Payment) {
720 720
 					continue;
721
-				} else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) {
722
-					$existing_reg_payments[ $payment->ID() ] = array();
721
+				} else if ( ! isset($existing_reg_payments[$payment->ID()])) {
722
+					$existing_reg_payments[$payment->ID()] = array();
723 723
 				}
724
-				foreach ( $reg_payments as $reg_payment ) {
725
-					if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) {
726
-						$existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID();
724
+				foreach ($reg_payments as $reg_payment) {
725
+					if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) {
726
+						$existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID();
727 727
 					}
728 728
 				}
729 729
 			}
@@ -760,39 +760,39 @@  discard block
 block discarded – undo
760 760
 		$registrations_to_apply_payment_to .= '<br /><div class="admin-primary-mbox-tbl-wrap">';
761 761
 		$registrations_to_apply_payment_to .= '<table class="admin-primary-mbox-tbl">';
762 762
 		$registrations_to_apply_payment_to .= '<thead><tr>';
763
-		$registrations_to_apply_payment_to .= '<td>' . __( 'ID', 'event_espresso' ) . '</td>';
764
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Registrant', 'event_espresso' ) . '</td>';
765
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Ticket', 'event_espresso' ) . '</td>';
766
-		$registrations_to_apply_payment_to .= '<td>' . __( 'Event', 'event_espresso' ) . '</td>';
767
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">' . __( 'Paid', 'event_espresso' ) . '</td>';
768
-		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">' . __( 'Owing', 'event_espresso' ) . '</td>';
769
-		$registrations_to_apply_payment_to .= '<td class="jst-cntr">' . __( 'Apply', 'event_espresso' ) . '</td>';
763
+		$registrations_to_apply_payment_to .= '<td>'.__('ID', 'event_espresso').'</td>';
764
+		$registrations_to_apply_payment_to .= '<td>'.__('Registrant', 'event_espresso').'</td>';
765
+		$registrations_to_apply_payment_to .= '<td>'.__('Ticket', 'event_espresso').'</td>';
766
+		$registrations_to_apply_payment_to .= '<td>'.__('Event', 'event_espresso').'</td>';
767
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">'.__('Paid', 'event_espresso').'</td>';
768
+		$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">'.__('Owing', 'event_espresso').'</td>';
769
+		$registrations_to_apply_payment_to .= '<td class="jst-cntr">'.__('Apply', 'event_espresso').'</td>';
770 770
 		$registrations_to_apply_payment_to .= '</tr></thead><tbody>';
771 771
 		// get registrations for TXN
772
-		$registrations = $this->_transaction->registrations( $query_params );
773
-		foreach ( $registrations as $registration ) {
774
-			if ( $registration instanceof EE_Registration ) {
772
+		$registrations = $this->_transaction->registrations($query_params);
773
+		foreach ($registrations as $registration) {
774
+			if ($registration instanceof EE_Registration) {
775 775
 				$owing = $registration->final_price() - $registration->paid();
776
-				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> ' . __( '+ tax', 'event_espresso' ) . '</span>' : '';
777
-				$checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) ? ' checked="checked"' : '';
776
+				$taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> '.__('+ tax', 'event_espresso').'</span>' : '';
777
+				$checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) ? ' checked="checked"' : '';
778 778
 				$registrations_to_apply_payment_to .= '<tr>';
779 779
 				// add html for checkbox input and label
780
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ID() . '</td>';
781
-				$registrations_to_apply_payment_to .= '<td>' . $registration->attendee()->full_name() . '</td>';
782
-				$registrations_to_apply_payment_to .= '<td>' . $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable . '</td>';
783
-				$registrations_to_apply_payment_to .= '<td>' . $registration->event_name() . '</td>';
784
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">' . $registration->pretty_paid() . '</td>';
785
-				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">' . EEH_Template::format_currency( $owing ) . '</td>';
780
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ID().'</td>';
781
+				$registrations_to_apply_payment_to .= '<td>'.$registration->attendee()->full_name().'</td>';
782
+				$registrations_to_apply_payment_to .= '<td>'.$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable.'</td>';
783
+				$registrations_to_apply_payment_to .= '<td>'.$registration->event_name().'</td>';
784
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">'.$registration->pretty_paid().'</td>';
785
+				$registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">'.EEH_Template::format_currency($owing).'</td>';
786 786
 				$registrations_to_apply_payment_to .= '<td class="jst-cntr">';
787 787
 				$disabled = $registration->final_price() > 0 ? '' : ' disabled';
788
-				$registrations_to_apply_payment_to .= '<input type="checkbox" value="' . $registration->ID() . '" name="txn_admin_payment[registrations]"' . $checked . $disabled . '>';
788
+				$registrations_to_apply_payment_to .= '<input type="checkbox" value="'.$registration->ID().'" name="txn_admin_payment[registrations]"'.$checked.$disabled.'>';
789 789
 				$registrations_to_apply_payment_to .= '</td>';
790 790
 				$registrations_to_apply_payment_to .= '</tr>';
791 791
 			}
792 792
 		}
793 793
 		$registrations_to_apply_payment_to .= '</tbody></table></div>';
794
-		$registrations_to_apply_payment_to .= '<p class="clear description">' . __( 'The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso' ) . '</p></div>';
795
-		$this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to;
794
+		$registrations_to_apply_payment_to .= '<p class="clear description">'.__('The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso').'</p></div>';
795
+		$this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to;
796 796
 	}
797 797
 
798 798
 
@@ -809,9 +809,9 @@  discard block
 block discarded – undo
809 809
 		$statuses = EEM_Registration::reg_status_array(array(), TRUE);
810 810
 		//let's add a "don't change" option.
811 811
 		$status_array['NAN'] = __('Leave the Same', 'event_espresso');
812
-		$status_array = array_merge( $status_array, $statuses );
813
-		$this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' );
814
-		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' );
812
+		$status_array = array_merge($status_array, $statuses);
813
+		$this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status');
814
+		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status');
815 815
 
816 816
 	}
817 817
 
@@ -826,21 +826,21 @@  discard block
 block discarded – undo
826 826
 	 * @param EE_Payment[] to show on this page
827 827
 	 *	@return void
828 828
 	 */
829
-	private function _get_payment_methods( $payments = array() ) {
829
+	private function _get_payment_methods($payments = array()) {
830 830
 		$payment_methods_of_payments = array();
831
-		foreach( $payments as $payment ){
832
-			if( $payment instanceof EE_Payment ){
833
-				$payment_methods_of_payments[] = $payment->get( 'PMD_ID' );
831
+		foreach ($payments as $payment) {
832
+			if ($payment instanceof EE_Payment) {
833
+				$payment_methods_of_payments[] = $payment->get('PMD_ID');
834 834
 			}
835 835
 		}
836
-		if( $payment_methods_of_payments ){
837
-			$query_args = array( array( 'OR*payment_method_for_payment' => array(
838
-					'PMD_ID' => array( 'IN', $payment_methods_of_payments ),
839
-					'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) );
840
-		}else{
841
-			$query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) );
836
+		if ($payment_methods_of_payments) {
837
+			$query_args = array(array('OR*payment_method_for_payment' => array(
838
+					'PMD_ID' => array('IN', $payment_methods_of_payments),
839
+					'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') )));
840
+		} else {
841
+			$query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%')));
842 842
 		}
843
-		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args );
843
+		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args);
844 844
 	}
845 845
 
846 846
 
@@ -854,46 +854,46 @@  discard block
 block discarded – undo
854 854
 	 * @param array $metabox
855 855
 	 * @return void
856 856
 	 */
857
-	public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) {
857
+	public function txn_attendees_meta_box($post, $metabox = array('args' => array())) {
858 858
 
859
-		extract( $metabox['args'] );
859
+		extract($metabox['args']);
860 860
 		$this->_template_args['post'] = $post;
861 861
 		$this->_template_args['event_attendees'] = array();
862 862
 		// process items in cart
863
-		$line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) );
864
-		if ( ! empty( $line_items )) {
865
-			foreach ( $line_items as $item ) {
866
-				if ( $item instanceof EE_Line_Item ) {
867
-					switch( $item->OBJ_type() ) {
863
+		$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
864
+		if ( ! empty($line_items)) {
865
+			foreach ($line_items as $item) {
866
+				if ($item instanceof EE_Line_Item) {
867
+					switch ($item->OBJ_type()) {
868 868
 
869 869
 						case 'Event' :
870 870
 							break;
871 871
 
872 872
 						case 'Ticket' :
873 873
 							$ticket = $item->ticket();
874
-							if ( empty( $ticket )) {
874
+							if (empty($ticket)) {
875 875
 								continue; //right now we're only handling tickets here.  Cause its expected that only tickets will have attendees right?
876 876
 							}
877
-							$ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' ));
877
+							$ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price'));
878 878
 							$event = $ticket->get_first_related('Registration')->get_first_related('Event');
879
-							$event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : '';
879
+							$event_name = $event instanceof EE_Event ? $event->get('EVT_name').' - '.$item->get('LIN_name') : '';
880 880
 
881
-							$registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() )));
882
-							foreach( $registrations as $registration ) {
883
-								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] 						= $registration->get('REG_count');
884
-								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] 	= $event_name;
885
-								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] 				= $ticket_price;
881
+							$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
882
+							foreach ($registrations as $registration) {
883
+								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count');
884
+								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name;
885
+								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price;
886 886
 								// attendee info
887 887
 								$attendee = $registration->get_first_related('Attendee');
888
-								if ( $attendee instanceof EE_Attendee ) {
888
+								if ($attendee instanceof EE_Attendee) {
889 889
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= $attendee->ID();
890 890
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= $attendee->full_name();
891
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . __(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>';
892
-									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		=  implode(',<br>', $attendee->full_address_as_array() );
891
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event->get('EVT_name').__(' Event', 'event_espresso').'">'.$attendee->email().'</a>';
892
+									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= implode(',<br>', $attendee->full_address_as_array());
893 893
 								} else {
894 894
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 			= '';
895 895
 									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= '';
896
-									$this->_template_args['event_attendees'][$registration->ID()]['email'] 			= '';
896
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '';
897 897
 									$this->_template_args['event_attendees'][$registration->ID()]['address'] 		= '';
898 898
 								}
899 899
 							}
@@ -903,12 +903,12 @@  discard block
 block discarded – undo
903 903
 				}
904 904
 			}
905 905
 
906
-			$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees'  ), TXN_ADMIN_URL );
907
-			echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE );
906
+			$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
907
+			echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE);
908 908
 
909 909
 		} else {
910 910
 			echo sprintf(
911
-				__( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ),
911
+				__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'),
912 912
 				'<p class="important-notice">',
913 913
 				'</p>'
914 914
 			);
@@ -927,20 +927,20 @@  discard block
 block discarded – undo
927 927
 	 */
928 928
 	public function txn_registrant_side_meta_box() {
929 929
 		$primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null;
930
-		if ( ! $primary_att instanceof EE_Attendee ) {
930
+		if ( ! $primary_att instanceof EE_Attendee) {
931 931
 			$this->_template_args['no_attendee_message'] = __('There is no attached contact for this transaction.  The transaction either failed due to an error or was abandoned.', 'event_espresso');
932 932
 			$primary_att = EEM_Attendee::instance()->create_default_object();
933 933
 		}
934
-		$this->_template_args['ATT_ID'] 						= $primary_att->ID();
934
+		$this->_template_args['ATT_ID'] = $primary_att->ID();
935 935
 		$this->_template_args['prime_reg_fname']		= $primary_att->fname();
936 936
 		$this->_template_args['prime_reg_lname']		= $primary_att->lname();
937
-		$this->_template_args['prime_reg_email'] 		= $primary_att->email();
937
+		$this->_template_args['prime_reg_email'] = $primary_att->email();
938 938
 		$this->_template_args['prime_reg_phone'] 	= $primary_att->phone();
939
-		$this->_template_args['edit_attendee_url'] 	= EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID()  ), REG_ADMIN_URL );
939
+		$this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL);
940 940
 		// get formatted address for registrant
941
-		EE_Registry::instance()->load_helper( 'Formatter' );
942
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att );
943
-		echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE );
941
+		EE_Registry::instance()->load_helper('Formatter');
942
+		$this->_template_args['formatted_address'] = EEH_Address::format($primary_att);
943
+		echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE);
944 944
 	}
945 945
 
946 946
 
@@ -955,10 +955,10 @@  discard block
 block discarded – undo
955 955
 	public function txn_billing_info_side_meta_box() {
956 956
 
957 957
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
958
-		$this->_template_args['billing_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'billing'  ), TXN_ADMIN_URL );
958
+		$this->_template_args['billing_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'billing'), TXN_ADMIN_URL);
959 959
 
960
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php';
961
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/
960
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php';
961
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/
962 962
 	}
963 963
 
964 964
 
@@ -972,9 +972,9 @@  discard block
 block discarded – undo
972 972
 	*/
973 973
 	public function apply_payments_or_refunds() {
974 974
 
975
-		$json_response_data = array( 'return_data' => FALSE );
975
+		$json_response_data = array('return_data' => FALSE);
976 976
 
977
-		if ( isset( $this->_req_data['txn_admin_payment'] ) && isset( $this->_req_data['txn_admin_payment']['TXN_ID'] )) {
977
+		if (isset($this->_req_data['txn_admin_payment']) && isset($this->_req_data['txn_admin_payment']['TXN_ID'])) {
978 978
 
979 979
 			//save  the new payment
980 980
 			$payment = EE_Payment::new_instance(
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
 					'PMD_ID' => $this->_req_data['txn_admin_payment']['PMD_ID'],
987 987
 					// payments have a type value of 1 and refunds have a type value of -1
988 988
 					// so multiplying amount by type will give a positive value for payments, and negative values for refunds
989
-					'PAY_amount' => $this->_req_data['txn_admin_payment']['type'] < 0 ? abs( $this->_req_data['txn_admin_payment']['amount'] ) * -1 : abs( $this->_req_data['txn_admin_payment']['amount'] ),
989
+					'PAY_amount' => $this->_req_data['txn_admin_payment']['type'] < 0 ? abs($this->_req_data['txn_admin_payment']['amount']) * -1 : abs($this->_req_data['txn_admin_payment']['amount']),
990 990
 					'PAY_gateway_response' => '',
991 991
 					'PAY_txn_id_chq_nmbr' => $this->_req_data['txn_admin_payment']['txn_id_chq_nmbr'],
992 992
 					'PAY_po_number' => $this->_req_data['txn_admin_payment']['po_number'],
@@ -995,77 +995,77 @@  discard block
 block discarded – undo
995 995
 					'PAY_ID' => $this->_req_data['txn_admin_payment']['PAY_ID']
996 996
 				),
997 997
 				'',
998
-				array( 'Y-m-d', 'H:i a' )
998
+				array('Y-m-d', 'H:i a')
999 999
 			);
1000 1000
 
1001
-			if ( ! $payment->save() ){
1002
-				$msg = __( 'An error occurred. The payment has not been processed successfully.', 'event_espresso' );
1003
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1001
+			if ( ! $payment->save()) {
1002
+				$msg = __('An error occurred. The payment has not been processed successfully.', 'event_espresso');
1003
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1004 1004
 			}
1005 1005
 			// get the TXN for this payment
1006 1006
 			$transaction = $payment->transaction();
1007 1007
 			// verify transaction
1008
-			if ( $transaction instanceof EE_Transaction ) {
1008
+			if ($transaction instanceof EE_Transaction) {
1009 1009
 				/** @type EE_Transaction_Payments $transaction_payments */
1010
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1010
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1011 1011
 				//update the transaction with this payment
1012
-				if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction )) {
1013
-					$msg =__('The payment has been processed successfully.', 'event_espresso');
1014
-					EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ );
1012
+				if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) {
1013
+					$msg = __('The payment has been processed successfully.', 'event_espresso');
1014
+					EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__);
1015 1015
 				} else {
1016
-					$msg = __( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso');
1017
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1016
+					$msg = __('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso');
1017
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1018 1018
 				}
1019 1019
 				//EEH_Debug_Tools::printr( $payment, '$payment', __FILE__, __LINE__ );
1020 1020
 				// grab array of IDs for registrations to apply changes to
1021
-				if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) {
1022
-					$REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ];
1021
+				if (isset($this->_req_data['txn_admin_payment']['registrations'])) {
1022
+					$REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations'];
1023 1023
 				} else {
1024
-					$REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1024
+					$REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1025 1025
 				}
1026
-				$this->_remove_non_applicable_registration_payments( $payment, $REG_IDs );
1026
+				$this->_remove_non_applicable_registration_payments($payment, $REG_IDs);
1027 1027
 				// apply payment to registrations (if applicable)
1028
-				if ( ! empty( $REG_IDs ) ) {
1028
+				if ( ! empty($REG_IDs)) {
1029 1029
 					//EEH_Debug_Tools::printr( $REG_IDs, '$REG_IDs', __FILE__, __LINE__ );
1030
-					$registration_query_where_params = array( 'REG_ID' => array( 'IN', $REG_IDs ) );
1031
-					$this->_process_updated_registration_payments( $transaction, $payment, $registration_query_where_params );
1030
+					$registration_query_where_params = array('REG_ID' => array('IN', $REG_IDs));
1031
+					$this->_process_updated_registration_payments($transaction, $payment, $registration_query_where_params);
1032 1032
 					// now process status changes for the same registrations
1033
-					if ( isset( $this->_req_data['txn_reg_status_change'] ) ) {
1034
-						$this->_process_registration_status_change( $transaction, array( $registration_query_where_params ) );
1033
+					if (isset($this->_req_data['txn_reg_status_change'])) {
1034
+						$this->_process_registration_status_change($transaction, array($registration_query_where_params));
1035 1035
 					}
1036 1036
 				}
1037 1037
 
1038
-				$this->_process_payment_notification( $payment );
1038
+				$this->_process_payment_notification($payment);
1039 1039
 
1040 1040
 				//prepare to render page
1041 1041
 				$this->_get_payment_status_array();
1042
-				$json_response_data[ 'return_data' ][ 'amount' ] = $payment->amount();
1043
-				$json_response_data[ 'return_data' ][ 'total_paid' ] = $transaction->paid();
1044
-				$json_response_data[ 'return_data' ][ 'txn_status' ] = $transaction->status_ID();
1045
-				$json_response_data[ 'return_data' ][ 'pay_status' ] = $payment->STS_ID();
1046
-				$json_response_data[ 'return_data' ][ 'PAY_ID' ] = $payment->ID();
1047
-				$json_response_data[ 'return_data' ][ 'STS_ID' ] = $payment->STS_ID();
1048
-				$json_response_data[ 'return_data' ][ 'status' ] = self::$_pay_status[ $payment->STS_ID() ];
1049
-				$json_response_data[ 'return_data' ][ 'date' ] = $payment->timestamp( 'Y-m-d', 'h:i a' );
1050
-				$json_response_data[ 'return_data' ][ 'method' ] = strtoupper( $payment->source() );
1051
-				$json_response_data[ 'return_data' ][ 'PM_ID' ] = $payment->payment_method() ? $payment->payment_method()->ID() : 1;
1052
-				$json_response_data[ 'return_data' ][ 'gateway' ] = $payment->payment_method() ? $payment->payment_method()->admin_name() : __( "Unknown", 'event_espresso' );
1053
-				$json_response_data[ 'return_data' ][ 'gateway_response' ] = $payment->gateway_response();
1054
-				$json_response_data[ 'return_data' ][ 'txn_id_chq_nmbr' ] = $payment->txn_id_chq_nmbr();
1055
-				$json_response_data[ 'return_data' ][ 'po_number' ] = $payment->po_number();
1056
-				$json_response_data[ 'return_data' ][ 'extra_accntng' ] = $payment->extra_accntng();
1042
+				$json_response_data['return_data']['amount'] = $payment->amount();
1043
+				$json_response_data['return_data']['total_paid'] = $transaction->paid();
1044
+				$json_response_data['return_data']['txn_status'] = $transaction->status_ID();
1045
+				$json_response_data['return_data']['pay_status'] = $payment->STS_ID();
1046
+				$json_response_data['return_data']['PAY_ID'] = $payment->ID();
1047
+				$json_response_data['return_data']['STS_ID'] = $payment->STS_ID();
1048
+				$json_response_data['return_data']['status'] = self::$_pay_status[$payment->STS_ID()];
1049
+				$json_response_data['return_data']['date'] = $payment->timestamp('Y-m-d', 'h:i a');
1050
+				$json_response_data['return_data']['method'] = strtoupper($payment->source());
1051
+				$json_response_data['return_data']['PM_ID'] = $payment->payment_method() ? $payment->payment_method()->ID() : 1;
1052
+				$json_response_data['return_data']['gateway'] = $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso');
1053
+				$json_response_data['return_data']['gateway_response'] = $payment->gateway_response();
1054
+				$json_response_data['return_data']['txn_id_chq_nmbr'] = $payment->txn_id_chq_nmbr();
1055
+				$json_response_data['return_data']['po_number'] = $payment->po_number();
1056
+				$json_response_data['return_data']['extra_accntng'] = $payment->extra_accntng();
1057 1057
 
1058 1058
 			} else {
1059
-				EE_Error::add_error( __( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1059
+				EE_Error::add_error(__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1060 1060
 			}
1061 1061
 
1062 1062
 		} else {
1063
-			$msg = __( 'The payment form data could not be loaded.', 'event_espresso' );
1064
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1063
+			$msg = __('The payment form data could not be loaded.', 'event_espresso');
1064
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1065 1065
 		}
1066 1066
 
1067
-		$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
1068
-		echo json_encode( array_merge( $json_response_data, $notices ));
1067
+		$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
1068
+		echo json_encode(array_merge($json_response_data, $notices));
1069 1069
 		die();
1070 1070
 
1071 1071
 	}
@@ -1081,14 +1081,14 @@  discard block
 block discarded – undo
1081 1081
 	 * @param \EE_Payment $payment
1082 1082
 	 * @return array
1083 1083
 	 */
1084
-	protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) {
1084
+	protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) {
1085 1085
 		static $existing_reg_payment_REG_IDs = null;
1086 1086
 		//EEH_Debug_Tools::printr( $existing_reg_payment_REG_IDs, '$existing_reg_payment_REG_IDs', __FILE__, __LINE__ );
1087
-		if ( $existing_reg_payment_REG_IDs === null ) {
1087
+		if ($existing_reg_payment_REG_IDs === null) {
1088 1088
 			// let's get any existing reg payment records for this payment
1089
-			$existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' );
1089
+			$existing_reg_payment_REG_IDs = $payment->get_many_related('Registration');
1090 1090
 			// but we only want the REG IDs, so grab the array keys
1091
-			$existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array();
1091
+			$existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array();
1092 1092
 		}
1093 1093
 		//EEH_Debug_Tools::printr( $existing_reg_payment_REG_IDs, '$existing_reg_payment_REG_IDs', __FILE__, __LINE__ );
1094 1094
 		return $existing_reg_payment_REG_IDs;
@@ -1109,20 +1109,20 @@  discard block
 block discarded – undo
1109 1109
 	 * @param \EE_Payment $payment
1110 1110
 	 * @param array $new_reg_payment_REG_IDs
1111 1111
 	 */
1112
-	protected function _remove_non_applicable_registration_payments( EE_Payment $payment, $new_reg_payment_REG_IDs = array() ) {
1113
-		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1112
+	protected function _remove_non_applicable_registration_payments(EE_Payment $payment, $new_reg_payment_REG_IDs = array()) {
1113
+		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1114 1114
 		//EEH_Debug_Tools::printr( $existing_reg_payment_REG_IDs, '$existing_reg_payment_REG_IDs', __FILE__, __LINE__ );
1115 1115
 		// registrations that were unchecked ( ie: NOT in the $REG_IDs array ) need to have existing reg payments removed
1116
-		$reg_payment_REG_IDs_to_remove = array_diff( $existing_reg_payment_REG_IDs, $new_reg_payment_REG_IDs );
1116
+		$reg_payment_REG_IDs_to_remove = array_diff($existing_reg_payment_REG_IDs, $new_reg_payment_REG_IDs);
1117 1117
 		//EEH_Debug_Tools::printr( $reg_payment_REG_IDs_to_remove, '$reg_payment_REG_IDs_to_remove', __FILE__, __LINE__ );
1118 1118
 		/** @type EE_Transaction_Payments $transaction_payments */
1119
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1119
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1120 1120
 		$transaction_payments->delete_registration_payments_and_update_registrations(
1121 1121
 			$payment,
1122 1122
 			array(
1123 1123
 				array(
1124 1124
 					'PAY_ID' => $payment->ID(),
1125
-					'REG_ID' => array( 'IN', $reg_payment_REG_IDs_to_remove )
1125
+					'REG_ID' => array('IN', $reg_payment_REG_IDs_to_remove)
1126 1126
 				)
1127 1127
 			)
1128 1128
 		);
@@ -1141,26 +1141,26 @@  discard block
 block discarded – undo
1141 1141
 	 * @param array $registration_query_where_params
1142 1142
 	 * @return bool
1143 1143
 	 */
1144
-	protected function _process_updated_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $registration_query_where_params = array() ) {
1144
+	protected function _process_updated_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registration_query_where_params = array()) {
1145 1145
 		// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
1146 1146
 		// so let's do that using our set of REG_IDs from the form, but add in some conditions regarding payment
1147 1147
 		// so that we don't apply payments to registrations that are free or have already been paid for
1148 1148
 		// but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative )
1149
-		if ( ! $payment->is_a_refund() ) {
1149
+		if ( ! $payment->is_a_refund()) {
1150 1150
 			$registration_query_where_params = array_merge(
1151 1151
 				$registration_query_where_params,
1152 1152
 				array(
1153
-					'REG_final_price'  => array( '!=', 0 ),
1154
-					'REG_final_price*' => array( '!=', 'REG_paid', true ),
1153
+					'REG_final_price'  => array('!=', 0),
1154
+					'REG_final_price*' => array('!=', 'REG_paid', true),
1155 1155
 				)
1156 1156
 			);
1157 1157
 		}
1158
-		$registrations = $transaction->registrations( array( $registration_query_where_params ) );
1158
+		$registrations = $transaction->registrations(array($registration_query_where_params));
1159 1159
 		//EEH_Debug_Tools::printr( $registrations, '$registrations', __FILE__, __LINE__ );
1160
-		if ( ! empty( $registrations ) ) {
1160
+		if ( ! empty($registrations)) {
1161 1161
 			/** @type EE_Payment_Processor $payment_processor */
1162
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1163
-			$payment_processor->process_registration_payments( $transaction, $payment, $registrations );
1162
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1163
+			$payment_processor->process_registration_payments($transaction, $payment, $registrations);
1164 1164
 		}
1165 1165
 	}
1166 1166
 
@@ -1176,16 +1176,16 @@  discard block
 block discarded – undo
1176 1176
 	 * @param array $registration_query_params
1177 1177
 	 * @return bool
1178 1178
 	 */
1179
-	protected function _process_registration_status_change( EE_Transaction $transaction, $registration_query_params = array() ) {
1179
+	protected function _process_registration_status_change(EE_Transaction $transaction, $registration_query_params = array()) {
1180 1180
 		// first if there is no change in status then we get out.
1181
-		if ( ! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ) || $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN' ) {
1181
+		if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status']) || $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN') {
1182 1182
 			//no error message, no change requested, just nothing to do man.
1183 1183
 			return FALSE;
1184 1184
 		}
1185 1185
 		/** @type EE_Transaction_Processor $transaction_processor */
1186
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1186
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1187 1187
 		// made it here dude?  Oh WOW.  K, let's take care of changing the statuses
1188
-		return $transaction_processor->manually_update_registration_statuses( $transaction, sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ), $registration_query_params );
1188
+		return $transaction_processor->manually_update_registration_statuses($transaction, sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']), $registration_query_params);
1189 1189
 //		$transaction_processor->finalize( $transaction, TRUE, FALSE);
1190 1190
 	}
1191 1191
 
@@ -1200,17 +1200,17 @@  discard block
 block discarded – undo
1200 1200
 	*/
1201 1201
 	public function delete_payment() {
1202 1202
 
1203
-		$json_response_data = array( 'return_data' => FALSE );
1204
-		$PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0;
1205
-		if ( $PAY_ID ) {
1206
-			$delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false;
1207
-			$payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID );
1208
-			if ( $payment instanceof EE_Payment ) {
1203
+		$json_response_data = array('return_data' => FALSE);
1204
+		$PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0;
1205
+		if ($PAY_ID) {
1206
+			$delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false;
1207
+			$payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
1208
+			if ($payment instanceof EE_Payment) {
1209 1209
 
1210 1210
 				/** @type EE_Transaction_Payments $transaction_payments */
1211
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1212
-				if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) {
1213
-					EE_Error::add_success( __( 'The Payment was successfully deleted.', 'event_espresso' ) );
1211
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1212
+				if ($transaction_payments->delete_payment_and_update_transaction($payment)) {
1213
+					EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso'));
1214 1214
 					$json_response_data['return_data'] = array(
1215 1215
 						'PAY_ID' => $PAY_ID,
1216 1216
 						'amount' => $payment->amount(),
@@ -1219,27 +1219,27 @@  discard block
 block discarded – undo
1219 1219
 						'pay_status' => $payment->STS_ID(),
1220 1220
 						'delete_txn_reg_status_change' => $delete_txn_reg_status_change
1221 1221
 					);
1222
-					if ( $delete_txn_reg_status_change ) {
1222
+					if ($delete_txn_reg_status_change) {
1223 1223
 						$this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change;
1224 1224
 						//MAKE sure we also add the delete_txn_req_status_change to the
1225 1225
 						//$_REQUEST global because that's how messages will be looking
1226 1226
 						//for it.
1227 1227
 						$_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change;
1228
-						$this->_process_registration_status_change( $payment->transaction() );
1228
+						$this->_process_registration_status_change($payment->transaction());
1229 1229
 					}
1230 1230
 				}
1231 1231
 
1232 1232
 			} else {
1233
-				EE_Error::add_error( __( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1233
+				EE_Error::add_error(__('Valid Payment data could not be retrieved from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1234 1234
 			}
1235 1235
 
1236 1236
 		} else {
1237
-			$msg = __( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' );
1238
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1237
+			$msg = __('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso');
1238
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1239 1239
 		}
1240 1240
 
1241
-		$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
1242
-		echo json_encode( array_merge( $json_response_data, $notices ));
1241
+		$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
1242
+		echo json_encode(array_merge($json_response_data, $notices));
1243 1243
 		die();
1244 1244
 	}
1245 1245
 
@@ -1253,12 +1253,12 @@  discard block
 block discarded – undo
1253 1253
 	*	@return void
1254 1254
 	*/
1255 1255
 	protected function _send_payment_reminder() {
1256
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1257
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1258
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1259
-		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
1256
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
1257
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1258
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array();
1259
+		do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction);
1260 1260
 
1261
-		$this->_redirect_after_action( FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE );
1261
+		$this->_redirect_after_action(FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE);
1262 1262
 	}
1263 1263
 
1264 1264
 
@@ -1272,36 +1272,36 @@  discard block
 block discarded – undo
1272 1272
 	 * @param string   $view
1273 1273
 	 * @return mixed int = count || array of transaction objects
1274 1274
 	 */
1275
-	public function get_transactions( $perpage, $count = FALSE, $view = '' ) {
1275
+	public function get_transactions($perpage, $count = FALSE, $view = '') {
1276 1276
 
1277 1277
 		$TXN = EEM_Transaction::instance();
1278 1278
 
1279
-	    $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1280
-	    $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1279
+	    $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year'));
1280
+	    $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y');
1281 1281
 
1282 1282
 	    //make sure our timestamps start and end right at the boundaries for each day
1283
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1284
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1283
+	    $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
1284
+	    $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
1285 1285
 
1286 1286
 
1287 1287
 	    //convert to timestamps
1288
-	    $start_date = strtotime( $start_date );
1289
-	    $end_date = strtotime( $end_date );
1288
+	    $start_date = strtotime($start_date);
1289
+	    $end_date = strtotime($end_date);
1290 1290
 
1291 1291
 	    //makes sure start date is the lowest value and vice versa
1292
-	    $start_date = min( $start_date, $end_date );
1293
-	    $end_date = max( $start_date, $end_date );
1292
+	    $start_date = min($start_date, $end_date);
1293
+	    $end_date = max($start_date, $end_date);
1294 1294
 
1295 1295
 	    //convert to correct format for query
1296
-	$start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
1297
-	$end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
1296
+	$start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s');
1297
+	$end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s');
1298 1298
 
1299 1299
 
1300 1300
 
1301 1301
 	    //set orderby
1302 1302
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1303 1303
 
1304
-		switch ( $this->_req_data['orderby'] ) {
1304
+		switch ($this->_req_data['orderby']) {
1305 1305
 			case 'TXN_ID':
1306 1306
 				$orderby = 'TXN_ID';
1307 1307
 				break;
@@ -1315,64 +1315,64 @@  discard block
 block discarded – undo
1315 1315
 				$orderby = 'TXN_timestamp';
1316 1316
 		}
1317 1317
 
1318
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
1319
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1320
-		$per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10;
1321
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1318
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
1319
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1320
+		$per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10;
1321
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1322 1322
 
1323
-		$offset = ($current_page-1)*$per_page;
1324
-		$limit = array( $offset, $per_page );
1323
+		$offset = ($current_page - 1) * $per_page;
1324
+		$limit = array($offset, $per_page);
1325 1325
 
1326 1326
 		$_where = array(
1327
-			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ),
1327
+			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)),
1328 1328
 			'Registration.REG_count' => 1
1329 1329
 		);
1330 1330
 
1331
-		if ( isset( $this->_req_data['EVT_ID'] ) ) {
1331
+		if (isset($this->_req_data['EVT_ID'])) {
1332 1332
 			$_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID'];
1333 1333
 		}
1334 1334
 
1335
-		if ( isset( $this->_req_data['s'] ) ) {
1336
-			$search_string = '%' . $this->_req_data['s'] . '%';
1335
+		if (isset($this->_req_data['s'])) {
1336
+			$search_string = '%'.$this->_req_data['s'].'%';
1337 1337
 			$_where['OR'] = array(
1338
-				'Registration.Event.EVT_name' => array( 'LIKE', $search_string ),
1339
-				'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ),
1340
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ),
1341
-				'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ),
1342
-				'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ),
1343
-				'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ),
1344
-				'Registration.Attendee.ATT_email' => array('LIKE', $search_string ),
1345
-				'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ),
1346
-				'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ),
1347
-				'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ),
1348
-				'Registration.REG_final_price' => array( 'LIKE', $search_string ),
1349
-				'Registration.REG_code' => array( 'LIKE', $search_string ),
1350
-				'Registration.REG_count' => array( 'LIKE' , $search_string ),
1351
-				'Registration.REG_group_size' => array( 'LIKE' , $search_string ),
1352
-				'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ),
1353
-				'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ),
1354
-				'Payment.PAY_source' => array('LIKE', $search_string ),
1355
-				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ),
1356
-				'TXN_session_data' => array( 'LIKE', $search_string )
1338
+				'Registration.Event.EVT_name' => array('LIKE', $search_string),
1339
+				'Registration.Event.EVT_desc' => array('LIKE', $search_string),
1340
+				'Registration.Event.EVT_short_desc' => array('LIKE', $search_string),
1341
+				'Registration.Attendee.ATT_fname' => array('LIKE', $search_string),
1342
+				'Registration.Attendee.ATT_lname' => array('LIKE', $search_string),
1343
+				'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string),
1344
+				'Registration.Attendee.ATT_email' => array('LIKE', $search_string),
1345
+				'Registration.Attendee.ATT_address' => array('LIKE', $search_string),
1346
+				'Registration.Attendee.ATT_address2' => array('LIKE', $search_string),
1347
+				'Registration.Attendee.ATT_city' => array('LIKE', $search_string),
1348
+				'Registration.REG_final_price' => array('LIKE', $search_string),
1349
+				'Registration.REG_code' => array('LIKE', $search_string),
1350
+				'Registration.REG_count' => array('LIKE', $search_string),
1351
+				'Registration.REG_group_size' => array('LIKE', $search_string),
1352
+				'Registration.Ticket.TKT_name' => array('LIKE', $search_string),
1353
+				'Registration.Ticket.TKT_description' => array('LIKE', $search_string),
1354
+				'Payment.PAY_source' => array('LIKE', $search_string),
1355
+				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string),
1356
+				'TXN_session_data' => array('LIKE', $search_string)
1357 1357
 				);
1358 1358
 		}
1359 1359
 
1360 1360
 		//failed transactions
1361
-		$failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE;
1362
-		$abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE;
1361
+		$failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE: FALSE;
1362
+		$abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE: FALSE;
1363 1363
 
1364
-		if ( $failed ) {
1365
-			$_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code;
1366
-		} else if ( $abandoned ) {
1364
+		if ($failed) {
1365
+			$_where['STS_ID'] = EEM_Transaction::failed_status_code;
1366
+		} else if ($abandoned) {
1367 1367
 				$_where['STS_ID'] = EEM_Transaction::abandoned_status_code;
1368 1368
 		} else {
1369
-				$_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code );
1370
-				$_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code );
1369
+				$_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code);
1370
+				$_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code);
1371 1371
 		}
1372 1372
 
1373
-		$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit );
1373
+		$query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit);
1374 1374
 
1375
-		$transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params);
1375
+		$transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params);
1376 1376
 
1377 1377
 
1378 1378
 		return $transactions;
Please login to merge, or discard this patch.